Lecture 03 – a – SONATYPE NEXUS REPOSITORY INSTALLATION
SONATYPE NEXUS REPOSITORY INSTALLATION
PRE-REQUISITES
Launch RedHat Enterprise Instance at least 2 GB RAM and 15gigs of storage.
Ensure to have port# 8081 or ALL TRAFFIC open in AWS security group
Step 01: To switches the user to the superuser (root) with administrative privileges, then navigate to /opt directory and update server.
COPY & RUN –>$ the below commands
sudo su
cd /opt
yum update
To installs the Java Development Kit (JDK) version 1.8.0, along with its corresponding development packages, The “-y” flag automatically answers “yes”
COPY & RUN –>$ the below commands
yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
yum list installed | grep "java"
java -version
Step 02: To installs the wget package. Wget is a utility for retrieving files from the web via HTTP, HTTPS, and FTP protocols.
COPY & RUN –>$ the below command
yum install wget -y
To downloads a Nexus3 file from a specific URL and saves it as “nexus3.tar.gz” , extract and rename it
COPY & RUN –>$ the below commands
wget -O nexus3.tar.gz https://download.sonatype.com/nexus/3/latest-unix.tar.gz
tar -xvf nexus3.tar.gz
mv nexus-3* nexus
Step 03: To creates a new user with the username “nexus” and change the ownership of nexus files and nexus data directory to nexus user.
COPY & RUN –>$ the below commands
adduser nexus
chown -R nexus:nexus /opt/nexus
chown -R nexus:nexus /opt/sonatype-work
Step 04: To opens the file “nexus.rc” using the vi text editor. The file is located in the “/opt/nexus/bin/” directory, uncomment and set to run as user=“nexus”
COPY & RUN –>$ the below command
vi /opt/nexus/bin/nexus.rc
Press esc and enter :wq! OR Shift ZZ to save and exit.
Opens the file “nexus.vmoptions” using the vi text editor and modify memory settings to 512m in Nexus configuration file.
COPY & RUN –>$ the below command
vi /opt/nexus/bin/nexus.vmoptions
Press esc and enter :wq! OR Shift ZZ to save and exit.
Step 05: To configure Nexus as a service, Create a new systemd service file for Nexus and add the following content to the file.
COPY & RUN –>$ the below command
vi /etc/systemd/system/nexus.service
[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
Press esc and enter :wq! OR Shift ZZ to save and exit.
Step 06: Creates a symbolic link between the file “/opt/nexus/bin/nexus” and “/etc/init.d/nexus” to enables the “nexus” script in the “/etc/init.d/” directory,
COPY & RUN –>$ the below commands
ln -s /opt/nexus/bin/nexus /etc/init.d/nexus
Execute the following to add nexus service to boot and start Nexus
COPY & RUN –>$ the below commands
chkconfig --add nexus
chkconfig --levels 345 nexus on
service nexus start
To verify Nexus and displays the last few lines of the “nexus.log” file.
COPY & RUN –>$ the below command
tail -f /opt/sonatype-work/nexus3/log/nexus.log
Press Cntrl C to come out of window
Step 07: To verify the output, go to the browser using Sonatype Nexus server IP:8081, Then you should see Sonatype Nexus welcome UI like the one below.
cat /opt/sonatype-work/nexus3/admin.password
