Jenkins Build EC2 Ubuntu
lets try same on Ubuntu
Jenkins is an open source automation server that offers an easy way to set up a continuous integration and continuous delivery (CI/CD) pipeline.
Continuous integration (CI) is a DevOps practice in which team members regularly commit their code changes to the version control repository, after which automated builds and tests are run. Continuous delivery (CD) is a series of practices where code changes are automatically built, tested and deployed to production.
In this tutorial, we will show you how to install Jenkins on an Ubuntu 18.04 machine using the Jenkins Debian package repository.
Although this tutorial is written for Ubuntu 18.04 Bionic Beaver the same steps can be used for Ubuntu 16.04 Xenial Xerus.
Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges.
To install Jenkins on your Ubuntu system, follow these steps:
Create EC2 Ubuntu Instance and do ssh there
ssh -i "pemfile.pem" root@ec2-6.6.6.compute-1.amazonaws.com
Install Java on ec2 instance as Jenkins need it
Since Jenkins is a Java application, the first step is to install Java. Update the package index and install the Java 8 OpenJDK package with the following commands:
The current version of Jenkins does not support Java 10 (and Java 11) yet. If you have multiple versions of Java installed on your machine make sure Java 8 is the default Java version.
Add the Jenkins Debian repository.
Import the GPG keys of the Jenkins repository using the following
wget
command:The command above should output
OK
which means that the key has been successfully imported and packages from this repository will be considered trusted.Next, add the Jenkins repository to the system with:
Install Jenkins.
Once the Jenkins repository is enabled, update the
apt
package list and install the latest version of Jenkins by typing:Jenkins service will automatically start after the installation process is complete. You can verify it by printing the service status:
You should see something similar to this:
If you are installing Jenkins on a remote Ubuntu server that is protected by a firewall you’ll need to open port 8080
. Assuming you are using UFW
to manage your firewall, you can open the port with the following command:
Verify the change with:
During the installation, the Jenkins installer creates an initial 32-character long alphanumeric password. Use the following command to print the password on your terminal:
At this point, you’ve successfully installed Jenkins on your system.
Lets run the application build using Jenkins CI which is running on EC2 Ubuntu Instance
Install Jenkins Plugins
At the Jenkins home page on the left menu select Manage Jenkins -> Manage Plugins select the tab Available and search for the following plugins:
Blue Ocean - New Jenkins UI
Pipeline AWS - AWS Integration
Let' s Add Node.js also on server
Node.js package is available in LTS release and the current release. It’s your choice to select which version you want to install on the system as per your requirements. Let’s add the PPA to your system to install Nodejs on Ubuntu.
Use Current Release: At te last update of this tutorial, Node.js 12 is the current Node.js release available.
Use LTS Release : At the last update of this tutorial, Node.js 10.15.3 is the LTS release available.
For this tutorial, I am using the latest current release and added their PPA to my system.
Step 2 – Install Node.js on Ubuntu
You can successfully add Node.js PPA to Ubuntu system. Now execute the below command install Node on and Ubuntu using apt-get. This will also install NPM with node.js. This command also installs many other dependent packages on your system.
Last updated