Continuous Integration with Jenkins on Alibaba Cloud

What Is Alibaba Cloud’s Elastic Compute Service (ECS)?

Alibaba Cloud’s Elastic Compute Service (ECS) is a range of elastic cloud-based server products that are simpler and more efficient to manage than physical servers. You can create instances, add memory and storage, scale up whenever you need to, build out complex and connected VPCs in different regions, and use them as essential components of Alibaba Cloud’s vast range of cloud products and services.

What Is Jenkins?

Jenkins is a continuous integration build tool which builds and releases application code after any change is made to the code and pushed to the code base. Jenkins saves development time by running automated testing against the code at every change pushed to the repos. Nasty bugs are picked up immediately and the whole team is aware of build failures as they happen.

Prerequisites

You will need an Alibaba Cloud account. If you don’t already have one, head over to the Free Trial page to get $300–1200 worth of Alibaba Cloud products to play around with in the Alibaba Cloud Free Trial.

Build and Configure an Alibaba Cloud ECS Instance

First, let’s spin up an Alibaba Cloud ECS instance in our favorite region. Click through to the Elastic Compute Service product page.

Install Java on Ubuntu 18.04

Jenkins runs on Java, so we need to have Java installed. Connect to your instance via ssh.

apt update
apt install openjdk-8-jre-headless
java -version
apt install openjdk-8-jdk
java -version
apt updateapt upgrade
update-alternatives --config java
nano /etc/environmentJAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/"
source /etc/environment
echo $JAVA_HOME
apt update

Install Jenkins on Ubuntu

Connect to your instance via ssh.

adduser jenkins_user
usermod -aG sudo jenkins_user
ufw allow OpenSSH
ufw enable
ufw status
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add –
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
apt update
apt install jenkins
sudo systemctl start jenkinssudo systemctl status jenkins
sudo ufw allow 8080
tail -f /var/log/jenkins/jenkins.log
http://<<Public IP Address>>:8080
nano /var/lib/Jenkins/secrets/initialAdminPassword
sudo service jenkins stopsudo service jenkins start

Summary

To summarize, we told you about Alibaba Cloud’s Elastic Compute Service (ECS) and Jenkins continuous integration build tool. We showed you how to create an ECS Ubuntu 18.04 instance, how to login to it with ssh, and how to install Java and Jenkins. Finally, we confirmed that we had installed Jenkins correctly via a browser window and performed the initial set up.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com