Nexus Installation

  1. Prerequisites
  2. Installation
  3. Network configuration


  1. EC2 Instance (over t2.medium)
    • With Internet Access
    • Security Group with Port 8081 open for internet
    • System requirement
      • CPU: Nexus Repository Manager performance is primarily bounded by IO (disk and network) rather than CPU.  So any reasonably modern 2-4 core CPU will generally be sufficient for normal use.
      • Memory: The default JRE max heap size of Nexus Professional is 768Mb, and the codebase of Nexus Repository Manager will consume approximately another 1GB.  So factoring in operating system overhead you will need at least 4GB of RAM, assuming no other large applications are running on the machine.


Download & Setup Stable version of Nexus

Move to the folder for installing the Nexus

$ cd /opt

Change the folder name and install

$ sudo yum update -y
$ sudo yum install wget -y
$ sudo wget sudo wget -O nexus.tar.gz
$ sudo tar -xvf nexus.tar.gz
$ sudo mv /opt/nexus-3* /opt/nexus

To execute nexus, you need Java

## Install openjdk 1.8
$ sudo yum install java-1.8.0-openjdk.x86_64 -y

For security reason, root user is not recommanded nexus-service. Add a Nexus user.

$ sudo su -
$ useradd nexus
$ passwd nexus
Changing password for user nexusadmin
New password:
Retype new password: 
passwd: all authentication tokens updated successfully.
$ sudo chown -R nexus:nexus /opt/nexus
$ sudo chown -R nexus:nexus /opt/sonatype-work

Grant sudo Access to nexus user

$ visudo

## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d

Add run as user

$ vi /opt/nexus/bin/nexus.rc
run_as_user="nexus" (file shold have only this line)

Add nexus as a service at boot time

$ sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus


This example is a script that uses systemd to run the repository manager service. Create a file called nexus.service. Add the following contents, then save the file in the  /etc/systemd/system/ directory:

$ vi /etc/systemd/system/nexus.service
Description=nexus service
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop

Activate the service with the following commands:

$ su - nexus
$ sudo systemctl daemon-reload
$ sudo systemctl enable nexus.service
$ sudo systemctl start nexus.service
$ sudo systemctl status nexus.service
● nexus.service - nexus service
   Loaded: loaded (/etc/systemd/system/nexus.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2020-09-21 08:17:59 UTC; 5s ago
  Process: 3938 ExecStart=/opt/nexus/bin/nexus start (code=exited, status=0/SUCCESS)
 Main PID: 4137 (java)
   CGroup: /system.slice/nexus.service
           └─4137 /usr/lib/jvm/java-1.8.0-openjdk-


$ sudo service nexus start

Login nexus server from browser on port 8081

$ cat /opt/sonatype-work/nexus3/admin.password

Network Configuration

By default, the repository manager listens on port 8081. You can change this port, by changing the value in the $NEXUS_HOME/conf/ file shown in Contents of conf/ . To change the port, stop the repository manager, change the value of application-port in this file, and then restart it. Once you do this, you should see a log statement in $NEXUS_HOME/logs/wrapper.log telling you that the repository manager is listening on the altered port.

# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus.

# Jetty section
# Nexus section

Leave a Reply

Your email address will not be published.