Project Title:
Deploy Nexus as a Docker Container
Technologies Used:
- Docker: Containerization platform to run Nexus.
 - Nexus Repository Manager: Artifact repository for DevOps.
 - DigitalOcean: Cloud provider to host the droplet.
 - Linux: Operating system for the droplet.
 
Project Description:
- Create and Configure Droplet: Set up a DigitalOcean droplet with Linux to serve as the hosting environment for Nexus.
 - Set Up and Run Nexus: Use Docker to deploy Nexus on the droplet. Ensure Nexus is configured to manage artifacts securely and efficiently.
 
Step-by-Step Implementation:
1. Create and Configure Droplet
- Log in to the DigitalOcean Console.
 - Create a new droplet:
- Choose an image: Ubuntu 22.04 or another Linux distribution.
 - Select a plan: At least 2 GB RAM for Nexus to run smoothly.
 - Add SSH keys for secure access or use a password-based approach.
 - Launch the droplet and note down its public IP.
 
 - Access the droplet using SSH:
 
   ssh root@<your-droplet-ip>
- Update the system:
 
   sudo apt update && sudo apt upgrade -y
2. Install Docker on the Droplet
- Install prerequisites:
 
   sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
- Add Docker's GPG key and repository:
 
   curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
   echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- Install Docker:
 
   sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io
- Verify Docker installation:
 
   docker --version
3. Run Nexus as a Docker Container
- Pull the Nexus Docker image:
 
   docker pull sonatype/nexus3
- Create a directory for persistent data:
 
   mkdir -p /opt/nexus-data
   chmod -R 200 /opt/nexus-data
- Run the Nexus container:
 
   docker run -d -p 8081:8081 --name nexus -v /opt/nexus-data:/nexus-data sonatype/nexus3
- Confirm the container is running:
 
   docker ps
- 
Access Nexus:
- Open a browser and navigate to 
http://<your-droplet-ip>:8081. - Log in with the default credentials:
- Username: 
admin - Password: Retrieved from 
/nexus-data/admin.passwordinside the container: 
 - Username: 
 
docker exec nexus cat /nexus-data/admin.password - Open a browser and navigate to 
 
Post-Deployment Steps:
- 
Secure Nexus:
- Update the admin password.
 - Configure HTTPS using a reverse proxy (e.g., Nginx).
 
 - 
Enable Nexus Features:
- Set up repositories for Maven, npm, or Docker images.
 
 
Click here for repo - https://gitlab.com/574n13y/devops4-deploy-nexus-as-docker-container
Happy Learning !!!
    
Top comments (0)