Setting Up Jenkins on Amazon EC2 Ubuntu Instance

devops

Setting Up Jenkins on Amazon EC2 Ubuntu Instance

We are writing this blog to list down the process of setting up jenkins on Amazon EC2 Ubuntu instance having OS version 18.04.

Pre-requisites :

  • 1 AWS EC2 Instance should be up and running
  • Make SSH connection with your EC2 instance

Install Java

  1. Enable ‘Universe’ repository using below command
    • sudo add-apt-repository universe
      On older versions of Ubuntu you can use below command
      sudo add-apt-repository “deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe”
  2. Use below command to install java
    • sudo apt install openjdk-8-jdk
  3. Setup Java_Home using below commands
    • Open bashrc file with command
      – nano .bashrc
      Add below lines at the end your in bashrc file
      export JAVA_HOME=/usr
      export PATH=$JAVA_HOME/bin:$PATH

Install Jenkins

  1. Add the key using below command in order to use debian package repository of Jenkins
  2. Add the following entry in your /etc/apt/sources.list
    • sudo sh -c ‘echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list’
  3. Execute below commands
    • sudo apt-get update  
    • sudo apt-get install jenkins
  4. Open a web browser and enter the url, here you will be asked to enter admin password
    • <your_ec2_ip_address>:8080
  5. Copy the jenkins admin user password using below command, and paste it in the “Administrator Password” section on your web browser
    • sudo cat /var/lib/jenkins/secrets/initialAdminPassword
  6. Continue with the setup and install suggestive plugins by clicking on the button ‘Install suggested plugins’
  7. Create your first admin user and click on the button ‘Save and Continue’
  8. Navigate to <your_ec2_ip_address>:8080 in your web browser and login with admin credentials setup in step 7.

 

!!Your setup is completed!!

Share this post