Here are the steps for installing Sonatype Nexus 3 in RHEL in EC2 on AWS. Please create a new Redhat EC2 instance with small type. Choose Redhat Enterprise 8.
Make sure you open port 8081 in AWS security group
Installation Steps:
you can confirm java is installed by typing the below command:
java -version
Execute the below command to navigate to /opt directory by changing directory:
cd /opt
Download Nexus Latest version
Extract Nexus
sudo tar -xvf nexus3.tar.gz
sudo mv nexus-3* nexus
Create a user called Nexus
sudo adduser nexus
Change the ownership of nexus files and nexus data directory to nexus user.
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work
Add Nexus as a user
Modify memory settings in Nexus configuration file
sudo vi /opt/nexus/bin/nexus.vmoptions
Modify the above file as shown in below:
-Xmx512m
-XX:MaxDirectMemorySize=512m
Configure Nexus to run as a service
sudo vi /etc/systemd/system/nexus.service
Copy the below content highlighted in green color.
[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
sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus
Execute the following command to add nexus service to boot.
sudo chkconfig --add nexus
sudo chkconfig --levels 345 nexus on
Start Nexus
sudo service nexus start
Check whether Nexus service is running
sudo service nexus status
Check the logs to see if Nexus is running
tail -f /opt/sonatype-work/nexus3/log/nexus.log
Click on Sign in link
sudo cat /opt/sonatype-work/nexus3/admin.password
Copy the password and click sign in.
Now setup admin password as admin123








hi.. this was useful.. i followed the same steps mentioned above.. Except the version of nexus as the one mentioned is unavailable.. the nexus simply wont start.. there is no log too to verify.. i am trying to get the nexus repo for a POC work i am doing.. Please help
ReplyDeletetail -f /opt/sonatype-work/nexus3/log/nexus.log
DeleteThis is how you check the logs
Hi, I have updated the version lately..Please try again now..
ReplyDeletenexus is going to stop after 10 secs
Deletewhat should be the target groups for the LB application
ReplyDeleteI did the all steps and stack on:
ReplyDeletesudo chkconfig --add nexus
error reading information on service nexus: No such file or directory
and: curl localhost:8081
curl: (7) Failed to connect to localhost port 8081: Connection refused
can you help with that thank you
its very helpful. thank you
ReplyDeletefollowed the same steps but service is stopping automatically not able access it.
ReplyDelete