Install and Configure Nexus Repository Server on Linux

Nexus Repository OSS is an open source repository that supports many artifact formats, including Docker, Java™, and npm. To Install Nexus on Linux follow this document.

Step1: Before starting, Login to your Linux server and update it. Also install required utilities and JDK

sudo yum update -y
sudo yum install wget -y
sudo yum install java-1.8.0-openjdk.x86_64 -y

Step2: Now download the latest nexus. You can get the latest download links for nexus from here.
https://help.sonatype.com/repomanager3/download

sudo wget -O nexus.tar.gz https://download.sonatype.com/nexus/3/latest-unix.tar.gz

Step3: Unzip the Artifact-Repository-Nexus-VA.B.C.D.E archive file in a dedicated folder.

sudo tar -xvf nexus-3.16.0-01-unix.tar.gz
sudo rm nexus-3.16.0-01-unix.tar.gz
sudo mv nexus-3.16.0-01 nexus

Step4: Create nexus user and add the execution rights to the relevant files using the chmod 755 command.

sudo adduser nexus
sudo chown -R nexus:nexus /opt/nexus
sudo chmod -R 755 /opt/nexus

Step5: Open /app/nexus/bin/nexus.rc file and uncomment run_as_user parameter and set it as following. You might also need to allow port 8081 in firewall before it work.

sudo vi /opt/nexus/bin/nexus.rc
run_as_user="nexus"

sudo firewall-cmd --permanent --add-port=8081/tcp
sudo firewall-cmd --reload

Step6: From the <ApplicationFolder>/bin folder, launch the Nexus instance using the command ./nexus run.
OR
Running Nexus as a System Service

sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus
sudo chkconfig --add nexus
sudo chkconfig --levels 345 nexus on
sudo service nexus start

Step7: The above command will start the nexus service on port 8081. To access the nexus dashboard, visit http://<public_ip>:8081. You will be able to see the nexus homepage



To login Default username is admin. You can find the default admin password in /app/sonatype-work/nexus3/admin.password file.

Step8: After the first connection, it is strongly recommended to change the default credentials of the default administrator account.

Change the default credentials of the admin user:

a) In the left panel of the Talend Artifact Repository Web application, select Security > Users.
b) Right-click the admin user and select Set Password.
c) Enter a new password for the admin user.

Below command will stop the nexus service, similarly if you face any issue you can also restart it.

sudo service nexus stop/restart

Configuring Nexus

1. Open the Nexus Repository Manager.

2. Create the following maven2 (hosted) repositories:
• Releases
• Snapshots
• custom-libs-release
• custom-libs-snapshot
• updates
Make sure you have the relevant rights to access the releases and snapshots repositories.

3. Configure the created repositories.

Example

4. Create the different users in Nexus with corresponding deployment roles

To install and configure Jenkins and Maven server you can refer here.

Post a Comment

Thanks for your comment !
I will review your this and will respond you as soon as possible.