Sonatype Nexus is a free, open-source artifact management tool that helps you to manage artifacts effectively across your software supply chain. It provides a single source of truth for every component with native package manager compatibility. It can be integrated with your existing user and authentication systems like LDAP and Atlassian Crowd. Sonatype Nexus is compatible with popular IDEs and CI like Eclipse, IntelliJ, Visual Studio, Jenkins, and more.
In this post, we will show you how to install Sonatype Nexus on Oracle Linux 8.
- A fresh Oracle Linux 8 server on the Atlantic.Net Cloud Platform
- A root password configured on your server
Step 1 – Create Atlantic.Net Cloud Server
First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Oracle Linux 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.
Once you are logged in to your Oracle Linux 8 server, run the following command to update your base system with the latest available packages.
dnf update -y
Step 2 – Install Java JDK
Sonatype Nexus is a Java-based application, so Java must be installed on your system. If not installed, you can install it with the following command:
dnf install java-1.8.0-openjdk.x86_64 -y
Once Java is installed, you can verify the Java version using the following command:
You should see the following output:
openjdk version "1.8.0_342" OpenJDK Runtime Environment (build 1.8.0_342-b07) OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode)
Step 3 – Install Sonatype Nexus Oracle Linux 8
First, create a dedicated user to run Nexus with the following command:
Next, create the required directory to store Nexus files:
Next, change the directory to /app and download the latest version of Nexus with the following command:
cd /app wget -O nexus.tar.gz https://download.sonatype.com/nexus/3/latest-unix.tar.gz
Next, extract the downloaded file with the following command:
tar -xvf nexus.tar.gz
Next, rename the extracted directory with the following command:
mv nexus-3* nexus
Next, change the ownership and permissions of the Nexus directory with the following command:
chown -R nexus:nexus /app/nexus chown -R nexus:nexus /app/sonatype-work
Next, edit the Nexus configuration file and define the Nexus user:
Change the following line:
Save and close the file when you finish.
Step 4 – Create a Systemd Service File for Nexus
Next, you will need to create a systemd service file to manage the Nexus via systemd.
You can create it with the following command:
Add the following configurations:
[Unit] Description=nexus service After=network.target [Service] Type=forking LimitNOFILE=65536 User=nexus Group=nexus ExecStart=/app/nexus/bin/nexus start ExecStop=/app/nexus/bin/nexus stop User=nexus Restart=on-abort [Install] WantedBy=multi-user.target
Save and close the file, then reload the systemd daemon with the following command:
Next, start and enable the Nexus service with the following command:
systemctl start nexus systemctl enable nexus
You can check the status of the Nexus service using the following command:
systemctl status nexus
You will get the following output:
● nexus.service - nexus service Loaded: loaded (/etc/systemd/system/nexus.service; disabled; vendor preset: disabled) Active: active (running) since Thu 2022-09-01 07:51:39 EDT; 5s ago Process: 13727 ExecStart=/app/nexus/bin/nexus start (code=exited, status=0/SUCCESS) Main PID: 13939 (java) Tasks: 47 (limit: 49496) Memory: 509.2M CGroup: /system.slice/nexus.service └─13939 /usr/lib/jvm/java-1.8.0-openjdk-22.214.171.1242.b07-2.el8_6.x86_64/jre/bin/java -server -Dinstall4j.jvmDir=/usr/lib/jvm/java-1.8> Sep 01 07:51:39 oraclelinux8 systemd: Starting nexus service... Sep 01 07:51:39 oraclelinux8 systemd: Started nexus service.
Step 5 – Access Nexus Web Interface
At this point, Nexus is started and listens on port 8081. You can check it with the following command:
You will get the following output:
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 1 127.0.0.1:42221 0.0.0.0:* users:(("java",pid=13939,fd=118)) LISTEN 0 50 0.0.0.0:8081 0.0.0.0:* users:(("java",pid=13939,fd=971))
Nexus’s default username is admin and the default password is stored in the /app/sonatype-work/nexus3/admin.password file. You can see the Nexus admin password with the following command:
You should see the Nexus admin password in the following output:
Now, open your web browser and access the Nexus web interface using the URL http://your-server-ip:8081. You should see the Nexus home page:
In this tutorial, we explained how to install Nexus on Oracle Linux 8. You can now start managing your packages across your software supply chain. For more information, visit the Nexus documentation. Try it on dedicated hosting from Atlantic.Net!