firest update repository :
debian : (# sudo apt-get update)
redhat : (# sudo yum update)
sudo apt install openjdk-8-jre-headless
sudo yum install java-1.8.0-openjdk-headless
cd /opt
sudo wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
sudo tar -zxvf latest-unix.tar.gz
rename folder :
sudo mv nexus-3.x.x.x/ /opt/nexus
add user with nexus name and set sudo access to it an NOPASSWD :
sudo adduser nexus
sudo vi /etc/sudoers
under root part : (User prilvilage spcification or Allow root to run any commands anywhere ) add this part :
nexus ALL=(ALL)NOPASSWD:ALL (save and exit )
give access to folders and file :
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work
open /opt/nexus/bin/nexus.rc file T uncomment it and nexus user as shown below :
sudo vi /opt/nexus/bin/nexus.rc
change as below :
run_as_user="nexus"
sudo /opt/nexus/bin/nexus.vmoptions
-xms 2703 --> 1024
sudo vi /etc/systemd/system/nexus.service
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort
TimeoutSec=600
[Install]
WantedBy=multi-user.target
sudo systemctl start nexus
sudo systemctl status nexus
sudo systemctl enable nexus
(ufw) sudo ufw allow 8081/tcp
(firewalld) sudo firewall-cmd --add-port=8081/tcp
cat /opt/sonatype-work/nexus3/admin.password
(user will be admin and password will show in admin.password)