Installing Nexus Repository Manager on RHEL/CentOS
This guide provides comprehensive instructions for installing Sonatype Nexus Repository Manager 3 on Red Hat Enterprise Linux (RHEL) and CentOS systems.
About Nexus Repository Manager
Nexus Repository Manager is a universal repository that supports all popular package managers and formats. It serves as a central hub for managing software components and dependencies across your development workflow.
Prerequisites
Before starting the installation, ensure your system meets the following requirements:
- Operating System: RHEL 7/8/9 or CentOS 7/8/9
- Java: OpenJDK 8 or 11 (Java 8 minimum required)
- Memory: Minimum 4GB RAM (8GB+ recommended for production)
- Disk Space: Minimum 10GB (varies based on repository usage)
- Network: Internet access for downloading packages
- User Privileges: Root or sudo access
Version Compatibility
This guide focuses on Nexus Repository Manager 3.x (current version 3.85.0 as of October 2025). Nexus 2.x has reached end-of-life and is no longer recommended for new installations.
Installation Steps
Step 1: Update System and Install Dependencies
Update your system packages and install essential tools:
Verify Java installation:
Java Version Management
If you have multiple Java versions installed, use alternatives --config java to select the appropriate version.
Step 2: Create Nexus User
Create a dedicated system user for running Nexus:
Security Best Practice
Running Nexus with a dedicated non-root user enhances security by limiting potential attack vectors.
Step 3: Download Nexus Repository Manager
Navigate to the installation directory and download the latest version:
Extract the downloaded archive:
The extraction creates two directories: - nexus-<version>/ - Contains the Nexus application - sonatype-work/ - Contains data and configuration files
Step 4: Create Symbolic Link
Create a symbolic link for easier version management:
Step 5: Set Ownership and Permissions
Change ownership to the nexus user:
Step 6: Configure Nexus Environment
Edit the Nexus configuration file:
Uncomment and set the run-as user:
Configuration Location
The main configuration file is located at /opt/sonatype-work/nexus3/etc/nexus.properties for advanced settings.
Step 7: Configure JVM Settings (Optional)
For production environments, adjust JVM settings in /opt/nexus/bin/nexus.vmoptions:
Example production settings:
-Xms2g
-Xmx2g
-XX:MaxDirectMemorySize=3g
-XX:+UnlockExperimentalVMOptions
-XX:+UseCGroupMemoryLimitForHeap
-Djava.util.prefs.userRoot=${NEXUS_DATA}/javaprefs
Memory Configuration
Ensure your system has sufficient memory. The example above requires at least 8GB RAM total.
Step 8: Create Systemd Service
Create a systemd service file for automatic startup:
Add the following configuration:
[Unit]
Description=Nexus Repository Manager
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
TimeoutSec=600
[Install]
WantedBy=multi-user.target
Step 9: Enable and Start Nexus Service
Enable and start the Nexus service:
Check service status:
Startup Time
Nexus can take 2-5 minutes to fully start, especially on first launch. Monitor the logs during startup.
Step 10: Configure Firewall
Open the required port (8081 by default):
Step 11: Access Nexus Web Interface
Open your web browser and navigate to:
First Login
For the initial login, use: - Username: admin - Password: Found in /opt/sonatype-work/nexus3/admin.password
Post-Installation Configuration
Retrieve Initial Admin Password
Setup Wizard
After first login, Nexus will guide you through:
- Change admin password
- Configure anonymous access
- Setup repositories
Security Configuration
Always change the default admin password and configure appropriate user permissions for production use.
Service Management
Common service management commands:
# Start Nexus
sudo systemctl start nexus
# Stop Nexus
sudo systemctl stop nexus
# Restart Nexus
sudo systemctl restart nexus
# View service status
sudo systemctl status nexus
# View logs
sudo journalctl -u nexus -f
Troubleshooting
Common Issues
Service won't start:
- Check Java installation:
java -version - Verify file ownership:
ls -la /opt/nexus* - Review logs:
sudo journalctl -u nexus -n 50
Web interface not accessible:
- Confirm service is running:
sudo systemctl status nexus - Check firewall settings
- Verify port binding:
sudo netstat -tlnp | grep 8081
Performance issues:
- Review JVM settings in
nexus.vmoptions - Monitor system resources:
htoportop - Check disk space:
df -h
Log Locations
- Service logs:
journalctl -u nexus - Application logs:
/opt/sonatype-work/nexus3/log/ - Configuration:
/opt/sonatype-work/nexus3/etc/
Upgrading Nexus
To upgrade to a newer version:
-
Backup data:
-
Download new version:
-
Update symbolic link:
-
Start service:
Backup First
Always backup your Nexus data directory before performing upgrades.
Security Considerations
Basic Hardening
- Change default ports if needed
- Enable HTTPS for production environments
- Configure proper user roles and permissions
- Regular security updates
- Monitor access logs
SSL/TLS Configuration
For production deployments, configure HTTPS by:
- Obtaining SSL certificates
- Configuring reverse proxy (Apache/Nginx)
- Updating firewall rules
- Redirecting HTTP to HTTPS
Repository Configuration
After installation, configure repositories for your specific needs:
- Proxy repositories - Mirror external repositories
- Hosted repositories - Store your artifacts
- Group repositories - Combine multiple repositories
Performance Tuning
System-Level Optimizations
# Increase file descriptor limits
echo "nexus soft nofile 65536" >> /etc/security/limits.conf
echo "nexus hard nofile 65536" >> /etc/security/limits.conf
# Configure kernel parameters
echo "vm.max_map_count=262144" >> /etc/sysctl.conf
sysctl -p
Database Configuration
For high-load environments, consider: - Migrating from H2 to PostgreSQL - Configuring database connection pooling - Regular database maintenance
Conclusion
You now have a fully functional Nexus Repository Manager installation on RHEL/CentOS. The service will automatically start on system boot and provide a centralized repository for your development artifacts.
For advanced configuration and repository-specific setup, refer to the official Sonatype Nexus Documentation.