Install Jenkins on Ubuntu:simple freestyle project

Nipulpatel
4 min readOct 15, 2023

--

What is a Jenkins:

Jenkins is an open-source automation tool written in Java with plugins built for Continuous Integration purposes. Jenkins is used to building and test your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. It also allows you to continuously deliver your software by integrating with a large number of testing and deployment technologies.

What is Freestyle Projects ??

A freestyle project in Jenkins is a type of project that allows you to build, test, and deploy software using a variety of different options and configurations. Here are a few tasks that you could complete when working with a freestyle project in Jenkins.

Freestyle project is the simplest and most basic type of job that can be created in Jenkins and it can be used to perform a variety of tasks such as building, testing, and deploying software.

  1. Install jenkins on AWS EC2 Ubuntu instance.

open a terminal window and update the system package repository by running:

sudo apt update

Depending on which Java version you want to install, Java 8 or 17, run one of the following commands:

sudo apt install openjdk-17-jre

check java version:

java -version

Step 2: Add Jenkins Repository

Jenkins repository to your Ubuntu system.

curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee\
/usr/share/keyrings/jenkins-keyring.asc > /dev/null

Add the Jenkins software repository to the source list and provide the authentication key:

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/null

the command adds the Long Term Support (LTS) stable release to the sources list, but there is no output.

Step 3: Install Jenkins

Update the system repository one more time. Updating refreshes the cache and makes the system aware of the new Jenkins repository.

sudo apt-get update

Install Jenkins by running:

sudo apt-get install jenkins

To check if Jenkins is installed and running, run the following command:

sudo systemctl start jenkins.service
sudo systemctl status jenkins

A bright green entry labelled active (running) should appear in the output, indicating that the service is running.

For jenkins used port 8080, browse instance-public-IP/8080 it will open jenkins dashboard.

A page opens prompting you to Unlock Jenkins. Obtain the required administrator password in the next step. Obtain the default Jenkins unlock password by opening the terminal and running the following command:

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

The setup prompts to either Install suggested plugins or Select plugins to install. It’s fine to simply install the suggested plugins.

The next step is the Create First Admin User. Enter the credentials you want to use for your Jenkins administrator, then click Save and Continue.

After this, you should set up the Instance Configuration. This is the preferred network address for this Jenkins installation. Confirm the address you want to use for your server. This is most likely the same address you used to get to this configuration page.

nce you specify the Jenkins URL, click Save and Finish.

7. You should see a page that says Jenkins is ready! Click Start using Jenkins to open the Jenkins dashboard.

Creating a Jenkins freestyle project involves several steps:

Click on the “New Item” button on the left sidebar.

Give your project a name, such as “boon123” and select “Freestyle project” as the project type

In the configuration section, scroll down to the “Build” section and add an “Execute shell” build step .

In the command field, enter the command to print “this is jenkins pipeline”, such as echo “this is jenkins pipeline””.

Click on the “Save” button at the bottom of the page to create the project.

8. Once the project is created, click on the “Build Now” link to run the project.

Check the console output for “this is jenkins pipeline” message.

thank you for reading !!!

--

--

No responses yet