Sonatype Nexus Server
Introduction
This describes on how to install a Sonatype Nexus server within an LXC-container.
Installation
Create an LXC-container
Presuming LXC is already installed.
Create a container type from a selection out of the list which is downloaded.
For this exampledebian, bookworm, amd64 is selected.
Start the container.
Make the LXC-container run at the start by changing or adding the following to
the file /var/lib/lxc/nexus3/config.
# Enable auto start of this container.
lxc.start.auto = 1
# Delay start this container 30 seconds from when the host starts.
lxc.start.delay = 30
To get hold of the containersβ console (root), execute the following.
Container Configuration
Install the needed packages for easy use of command line (bash-completion) and an editor (joe) or any other.
Modifying the .bashrc for autocompletion.
Create a System User & Group
The Nexus service is running under user nexus and a system user named nexus and
with its primary group are created.
Download & Install
Install required java version 17 runtime engine first.
Download the latest application using this download page to get a download link.
As of the date of writing the URL and command are as follows.
mkdir download && cd download
wget "https://download.sonatype.com/nexus/3/nexus-3.76.1-01-unix.tar.gz"
Install by unpacking the downloaded nexus-3.xx.x-xx.tar.gz file into the /opt directory.
Create the directory when it does not exist yet using mkdir -p /opt.
After this a /opt/nexus-x.x.x-xx directory and the /opt/sonatype-work directory are created.
Create a /opt/nexus symlink to the /opt/nexus-x.x.x-xx directory in order to upgrade more easily
without changing the systemd to run the service.
nexus the owner of the /opt/sonatype-work and its content.
Create a Systemd Service
Create a file /etc/systemd/system/nexus.service containing the following content.
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target
Run the following commands to enable and start this new service.
Check the service status to see if it is running.
Once the server is started it is started it can be accessed on port 8081.
The initial admin password is found in file /opt/sonatype-work/nexus3/admin.password
and is deleted by Nexus when the admin password is changed in the web-application.
Upgrading
Download Application
A help page of Sonatype has a download link of the latest version in different Java version flavors.
Installation
Install the appropriate Java runtime engine needed.
To upgrade to a new version, unpack the downloaded .tar.gz file in a /tmp directory move
only directory /tmp/nexus-3.69.0-02 to /opt/nexus-3.69.0-02.
Stop the Nexus services and update the /opt/nexus symlink to the new version directory.
Finally start the service again.
The application wil take some time to update the content database.
This could be minutes before the web-application responds.
Check if the service is running errorless.