Nexus provides a centralized location to store and manage your application binaries and build artifacts that can be scaled efficiently across multiple servers. If you are looking for a package repository to support ecosystems such as Java/Maven, npm, NuGet, PyPI, RubyGems, and many others, you will find Nexus to be helpful. Below are steps that show you how to install and use Nexus repository management on Ubuntu Linux.

How to install and use Nexus repository manager on Ubuntu Linux

As described above, Nexus provides a centralized location to store and manage your application binaries and build artifacts that can be scaled efficiently across multiple servers. Below is how to install it on Ubuntu Linux. Before installing Nexus, you should be aware that there are two versions available. One is open-source and the other is commercial, which means you pay for it. We are going to be installing the open-source version in this post.

Install Java

Nexus repository manager requires Java OpenJDK and JRE v8 and up. The OpenJDK version 8 works great with Nexus, so we’re going to install that version. Run the commands below to update Ubuntu package indexes and install OpenJDK version 8. Additional resources on installing and using OpenJDK on Ubuntu can be found at the link below. How to install and use OpenJDK on Ubuntu Linux

Install Nexus repository manager

Now that OpenJDK is installed, let’s go and download the Nexus package and install it. At the time of this writing, the latest version of Nexus is v3.41.1. Run the commands below to download the Nexus package. Once the package is downloaded, run the commands below to extract the downloaded file, and move both the nexus and sonatype-work folders to a new nexus folder in the /opt/nexus directory. For this post, we are doing to create a dedicated user account called nexus. This account will not be used to log on to the system. Once the account is created, change the ownership of the /opt/nexus directory to the nexus user by running the commands below.

Configure Nexus to run on Ubuntu

For nexus to function we will have to edit its configuration file and have the service run as the nexus user created above. Run the commands below to open the /opt/nexus/bin/nexus.rc configuration file. Uncomment the line below to make sure that the service runs as the nexus user. Next, run the commands below to open the nexus properties config file. Then make sure to define the application host. By default, Nexus will communicate on all IPs. If you want to use a specific IP address, then define it in the nexus-default.properties file. Save the file and exit. Once you are done, run the commands below to create a Nexus systemd service file. Copy and lines below into the file and save it. Reload systemd-daemon and start Nexus services. Nexus should be started and running. By default, Nexus will use port number 8080 on the local server. Open your web browser and browse to the server hostname or IP address followed by port number 8081. Nexus default portal should appear. You can use the default username and password found in the file below to log on. You will be prompted to change the temporary password when you first log on.

Run Nexus behind a proxy

The most efficient way to run Nexus is to run it behind a reverse proxy server. Below are two posts that showed you how to set up a reverse proxy with Nginx and Apache.

How to set up a reverse proxy with Nginx How to set up a reverse proxy with Apache

That should do it! More documentation can be found at the link below. https://help.sonatype.com/docs Conclusion: This post showed you how to install and use Nexus repository manager on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.