This repo demos the installation of Nexus on the Ubuntu server and accessing Nexus UI from a Web browser
-
Spin up an EC2 instance on AWS, allow TCP connections on port 22 in the inbound rule for the security group attached to this instance, and allow TCP connection on port 8081 to access Nexus service
-
Remote server (ec2 instance) requirements:
- 8 GB RAM (4GB will also work)
- 2 vCPU
- RSA key used to launch instance safely downloaded locally
- Ubuntu AMI (Ubuntu server 22.0 LTS)
-
once the instance is running connect to the instance either via ec2 instance connect or SSH into the server using rsa key-pair
-
Run the below commands as a prerequisite to installing Nexus:
-
Installing Nexus
- sudo wget https://download.sonatype.com/nexus/3/nexus-3.66.0-02-unix.tar.gz
- sudo chown -R nexus:nexus sonatype-work
- sudo chown -R nexus:nexus nexus-3.66.0-02
- sudo vi nexus.rc
enter the insert mode by pressing ESC+i and uncomment the first line and user as nexus
-
Configuring Nexus service
- sudo vi /etc/systemd/system/nexus.service
- add below script to run nexus as service =============================================================
[Unit] Description=Nexus Repository Manager After=network.target
[Service] Type=forking LimitNOFILE=65536 User=nexus Group=nexus WorkingDirectory=/opt/nexus-3.66.0-02 ExecStart=/opt/nexus-3.66.0-02/bin/nexus start ExecStop=/opt/nexus-3.66.0-02/bin/nexus stop Restart=on-abort
[Install] WantedBy=multi-user.target
=============================================================
link to the script: [Nexus-documentation] (https://help.sonatype.com/en/run-as-a-service.html#:~:text=%5BUnit%5D%0ADescription%3Dnexus%20service%0AAfter%3Dnetwork.target%0A%20%20%0A%5BService%5D%0AType%3Dforking%0ALimitNOFILE%3D65536%0AExecStart%3D/etc/init.d/nexus%20start%0AExecStop%3D/etc/init.d/nexus%20stop%20%0AUser%3Dnexus%0ARestart%3Don%2Dabort%0ATimeoutSec%3D600%0A%20%20%0A%5BInstall%5D%0AWantedBy%3Dmulti%2Duser.target)
-
sudo ln -s /opt/nexus-3.66.0-02/bin/nexus /etc/init.d/nexus
-
su - nexus
-
Running Nexus as nexus user:
- sudo update-rc.d nexus defaults
- sudo systemctl daemon-reload
- sudo systemctl enable nexus.service
- sudo systemctl start nexus.service
- sudo systemctl status nexus
- ps aux | grep nexus
- sudo apt install net-tools
- netstat -lnpt
- we can see the service running on port 8081
- Now in the new tab access the UI by giving :-
- HTTP://public-IPv4-ofserver:8081