Installing SonarType Nexus 3

Aman Pasi
3 min readSep 29, 2020

--

Java
$ sudo apt-get update
$ sudo apt-get install default-jdk -y

Execute the below commands — navigate to /opt directory by changing directory:
$ cd /opt

Download Nexus
$ sudo wget http://download.sonatype.com/nexus/3/nexus-3.22.0-02-unix.tar.gz

Extract Nexus
$ sudo tar -xvf nexus-3.22.0–02-unix.tar.gz
$ sudo mv nexus-3.22.0–02 nexus

Create a user called Nexus
sudo adduser nexus

give some password may be as admin, but do remember.

Keep entering enter for all other values and press y to confirm the entries.

Give permission to Nexus user
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work

sudo vi /opt/nexus/bin/nexus.rc

change run_as_user=”nexus”

Modify memory settings
sudo vi /opt/nexus/bin/nexus.vmoptions

Add all the below changes the file with below yellow highlighted entry:

Configure Nexus to run as a service
sudo vi /etc/systemd/system/nexus.service
Copy the below content
— — — — — — — — — — — — — — — — — — — — — — — — — —
[Unit]
Description=nexus service
After=network.target

[Service]
Type=forking
LimitNOFILE=65536
User=nexus
Group=nexus
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
— — — — — — — — — — — — — — — — — — — — — — — — — —

Now Start Nexus
$ sudo systemctl enable nexus
$ sudo systemctl start nexus
$ sudo systemctl status nexus

If it says stopped, review the steps above and you can troubleshoot by looking into Nexus logs by executing below command:

$ tail -f /opt/sonatype-work/nexus3/log/nexus.log

It should say Nexus is running..If you Nexus stopped, review the steps above.
Press control C to come out of the above window.

Once Nexus is successfully installed, you can access it in the browser by
URL — http://public_dns_name:8081 OR http://localhost:8081

Now click on Sign in, enter admin as user name and password by executing below cat command.

cat /opt/sonatype-work/nexus3/admin.password
Now change admin password as AXXX@YY3

Now click next, do not check Enable anonymous access.

Click Finish.

Now login with user name/password is admin/AXXX@YY3

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Aman Pasi
Aman Pasi

No responses yet

Write a response