How to install Nexus 3 on Linux | Nexus 3 Installation on EC2 Redhat | Setup Nexus 3 on EC2 Redhat
#redhat #aws #ec2 #nexus #sonatype #linux
Pre-requisites:
Make sure you open port 8081 in AWS security group
firewall-cmd --zone=public --add-port=8081/tcp --permanent
firewall-cmd --reload
iptables-save | grep 8081
lsof -i -P |grep http
netstat -na |grep 8081
Installation Steps:
sudo yum install wget -y
Download Java 8
sudo yum install java-1.8.0-openjdk.x86_64 -y
now go to opt directory
cd /opt
Download Nexus Latest version
sudo wget -O nexus3.tar.gz https://download.sonatype.com/nexus/3...
Extract Nexus
sudo tar -xvf nexus3.tar.gz
sudo mv nexus-3* nexus
Create a user called Nexus
sudo adduser nexus
Change the ownership of nexus files and nexus data directory to nexus user.
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work
Add Nexus as a user
sudo vi /opt/nexus/bin/nexus.rc
removing # and adding nexus
Modify memory settings in Nexus configuration file
sudo vi /opt/nexus/bin/nexus.vmoptions
-Xms512m
-Xmx512m
-XX:MaxDirectMemorySize=512m
after making changes, press wq! to come out of the file.
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
Create a link to Nexus
sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus
Execute the following command to add nexus service to boot.
sudo chkconfig --add nexus
sudo chkconfig --levels 345 nexus on
Start Nexus
sudo service nexus start
Check whether Nexus service is running
sudo service nexus status
Check the logs to see if Nexus is running
tail -f /opt/sonatype-work/nexus3/log/nexus.log
user name is admin and password can be found by executing below command:
sudo cat /opt/sonatype-work/nexus3/admin.password