sudo apt-get update
sudo apt install openjdk-8-jdk
sudo su
wget https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.24.0-02-unix.tar.gz
tar -zxvf nexus-3.24.0-02-unix.tar.gz
mv /opt/nexus-3.24.0-02 /opt/nexus
sudo adduser nexus
visudo
###add nexus ALL=(ALL) NOPASSWD: ALL
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work
vi /opt/nexus/bin/nexus.rc
run_as_user="nexus"
sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus
/etc/init.d/nexus start
netstat -nlpt
it should show like below
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:36665 0.0.0.0:* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
http://nexuxserver url:8081 (default 8081). Make sure you have 8081 port in your security group (for AWS) / network rule (for Azure) / ingress rule ( for GCP)
Use below credentials to login
username : admin
get initial password from path /opt/sonatype-work/nexus3/admin.password
run cat /opt/sonatype-work/nexus3/admin.password in your nexus server.
wget --user= --password= <nexus artifact url (war/ear)>
wget --user=admin --password=admin http://35.184.138.42:8081/repository/maven-snapshots/awstechguide/spring-webapp/1.0.0-SNAPSHOT/spring-webapp-1.0.0-20200703.145607-1.WAR