Nexus Repository Manager is a popular tool used for managing software components and libraries. It allows you to host and manage your own repository, which can be essential for managing dependencies in software projects. In this guide, we will walk you through the installation of Nexus Repository Manager on Ubuntu 22.04. Whether you are deploying it on a local server or using a Windows VPS UK, this tutorial will provide you with all the necessary steps.
Step 1: Update Your System
Before installing Nexus, ensure that your system is up to date. Run the following commands:
sudo apt update && sudo apt upgrade -y
Keeping your system updated is crucial for security and performance, whether you're setting up Nexus locally or on a VPS Windows Servers platform.
Step 2: Install Java
Nexus Repository Manager requires Java to run. You can install OpenJDK 11 using the following command:
sudo apt install openjdk-11-jdk -y
After installation, verify the Java installation:
java -version
Step 3: Create a Nexus User
For security reasons, it is recommended to run Nexus as a dedicated user. Create a user for Nexus with the following command:
sudo useradd -r -s /bin/false nexus
Step 4: Download Nexus Repository Manager
Navigate to the Nexus Repository Manager downloads page and copy the link to the latest version. Then, use wget to download it:
cd /opt
sudo wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
After downloading, extract the archive:
sudo tar -xvzf latest-unix.tar.gz
Rename the extracted directory for easier access:
sudo mv nexus-3* nexus
Step 5: Configure Nexus Repository Manager
Change the ownership of the Nexus directory to the nexus user:
sudo chown -R nexus:nexus /opt/nexus
Open the Nexus configuration file located at /opt/nexus/nexus-/nexus.conf
to adjust the settings as needed:
sudo nano /opt/nexus/bin/nexus
You can set the run_as_user
to nexus
to ensure it runs under the dedicated user:
run_as_user="nexus"
Step 6: Start Nexus Repository Manager
To start Nexus, switch to the nexus user and run the startup script:
sudo -u nexus /opt/nexus/bin/nexus start
To check the status of Nexus, you can use the following command:
sudo -u nexus /opt/nexus/bin/nexus status
Step 7: Access Nexus Repository Manager
Open your web browser and navigate to http://your-server-ip:8081
. You should see the Nexus Repository Manager interface.
The default admin credentials are:
- Username: admin
- Password: admin123
After logging in, you should change the default password for security.
Step 8: Secure Nexus with Let's Encrypt SSL (Optional)
To secure your Nexus instance, consider setting up SSL using Let's Encrypt. Install Certbot:
sudo apt install certbot -y
Obtain and install the SSL certificate using the following command:
sudo certbot --apache -d your-domain.com
Certbot will automatically configure SSL for your Nexus Repository Manager, ensuring secure access to the application, whether it is hosted locally or on a Windows VPS hosting UK.