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.shFor 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.shFor 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.shFor 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.shFor 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.shTo access a comprehensive installation guide with detailed instructions, please expand the dropdown below
Install Jenkins on Ubuntu Server
Update the package list
sudo apt updateAdd Jenkins repository key
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.keyThen 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/nullUpdate the package list
sudo apt updateInstall Java (Jenkins requires Java)
sudo apt-get install fontconfig openjdk-17-jre -yAdd Jenkins repository to sources list
echo "deb http://pkg.jenkins.io/debian-stable binary/" | sudo tee -a /etc/apt/sources.list.d/jenkins.listUpdate package list again to include Jenkins repository
sudo apt updateInstall Jenkins
sudo apt install -y jenkinsStart Jenkins service
sudo systemctl start jenkinsEnable Jenkins to start on boot
sudo systemctl enable jenkinsDisplay 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 8080Display Jenkins status
sudo systemctl status jenkins | catInstall 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 updateInstall OpenJDK 8:
sudo apt install openjdk-8-jre-headlessInstall net-tools:
sudo apt install net-toolsNavigate to the /opt directory:
cd /optDownload and extract Nexus:
sudo wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
sudo tar -zxvf latest-unix.tar.gzCreate a Nexus user:
sudo adduser nexusSet ownership for Nexus directories:
sudo chown -R nexus:nexus nexus-3.28.1-01
sudo chown -R nexus:nexus sonatype-workEdit Nexus runtime configuration:
sudo vim nexus-3.28.1-01/bin/nexus.rcInside 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 - nexusStart Nexus:
/opt/nexus-3.28.1-01/bin/nexus startCheck Nexus process status:
ps aux | grep nexusCheck Nexus port status:
netstat -lnptNow, 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 sonarqubeCreate Docker Network:
docker network create sonar-networkRun 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.