Setting Up Jenkins on Amazon EC2 Ubuntu Instance

Back to Blog

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.


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

Install Java

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

Install Jenkins AWS

  1. Add the key using the 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 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 the admin password
    • <your_ec2_ip_address>:8080
  5. Copy the Jenkins admin user password using the below command, and paste it into 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 log in with admin credentials setup in step 7.

!!Your setup is completed!!

Share this post

Back to Blog