SonaType Nexus3 is one of the popular binary repository managers, used for storing build artifacts such as Jars,WARs, EARs. It is Java based web application.
Pre-requistes
Please create a new Ubuntu 18.0.4 EC2 instance with small type in AWS cloud. You would need at least 2 GB RAM.
Let us see how to configure Nexus 3 on Ubuntu 18.0.4.
How to setup SonaType Nexus3 on Ubuntu:
Java 8 installation
sudo apt update && sudo apt install openjdk-8-jre-headless -y
Note: Nexus is not compatible with Java 11 in Ubuntu 18.0.4. So we need to install Java 8.
java -version
Execute the below commands - navigate to /opt directory by changing directory:
cd /opt
Download Nexus
sudo wget https://download.sonatype.com/nexus/3/nexus-3.22.0-02-unix.tar.gz
Extract Nexus files
sudo tar -xvf nexus-3.22.0-02-unix.tar.gz
sudo mv nexus-3.22.0-02 nexus
Create a user called Nexus
sudo adduser nexus
cat /opt/sonatype-work/nexus3/admin.password
Now change admin password as admin123
Click Finish.
Pre-requistes
Please create a new Ubuntu 18.0.4 EC2 instance with small type in AWS cloud. You would need at least 2 GB RAM.
Let us see how to configure Nexus 3 on Ubuntu 18.0.4.
How to setup SonaType Nexus3 on Ubuntu:
Java 8 installation
sudo apt update && sudo apt install openjdk-8-jre-headless -y
Note: Nexus is not compatible with Java 11 in Ubuntu 18.0.4. So we need to install Java 8.
java -version
Execute the below commands - navigate to /opt directory by changing directory:
cd /opt
Download Nexus
sudo wget https://download.sonatype.com/nexus/3/nexus-3.22.0-02-unix.tar.gz
Extract Nexus files
sudo tar -xvf nexus-3.22.0-02-unix.tar.gz
sudo mv nexus-3.22.0-02 nexus
Create a user called Nexus
sudo adduser nexus
Keep entering enter for all other values and press y to confirm the entries.
Give permission to Nexus user
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work
sudo vi /opt/nexus/bin/nexus.rc
Give permission to Nexus user
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work
sudo vi /opt/nexus/bin/nexus.rc
Add all the below changes the file with below yellow highlighted entry:
-Xms512M
-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
-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
Now Start Nexus
sudo systemctl enable nexus
sudo systemctl start nexus
sudo systemctl status nexus
if it says stopped, review the steps above and you can troubleshoot by looking into Nexus logs by executing below command:
tail -f /opt/sonatype-work/nexus3/log/nexus.log
Press control C to come out of the above window.
It should say Started Sonatype Nexus OSS 3.22.0-02. If you Nexus stopped, review the steps above.
It should say Started Sonatype Nexus OSS 3.22.0-02. If you Nexus stopped, review the steps above.
Once Nexus is successfully installed, you can access it in the browser by
Now change admin password as admin123
enable anonymous access
Sign in with user name/password is admin/admin123
you should see the home page of Nexus.
Please follow steps for integrating Nexus with Jenkins
Please follow steps for integrating Nexus with Jenkins
Coach, the Nexus stops because Nexus was not configured to run as a service. Should include:
ReplyDeleteConfigure 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
yes, we should. Let me add that in here, thanks for letting me know.
DeleteThanks it works
ReplyDelete