How To Install Latest Sonatype Nexus 3 on Linux

Sonatype Nexus is one of the best repository managers out there. It is some tool that you cannot avoid in your CI/CD pipeline. It effectively manages deployable artifacts.

Sonatype Nexus 3 on Linux ec2

This article guides you to install and configure Sonatype Nexus 3 in a secure way on an ec2 Linux System.

Note: This was tested on a Redhat 7 machine and it will work on Centos 7 as well.

Step 1: Login to your Linux server and update it.

Step 2: Install OpenJDK 1.8

Note: Nexus recommends oracle JDK to be installed. For demo purposes we use OpenJDK

Step 3: Create a directory named app and cd into the directory.

Step 4: Download the latest nexus. You can get the latest download links fo for nexus from here. Here I am downloading nexus 3.

Untar the downloaded file.

Rename the untared file to nexus.

Step 5: As a good security practice, it is not advised to run nexus service with any sudo user. So create a new user named nexus.

Change the ownership of nexus file to nexus user.

Open /app/nexus/bin/nexus.rc file, uncomment run_as_user parameter and set it as following.

READ  How to Setup Ansible AWS Dynamic Inventory

Step 6: If you want to change the default nexus data directory, open nexus properties file and change the data directory “” parameter to a preferred location as shown below.

An example configuration is shown below.

Running Nexus as a Service

It is better to have a init.d entry to manage nexus service using the Linux service command. Follow the steps given below for the setup.

Step 1: Create a symbolic link for nexus service script to /etc/init.d folder.

Step 2: Execute the following commands to add nexus service to boot.

Manage Nexus Service

Now we have all the configurations in place. To start the Nexus service, use the following command.

The above command will start the nexus service on port 8081. To access the nexus dashboard, visit http://:8081. You will be able to see the nexus homepage as shown below.

READ  How To Install and Configure GUI for Amazon EC2 RHEL 7 Instance

nexus 3 homepage

To log in, use the default username and password.

For stopping,

For restarting,

Free DevOps Resources

Get DevOps news, tutorials and resources in your inbox. A perfect way If you want to get started with devops. Like you, we dont like spam.


  1. Daniel Reply

    No inicia, osea inicia pero se cae de inmediato el proceso, se detiene solo

  2. René Grob Reply

    sudo ln -s /app/nexus/bin/nexus /etc/init.d/nexus did not work for me with OSS2.x because the nexus script is calling itself when it is run by a different user than specified in RUN_AS.
    I solved it by defining a proper systemd unit file which is better anyway:

    vi /etc/systemd/system/nexus.service

    Description=Nexus Repository Manager OSS 2.x

    ExecStart=/opt/nexus-2.14.5-02/bin/nexus start
    ExecStop=/opt/nexus-2.14.5-02/bin/nexus stop



  3. Raul C Reply

    It has to be added that access permissions must also be added to the sonatype-work folder.

  4. Yogendra Kumar Dixit Reply

    I have created new EC2 instance RedHat7.5 and install nexus 3 as per above steps. I have successfully installed Nexus but unable to open http://172…..:8081/ url

    Also, I have setup apache on same machine.

    Kindly suggest, what i need to do.

Leave a Reply

Your email address will not be published. Required fields are marked *