Redhat7 install sonartype nexus

This article will show you how to install nexus on redhat 7


  • JDK 1.8 (this article will use open jdk

Install JDK

# Install JDK 1.8
sudo yum install java-1.8.0-openjdk

# Verify installed java 
java -version
# Example output
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (build 1.8.0_322-b06)
OpenJDK 64-Bit Server VM (build 25.322-b06, mixed mode)

Download & install sonartype nexus

# Choose a folder to install nexus eg. /usr/share/applications
cd /usr/share/applications
# Download latest nexus package from official site:
sudo wget -O nexus.tar.gz
# Unpackage gz file
sudo tar -xvf nexus.tar.gz
# Rename nexus 3 folder to nexus
sudo mv nexus-3* nexus
# Create user to run sonartype nexus
sudo adduser nexus
# Change nexus, sonartype-work folder ownership to nexus
sudo chown -R nexus:nexus nexus
sudo chown -R nexus:nexus sonatype-work

Configure and run nexus as a linux service

# Open /nexus/bin/nexus.rc file, update configuration
sudo vi nexus/bin/nexus.rc
# Update to below configuration

# Create a system service file for nexus
sudo vi /etc/systemd/system/nexus.service
# Add below change
Description=nexus service

ExecStart=/usr/share/applications/nexus/bin/nexus start
ExecStop=/usr/share/applications/nexus/bin/nexus stop


# Reload system deamon 
sudo systemctl daemon-reload

# Start nexus 
sudo systemctl start nexus

# Verify nexus status
sudo systemctl status nexus.service

# Enable nexus service on machine start
sudo systemctl enable nexus.service    

# Update firewall configuration
sudo firewall-cmd --permanent --add-port=8081/tcp                               

# Reload firewall
sudo firewall-cmd --reload

Go to your server:8081 to access nexus, follow instructions to setup admin user password, now you can start using nexus.

Leave a Comment