How To Install Nexus3 on Ubuntu20.04

sudo apt install openjdk-8-jdk
sudo mkdir /app && cd /app
sudo wget -O nexus.tar.gz https://download.sonatype.com/nexus/3/latest-unix.tar.gz
sudo tar -xvf nexus.tar.gz
sudo mv nexus-3* nexus
sudo adduser nexus
sudo chown -R nexus:nexus /app/nexus
sudo chown -R nexus:nexus /app/sonatype-work
sudo vi  /app/nexus/bin/nexus.rc
Uncomment run_as_user parameter and set it as following:
run_as_user="nexus"

check the default configuration in /app/nexus/bin/nexus.vmoptions

sudo vi /etc/systemd/system/nexus.service
Add the following contents to the unit file.

[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
User=nexus
Group=nexus
ExecStart=/app/nexus/bin/nexus start
ExecStop=/app/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target

sudo systemctl start nexus
(sudo systemctl stop nexus)
verify nexus process and port started without any issue:
ps -ef|grep nexus
netstat -an|grep 8081
open nexus http://localhost:8081 with admin and password from /app/sonatype-work/nexus3/admin.password
you can create raw or maven type repositories, for raw type repository, you can upload/download with command:
curl -v -u admin:pas8word --upload-file license.txt http://192.168.0.43:8081/repository/its/
wget http://192.168.0.43:8081/repository/its/az104-11-vm-parameters.json --user=admin --password=pas8word
wget http://192.168.0.43:8081/repository/amcb/amcb/1/1/1-1.json --user=admin --password=pas8word

Leave a Reply

Your email address will not be published. Required fields are marked *