FedoraRHEL Based

How To Install Kotlin on Fedora 38

Install Kotlin on Fedora 38

In this tutorial, we will show you how to install Kotlin on Fedora 38. Kotlin, an innovative programming language that combines the best of Java with modern features, has captured the hearts of developers worldwide. It offers concise syntax, enhanced safety, and seamless interoperability with Java, making it an excellent choice for a variety of software projects.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Kotlin programming language on a Fedora 38.

Prerequisites

  • A server running one of the following operating systems: Fedora 38.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Kotlin.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Kotlin on Fedora 38

Step 1. Updating Fedora’s package manager ensures that you have the latest software repositories and dependencies. The package manager used in Fedora is called DNF (Dandified YUM):

sudo dnf clean all
sudo dnf update

Step 2. Installing Java Development Kit (JDK).

Kotlin runs on the Java Virtual Machine (JVM), so you’ll need to install the Java Development Kit (JDK) to use Kotlin. Fedora typically comes with OpenJDK, which is suitable for our purposes. Install OpenJDK with the following command:

sudo dnf install java-1.8.0-openjdk

Step 3. Installing SDKMAN.

SDKMAN, the Software Development Kit Manager, is a vital tool for managing Kotlin versions and simplifying the installation and management of various software development kits. Let’s start by installing SDKMAN itself:

curl -s "https://get.sdkman.io" | bash

After the installation is complete, activate SDKMAN by running the following:

source "$HOME/.sdkman/bin/sdkman-init.sh"

Verify the installation by checking the SDKMAN version:

sdk version

Step 4. Installing Kotlin on Fedora 38.

With SDKMAN in place, you can now easily install Kotlin and manage its versions. Use SDKMAN to search for available Kotlin versions by executing:

sdk list kotlin

This will present a list of Kotlin versions you can install. Look for the version that best suits your project requirements.

Choose the Kotlin version you’d like to install from the list and use the following command, replacing <version> with your selected version:

sdk install kotlin <version>

Once Kotlin is installed, set the newly installed version as the default for your system:

sdk default kotlin <version>

Confirm that Kotlin is correctly installed by running:

kotlin -version

This should display the Kotlin version you just installed. Congratulations, you’ve successfully installed Kotlin!

Step 5. Create a Kotlin Hello World Program.

Let’s start by creating a simple Kotlin program to verify that everything is functioning as expected. In your terminal, create a new Kotlin file named ‘HelloWorld.kt‘ using the ‘touch’ command:

touch HelloWorld.kt

Open the ‘HelloWorld.kt‘ file in a text editor like nano:

nano HelloWorld.kt

In nano, enter the following Kotlin code to create a classic “Hello, World!” program:

fun main() {
println("Hello, World!")
}

Save the file, then execute the following command to compile your program:

kotlinc HelloWorld.kt -include-runtime -d HelloWorld.jar

Now, run your compiled program using the Java Virtual Machine (JVM):

java -jar HelloWorld.jar

You should see the output: “Hello, World!” displayed on your screen, confirming that Kotlin is correctly configured on your Fedora 38 system.

Congratulations! You have successfully installed Kotlin. Thanks for using this tutorial for installing Kotlin programming language on your Fedora 38 system. For additional help or useful information, we recommend you check the official Kotlin website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button