Setting Up a Development Environment for Python, Node.js, and Java on Fedora

Fedora is a popular Linux distribution known for its cutting-edge features and stability, making it an excellent choice for setting up a development environment.

This tutorial will guide you through setting up a development environment for three widely-used programming languages: Python, Node.js, and Java. We will cover the installation process, configuration, and common tools for each language.

Prerequisites

Before we begin, ensure you have a working installation of Fedora. You should have administrative (root) access to the system, as installing software requires superuser privileges.

If you’re using a non-root user, you can use sudo for commands requiring administrative rights.

Step 1: Setting Up Python Development Environment in Fedora

Python is one of the most popular programming languages, known for its simplicity and versatility. Here’s how you can set up a Python development environment on Fedora.

1.1 Install Python in Fedora

Fedora comes with Python pre-installed, but it’s always a good idea to ensure you have the latest version. You can check the current version of Python by running:

python3 --version

To install the latest version of Python, run the following command:

sudo dnf install python3 -y

1.2 Install pip (Python Package Installer)

pip is a package manager for Python, and it’s essential for installing third-party libraries.

sudo dnf install python3-pip -y

Verify the installation by running:

pip3 --version

1.3 Set Up a Virtual Environment

A virtual environment allows you to create isolated Python environments for different projects, ensuring that dependencies don’t conflict.

To set up a virtual environment, run the following commands.

sudo dnf install python3-virtualenv -y
python3 -m venv myenv
source myenv/bin/activate

To deactivate the virtual environment, simply run:

deactivate

1.4 Install Essential Python Libraries

To make development easier, you may want to install some essential Python libraries.

pip install numpy pandas requests flask django

1.5 Install an Integrated Development Environment (IDE)

While you can use any text editor for Python, an IDE like PyCharm or Visual Studio Code (VSCode) can provide advanced features like code completion and debugging.

To install VSCode on Fedora, run:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null
dnf check-update
sudo dnf install code

Alternatively, you can download PyCharm from the official website.

Step 2: Setting Up Node.js Development Environment in Fedora

Node.js is a popular runtime for building server-side applications with JavaScript and here’s how to set up Node.js on Fedora.

2.1 Install Node.js in Fedora

Fedora provides the latest stable version of Node.js in its official repositories.

sudo dnf install nodejs -y

You can verify the installation by checking the version.

node --version

2.2 Install npm (Node Package Manager) in Fedora

npm is the default package manager for Node.js and is used to install and manage JavaScript libraries. It should be installed automatically with Node.js, but you can check the version by running:

npm --version

2.3 Set Up a Node.js Project in Fedora

To start a new Node.js project, create a new directory for your project.

mkdir my-node-project
cd my-node-project

Next, initialize a new Node.js project, which will create a package.json file, which will contain metadata about your project and its dependencies.

npm init

Install dependencies. For example, to install the popular express framework, run:

npm install express --save

Create a simple Node.js application in index.js.

const express = require('express');
const app = express();
const port = 3000;

app.get('/', (req, res) => {
  res.send('Hello World!');
});

app.listen(port, () => {
  console.log(`Server is running at http://localhost:${port}`);
});

Run the application.

node index.js

2.4 Install an IDE or Text Editor

For Node.js development, Visual Studio Code (VSCode) is a great option, as it provides excellent support for JavaScript and Node.js.

sudo dnf install code -y

Alternatively, you can use Sublime Text.

Step 3: Setting Up Java Development Environment in Fedora

Java is one of the most widely used programming languages, especially for large-scale applications.

Here’s how to set up Java on Fedora.

3.1 Install OpenJDK in Fedora

Fedora provides the OpenJDK package, which is an open-source implementation of the Java Platform.

sudo dnf install java-17-openjdk-devel -y

You can verify the installation by checking the version.

java -version

3.2 Set Up JAVA_HOME Environment Variable in Fedora

To ensure that Java is available system-wide, set the JAVA_HOME environment variable.

First, find the path of the installed Java version:

sudo update-alternatives --config java

Once you have the Java path, add it to your .bashrc file.

echo "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk" >> ~/.bashrc
echo "export PATH=$JAVA_HOME/bin:$PATH" >> ~/.bashrc
source ~/.bashrc

3.3 Install Maven (Optional) in Fedora

Maven is a popular build automation tool for Java projects.

sudo dnf install maven -y

Verify the installation.

mvn -version

3.4 Set Up a Java Project in Fedora

To set up a simple Java project, create a new directory for your project.

mkdir MyJavaProject
cd MyJavaProject

Create a new Java file Main.java.

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

Compile the Java file and run the application.

javac Main.java
java Main

3.5 Install an IDE for Java in Fedora

For Java development, IntelliJ IDEA or Eclipse are excellent choices.

sudo dnf install intellij-idea-community -y

Alternatively, you can download the latest version from the official website.

Step 3: Additional Tools for Development in Fedora

Regardless of the language you are working with, there are some additional tools that can improve your development experience.

3.1 Version Control with Git

Git is essential for managing source code and collaborating with others.

sudo dnf install git -y
git --version

3.2 Docker for Containerization in Fedora

Docker allows you to containerize your applications for easy deployment.

sudo dnf install docker -y
sudo systemctl enable --now docker

Verify Docker installation.

docker --version

3.3 Database Setup (Optional) in Fedora

If your application requires a database, you can install MySQL, PostgreSQL, or MongoDB.

For example, to install MySQL, run:

sudo dnf install mysql-server -y
sudo systemctl enable --now mysqld
Conclusion

In this tutorial, we’ve covered how to set up development environments for Python, Node.js, and Java on Fedora. We also touched on setting up essential tools like Git, Docker, and databases to enhance your development workflow.

With these steps, you can begin developing applications in any of these languages, leveraging Fedora’s powerful development tools.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

7 Comments

Leave a Reply
  1. This tutorial was super helpful! I’ve been using Fedora for a while but never knew how easy it is to set up a Python environment. The virtual environment setup is a game-changer for managing dependencies. Thanks for the detailed guide!

    Reply
    • Thank you so much for your kind words! I’m glad the tutorial was helpful to you. The virtual environment setup really does make managing dependencies so much easier,

      Reply
  2. I’ve always struggled with setting up Node.js, but the instructions here were so clear. The step-by-step approach for creating a new project and installing dependencies was exactly what I needed.

    Great job!

    Reply
    • Thank you so much for your kind words! I’m really glad to hear that the instructions helped you set up Node.js easily.

      It’s great to know the step-by-step approach worked for you. If you have any more questions or need further assistance, feel free to ask.

      Happy coding!”

      Reply
  3. I’ve been wanting to get started with Java development on Fedora, and this guide made it so simple. The setup for OpenJDK and configuring the JAVA_HOME variable saved me so much time. Highly recommend this tutorial!

    Reply
  4. Thanks for including the Maven setup in the Java section! It was a nice touch. I also appreciate the additional tools section; Docker and Git are essential for any developer, and it’s good to see them included.

    Reply
    • You’re very welcome! I’m glad you found the Maven setup helpful. Docker and Git really are essential tools for modern development, so I wanted to make sure they were included.

      Thanks for the feedback, and I hope the tutorial helps with your projects!

      Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.