#
Nexus repository installation on Linux
This tutorial explains to you how to install Nexus repository on Linux (CentOS 9).
First, we need to create the directory which will keep nexus software:
mkdir -p /u01/nexus
Download the Nexus repository software from
sonatype.com
or by using the wget
command (from the directory in which we want to keep the software):
cd /u01/nexus
wget https://download.sonatype.com/nexus/3/nexus-3.45.1-01-unix.tar.gz
Unpack the archive and remove the archive:
tar xzf nexus-3.45.1-01-unix.tar.gz
rm nexus-3.45.1-01-unix.tar.gz
Now, we have 2 directories: nexus-3.45.1-01
and sonatype-work
. The binaries are in nexus-3.45.1-01
.
The binaries are in the /u01/nexus/nexus-3.45.1-01/bin
:
pwd
/u01/nexus/nexus-3.45.1-01/bin
ls
contrib nexus nexus.rc nexus.vmoptions
Info
We can set the system environment $NEXUS_HOME=/u01/nexus/nexus-3.45.1-01
and add $NEXUS_HOME/bin
in $PATH system environment.
At this point Nexus repository is installed, and we can start it using the following command:
We need to have Java8 installed on the machine in order to start Nexus.
Java 8 could be installed using yum install java-1.8.0-openjdk-devel
command.
If you don't know where JAVA_HOME is you can run the following command:
echo "JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which javac)))))"
INSTALL4J_JAVA_HOME must be defined as well.
export INSTALL4J_JAVA_HOME=$JAVA_HOME
In my case I have :
export INSTALL4J_JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.362.b01-0.3.ea.el9.x86_64
You can start Nexus using the following command:
cd /u01/nexus/nexus-3.45.1-01/bin
nexus run
and you will see something like this:
2023-01-21 10:46:33,858-0500 INFO [jetty-main-1] *SYSTEM org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.w.WebAppContext@6c6c1e2b{Sonatype Nexus,/,file:///u01/nexus/nexus-3.45.1-01/public/,AVAILABLE}
2023-01-21 10:46:33,911-0500 INFO [jetty-main-1] *SYSTEM org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@c8dec4e{HTTP/1.1, (http/1.1)}{0.0.0.0:8081}
2023-01-21 10:46:33,913-0500 INFO [jetty-main-1] *SYSTEM org.eclipse.jetty.server.Server - Started @131225ms
2023-01-21 10:46:33,914-0500 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer -
-------------------------------------------------
Started Sonatype Nexus OSS 3.45.1-01
-------------------------------------------------
If the port Nexus uses ("8081" by default) is protected, you can open the fort:
firewall-cmd --zone=public --add-port=8081/tcp --permanent
firewall-cmd --reload
Now Nexus is started on your Linux Machine.