How to Install NetBeans IDE in CentOS, RHEL and Fedora
Apache NetBeans is a powerful, open-source Integrated Development Environment (IDE) that provides a comprehensive set of tools for software development. It's a favorite among Java developers but also offers excellent support for other languages like PHP, C/C++, and HTML5. Whether you're building enterprise-scale applications, web services, or simple desktop programs, NetBeans offers an intuitive interface coupled with robust features like intelligent code completion, powerful debugging, and seamless integration with version control systems like Git.
For developers working on CentOS, Red Hat Enterprise Linux (RHEL), or Fedora, having a reliable IDE is crucial for productivity. This guide will walk you through several methods to install NetBeans IDE on your system, ensuring you can get started with your development projects quickly and efficiently. We'll cover installation via the official installer, using the Snap package, and leveraging the SDKMAN tool manager.
Before you begin the installation, ensure your system meets the following requirements:
A CentOS, RHEL, or Fedora System: This guide is tailored for these distributions. The commands might slightly differ between versions (e.g., using dnf for newer Fedora/RHEL/CentOS vs. yum for older ones).
Java Development Kit (JDK): NetBeans requires a JDK to be installed. NetBeans 13 and later require JDK 11 or above. It's recommended to install JDK 17 (LTS) or the latest JDK.
To check if Java is installed, run: java -version
If not installed, you can install OpenJDK using your package manager:
For Fedora/RHEL/CentOS 8/9:
sudo dnf install java-17-openjdk-devel
For CentOS 7:
sudo yum install java-17-openjdk-devel
Superuser (sudo) Privileges: You will need sudo access to install packages and copy files to system directories.
A Graphical Desktop Environment (for Methods 1 & 2): The standard installer and Snap method require a GUI. If you are on a server without a GUI, see the troubleshooting section for Method 1.
Method 1: Installing NetBeans using the Official Installer#
This is the most direct method and gives you full control over the installation path and components.
Select the version you want to install. For most users, the "Apache NetBeans" binary release is the correct choice. Choose the installer that matches your system architecture (e.g., linux-x64.sh for 64-bit Linux).
You can download it directly from the browser or use the wget command in the terminal. Replace the URL with the one for the latest version.
Execute the script. It's highly recommended to run it as a regular user, not as root. The installer will ask for your sudo password only if you choose to create desktop shortcuts.
./apache-netbeans-18-bin-linux-x64.sh
A graphical installation wizard will open. Follow these steps:
Welcome Screen: Click "Next".
License Agreement: Read the agreement, select "I accept the terms...," and click "Next".
Choose Install Location: Select the folder where you want NetBeans to be installed. The default (/home/yourusername/netbeans-18/) is usually fine. Click "Next".
Check for Updates: It's a good practice to leave "Check for Updates" enabled. Click "Next".
Summary: Review your choices and click "Install".
The installation progress bar will show the files being copied.
Setup Complete: You can choose to contribute to usage statistics. Click "Finish".
After installation, you can launch NetBeans in several ways:
Terminal: Navigate to the installation directory and run the bin/netbeans script.
~/netbeans-18/bin/netbeans
Desktop Shortcut: If you allowed the installer to create shortcuts, you can find NetBeans in your application menu (under "Programming" or "Development").
Create a Launcher (Optional): To make it easier to launch from anywhere, you can create a symbolic link in a directory that's in your PATH, like ~/bin (ensure ~/bin is in your PATH).
mkdir -p ~/binln -s ~/netbeans-18/bin/netbeans ~/bin/netbeans# Now you can simply type `netbeans` in the terminal to start the IDE.
Method 2: Installing NetBeans using Snap (Recommended for Fedora)#
Snap is a universal package manager that simplifies installation and provides automatic updates. This method is particularly easy on Fedora, where Snap is readily available.
Install Snapd (if not already installed):
On Fedora:
sudo dnf install snapd
On RHEL/CentOS: You need to enable the EPEL repository first.
sudo dnf install epel-release # For RHEL/CentOS 8/9sudo dnf install snapd # Or use 'yum' for CentOS 7
After installing snapd, enable the socket for the snap communication interface:
sudo systemctl enable --now snapd.socket
Install the NetBeans Snap:
sudo snap install netbeans --classic
The --classic flag is required because NetBeans needs full access to the system, similar to a traditionally packaged application.
Launch NetBeans: You can now launch NetBeans from the application menu or by typing netbeans in the terminal.
SDKMAN! (Software Development Kit Manager) is a tool for managing parallel versions of multiple SDKs, including NetBeans. This is an excellent choice if you already use SDKMAN for Java versions.
Regardless of the method you used, you can verify that NetBeans is installed correctly by launching it. Upon first start, it will prompt you to set the default JDK (if it detects multiple ones). The main window should open without any errors.
Symptom: The installer fails to start or NetBeans fails to launch, with an error about Java not being found.
Solution: Ensure the JDK is installed correctly. Set the JAVA_HOME environment variable. Add the following lines to your ~/.bashrc or ~/.zshrc file (adjust the path to your JDK):
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk # Path may varyexport PATH=$JAVA_HOME/bin:$PATH
Solution: Ensure snapd is installed correctly and that you have logged out and back in after installation, or started a new terminal session. On RHEL/CentOS, double-check that the EPEL repository is enabled.
You have now successfully installed Apache NetBeans IDE on your CentOS, RHEL, or Fedora system. You explored three different methods: the official installer for maximum control, the Snap package for simplicity and automatic updates, and SDKMAN for those who already manage their development tools with it.
NetBeans is a versatile IDE ready to boost your development workflow. You can start by creating a new project (File > New Project) and exploring its rich set of features. Happy coding!