DEV Community

Sandipkumar Patel for AWS Community Builders

Posted on • Updated on

Jenkins Installation & Configuration on AWS EC2 Linux instance

Image description

Jenkins is a free and open-source automation server. It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery.

Step 1: Launching an Amazon Linux EC2 instance

[Refer video “How to launch an Amazon Linux ec2 Instance”]

Step 2: Installation of Jenkins on EC2 Instance

i. Run the command to update all the packages.

sudo yum update

ii. Check if java is installed or not using the command

java -version

If java is not installed, install using the following command

sudo yum install java-1.8.0-openjdk

iii. Now, to download the latest Jenkins package

sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo

**iv. **To enable the installation of the package, import the key file from Jenkins-CI:

sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key

v. Install Jenkins on the EC2 instance

sudo yum install jenkins

vi. To start the Jenkins service

sudo service jenkins start

vii. Access the Jenkins server using the public DNS of the EC2 instance or public IP of the instance on port 8080.

http://{ec2-public-dns}:8080 or http://3.89.79.74:8080/

viii. Login using the username admin and to get the initial admin password execute the following command:

sudo su -
cd /var/lib/jenkins/secrets/ 
cat initialAdminPassword
Enter fullscreen mode Exit fullscreen mode

ix. To stop Jenkins service

sudo service jenkins stop

Oldest comments (4)

Collapse
 
chirantansaha profile image
CHIRANTAN SAHA

The above steps are not working. At the end of the installation, I am unable to start the jenkins service on the EC2 (amazon linux) server. See the errors below:

If anyone already faced and resolved the issue, then pls share. Thanks in advance.

[ec2-user@ip-xxx-yy-zz-xyx ~]$ sudo service jenkins start
Starting jenkins (via systemctl): Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
** [FAILED]**
[ec2-user@ip-xxx-yy-zz-xyx ~]$ systemctl status jenkins.service
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Sun 2022-09-25 15:06:44 UTC; 7min ago
Process: 4755 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
Main PID: 4755 (code=exited, status=1/FAILURE)

Sep 25 15:06:44 ip-xxx-yy-zz-xyx.ec2.internal systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE
Sep 25 15:06:44 ip-xxx-yy-zz-xyx.ec2.internal systemd[1]: Failed to start Jenkins Continuous Integration Server.
Sep 25 15:06:44 ip-xxx-yy-zz-xyx.ec2.internal systemd[1]: Unit jenkins.service entered failed state.
Sep 25 15:06:44 ip-xxx-yy-zz-xyx.ec2.internal systemd[1]: jenkins.service failed.
Sep 25 15:06:44 ip-xxx-yy-zz-xyx.ec2.internal systemd[1]: jenkins.service holdoff time over, scheduling restart.
Sep 25 15:06:44 ip-xxx-yy-zz-xyx.ec2.internal systemd[1]: Stopped Jenkins Continuous Integration Server.
Sep 25 15:06:44 ip-xxx-yy-zz-xyx.ec2.internal systemd[1]: start request repeated too quickly for jenkins.service
Sep 25 15:06:44 ip-xxx-yy-zz-xyx.ec2.internal systemd[1]: Failed to start Jenkins Continuous Integration Server.
Sep 25 15:06:44 ip-xxx-yy-zz-xyx.ec2.internal systemd[1]: Unit jenkins.service entered failed state.
Sep 25 15:06:44 ip-xxx-yy-zz-xyx.ec2.internal systemd[1]: jenkins.service failed.
[ec2-user@ip-xxx-yy-zz-xyx ~]$

Thanks
C Saha

Collapse
 
sam4aws profile image
Sandipkumar Patel
Collapse
 
sibaram-sahu profile image
Sibaram Sahu

Getting this below error
Starting jenkins (via systemctl): Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.

Collapse
 
sam4aws profile image
Sandipkumar Patel