Home » Cloud » Alibaba » Deploy Jenkins Service On ECS – Ali Cloud

Deploy Jenkins Service On ECS – Ali Cloud

how to deploy the Jenkins service on an Alibaba Cloud ECS instance. Jenkins is an open-source continuous integration software tool written in the Java programming language for monitoring continuous and duplicate jobs. It aims to provide an open and easy-to-use software platform for continuous software integration. The following sections shows the procedure for installing Jenkins in the Ubuntu system.

Experiment process

  • Install the JDK.
  • Install Jenkins.
  • Log on to Jenkins.

Cloud resources required

  • ECS

Prerequisites

  • You have basic knowledge about ECS and SLB.
  • If you’re using your own Alibaba Cloud account to operate the experiment, please note that you’ll need to choose the same Ubuntu 20.04 operating system for your ECS in order to run the experiment smoothly.

We can see one running ECS instance in the Singapore region. Click it to go to the ECS console as shown in the following picture.

Copy this ECS instance’s Internet IP address and remotely log in to this ECS (Ubuntu system) instance. For details of remote login

Step 1: Create Ubuntu 20.04.5 LTS Instance on Ali Cloud then update the Applications.

Step 2: Download Jenkins using the below command:

sudo apt install openjdk-8-jdk -y

 

wget -qO – https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add –

Step 3: Once the app is downloaded from the repository then initiate extracting the setup using shell by using the below command

sh -c ‘echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list’

After both commands have been entered, we’ll run an update so that apt will use the new repository.

 

Step 4: After successfully extracted the setup then initiate update Jenkins.

 sudo apt update

Finally, we’ll install Jenkins and its dependencies.

sudo apt install Jenkins

Step 5: After the installation of the application start the services, Enable the services and then check its status of Jenkins by using the below commands.

sudo service jenkins restart
sudo systemctl start jenkins
sudo systemctl enable jenkins
sudo systemctl status Jenkins

Step 6: Opening the Firewall

Jenkins runs on port 8080. We’ll open that port using ufw:

sudo ufw allow 8080

Note: If the firewall is inactive, the following commands will allow OpenSSH and enable the firewall:

sudo ufw allow OpenSSH

sudo ufw enable

Check ufw’s status to confirm the new rules:

sudo ufw status

You’ll notice that traffic is allowed to port 8080 from anywhere:

 

Step 7: Setting Up Jenkins

Jenkins on its default port, 8080, using your server domain name or IP address:

http://<publicip ro privateip>:8080

You should receive the Unlock Jenkins screen, which displays the location of the initial password:

In the terminal window, use the cat command to display the password:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Copy the 32-character alphanumeric password from the terminal and paste it into the Administrator password field, then click Continue.

The next screen presents the option of installing suggested plugins or selecting specific plugins:

We’ll click the Install suggested plugins option, which will immediately begin the installation process.

Create The Admin User

 

After Creating user Login