Mastering Automation: How to Set Up Jenkins on DigitalOcean for Effortless DevOps Bliss

Mastering Automation: How to Set Up Jenkins on DigitalOcean for Effortless DevOps Bliss

ยท

3 min read

Automating tasks such as building, testing, and deploying software is essential for streamlining development processes. Jenkins, an open-source automation server, is a powerful tool for achieving this goal. Pairing Jenkins with DigitalOcean, a cloud hosting platform offering simplicity and cost-effectiveness, provides a robust environment for managing applications in the cloud. In this guide, we'll walk through setting up Jenkins on DigitalOcean.

Step 1: Create a Droplet on DigitalOcean

\=> Log in to your DigitalOcean account and navigate to the "Create" button, then select "Droplets."

Create a Droplet on DigitalOcean

\=> Choose a Region: Select the region closest to your target audience or based on your specific requirements.

Choose Region

\=> Choose an Image: Opt for an operating system image suitable for your project needs, typically Ubuntu or another Linux distribution.

Choose an Image

\=> Choose Size: Select a Droplet size based on your project's resource requirements.

Choose size

Choose size

\=> Choose Authentication Method: It's recommended to use SSH keys for secure access to your Droplet. However, you can also opt for a password if preferred.

i) Password

Choose Authentication Method Password

ii) SSH key (We are Using)

Choose Authentication Method SSH key

Choose Authentication Method SSH key

\=> Click on the "Create Droplet" button to initiate the Droplet creation process.

Create Droplet

\=> Renaming Your Droplet:

After creation, you can customize your Droplet by renaming it through the DigitalOcean dashboard.

Rename droplet name

\=> Creating a Firewall:

Configure inbound and outbound rules for your Droplet by accessing the Networking section and creating a firewall.

Create Firewall

Inbound Rules :

Inbound Rules

Outbound Rules :

Outbound Rules

Firewall Created :

Firewall Created

Step 2: Install Docker on your Droplet

\=> SSH to Your Droplet:

Access your Droplet via SSH by copying its IPv4 address and using your preferred terminal emulator.

Copy your droplet's IPV4

\=> Update Package Index:

Keep your package index up to date by executing the command:

sudo apt update

\=> Install Docker:

Install Docker on your Droplet with the command:

sudo apt install docker.io

Step 3: Install Jenkins on the Docker container

\=> Run Jenkins Docker Container:

Launch a Docker container running Jenkins with the following command:

docker run -p 8080:8080 -p 50000:50000 -d -v
jenkins_home:/var/jenkins_home jenkins/jenkins:lts
docker ps

docker ps

\=> Access Jenkins:

Open a web browser and enter your Droplet's IP address followed by the Jenkins port to access the Jenkins dashboard.

Access Jenkins on web-browser via typing ip_address:jenkins_port

\=> Unlock Jenkins:

Retrieve the initial unlock password from the Jenkins container's logs and proceed with the setup.

Getting Unlock Jenkins Password

\=> Install Plugins:

Install the suggested plugins to extend Jenkins' functionality according to your requirements.

Install Suggested Plugins

Install Suggested Plugins

\=> Create Admin User:

Create the first administrative user to manage Jenkins and its configurations effectively.

Create First Admin User

Congratulations

Congratulations! ๐ŸŽ‰ You've successfully set up Jenkins on DigitalOcean, creating a robust environment for automating your software development processes.

Happy automating

Did you find this article valuable?

Support Ayush Dabhi by becoming a sponsor. Any amount is appreciated!

ย