My installation guides and bash scripts for essential DevOps tools like Jenkins (CI/CD), Nexus (artifact repository), SonarQube (code analysis), Docker (containerization), Trivy (vulnerability scanning), etc... on Ubuntu Based Server like EC2, Droplet, Linode.
To install tools on your Ubuntu server, navigate to your server environment. Copy and paste the following command into your terminal. These commands will automatically download the installation script, grant it execution permissions, and initiate the installation process.
For Jenkins:
wget https://raw.githubusercontent.com/akiltipu/devops-tools-installation-manuals/main/install_jenkins_on_ubuntu.sh
chmod +x install_jenkins_on_ubuntu.sh
./install_jenkins_on_ubuntu.sh
For Nexus:
wget https://raw.githubusercontent.com/akiltipu/devops-tools-installation-manuals/main/install_nexus_on_ubuntu.sh
chmod +x install_nexus_on_ubuntu.sh
./install_nexus_on_ubuntu.sh
For SonarQube:
wget https://raw.githubusercontent.com/akiltipu/devops-tools-installation-manuals/main/install_SonarQube_on_ubuntu.sh
chmod +x install_SonarQube_on_ubuntu.sh
./install_SonarQube_on_ubuntu.sh
For Docker and Docker Compose:
wget https://raw.githubusercontent.com/akiltipu/devops-tools-installation-manuals/main/install_docker_dockercompose.sh
chmod +x install_docker_dockercompose.sh
./install_docker_dockercompose.sh
For Terraform:
wget https://raw.githubusercontent.com/akiltipu/devops-tools-installation-manuals/main/install_terraform_ubuntu.sh
chmod +x install_terraform_ubuntu.sh
./install_terraform_ubuntu.sh
To access a comprehensive installation guide with detailed instructions, please expand the dropdown below
Install Jenkins on Ubuntu Server
Update the package list
sudo apt update
Add Jenkins repository key
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
Then add a Jenkins apt repository entry:
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
Update the package list
sudo apt update
Install Java (Jenkins requires Java)
sudo apt-get install fontconfig openjdk-17-jre -y
Add Jenkins repository to sources list
echo "deb http://pkg.jenkins.io/debian-stable binary/" | sudo tee -a /etc/apt/sources.list.d/jenkins.list
Update package list again to include Jenkins repository
sudo apt update
Install Jenkins
sudo apt install -y jenkins
Start Jenkins service
sudo systemctl start jenkins
Enable Jenkins to start on boot
sudo systemctl enable jenkins
Display initial Jenkins admin password
echo "Waiting for Jenkins to start..."
sleep 60 # Wait for Jenkins to fully start (adjust if needed)
Retrieve the initial admin password
JENKINS_PASSWORD=$(sudo cat /var/lib/jenkins/secrets/initialAdminPassword)
echo "Jenkins initial admin password: $JENKINS_PASSWORD"
echo "Access Jenkins at http://your-server-ip:8080"
Open the firewall to allow access to Jenkins
sudo ufw allow 8080
Display Jenkins status
sudo systemctl status jenkins | cat
Install Nexus Artifact Repository on Ubuntu Server
Create Ubuntu Server (Droplet) - min 4GB RAM & 2 CPUs Open SSH port 22, 8081
Update the package list:
sudo apt update
Install OpenJDK 8:
sudo apt install openjdk-8-jre-headless
Install net-tools:
sudo apt install net-tools
Navigate to the /opt
directory:
cd /opt
Download and extract Nexus:
sudo wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
sudo tar -zxvf latest-unix.tar.gz
Create a Nexus user:
sudo adduser nexus
Set ownership for Nexus directories:
sudo chown -R nexus:nexus nexus-3.28.1-01
sudo chown -R nexus:nexus sonatype-work
Edit Nexus runtime configuration:
sudo vim nexus-3.28.1-01/bin/nexus.rc
Inside nexus.rc
, set the run_as_user
variable to "nexus".
run_as_user="nexus"
Save and exit the editor.
Switch to the Nexus user:
sudo su - nexus
Start Nexus:
/opt/nexus-3.28.1-01/bin/nexus start
Check Nexus process status:
ps aux | grep nexus
Check Nexus port status:
netstat -lnpt
Now, Nexus should be up and running on your Ubuntu system. You can access the Nexus web interface by navigating to http://your_server_ip:8081
in a web browser.
Install SonarQube on Ubuntu Server
Pull SonarQube Image:
docker pull sonarqube
Create Docker Network:
docker network create sonar-network
Run PostgreSQL Database Container:
docker run -d --name sonar-db --network sonar-network \
-e POSTGRES_USER=sonar \
-e POSTGRES_PASSWORD=sonar \
-e POSTGRES_DB=sonar \
postgres:9.6
-d
: Detached mode, run container in the background.--name sonar-db
: Assign a name to the container.--network sonar-network
: Connect container to the created network.-e POSTGRES_USER=sonar
: Set PostgreSQL username to 'sonar'.-e POSTGRES_PASSWORD=sonar
: Set PostgreSQL password to 'sonar'.-e POSTGRES_DB=sonar
: Create a database named 'sonar' in PostgreSQL.
Run SonarQube Container:
docker run -d --name sonar -p 9000:9000 --network sonar-network \
-e SONARQUBE_JDBC_URL=jdbc:postgresql://sonar-db:5432/sonar \
-e SONAR_JDBC_USERNAME=sonar \
-e SONAR_JDBC_PASSWORD=sonar \
sonarqube
-d
: Detached mode, run container in the background.--name sonar
: Assign a name to the SonarQube container.-p 9000:9000
: Map container's port 9000 to host's port 9000.--network sonar-network
: Connect container to the created network.-e SONARQUBE_JDBC_URL=jdbc:postgresql://sonar-db:5432/sonar
: Set JDBC URL to connect SonarQube to the PostgreSQL database.-e SONAR_JDBC_USERNAME=sonar
: Set SonarQube's database username.-e SONAR_JDBC_PASSWORD=sonar
: Set SonarQube's database password.
Access SonarQube:
After running the container, you can access SonarQube by navigating to http://localhost:9000
in your web browser. The default credentials are:
- Username: admin
- Password: admin
This setup will allow you to use SonarQube for static code analysis on your projects with the PostgreSQL database backend.