Setting Up Jenkins on Amazon EC2 Ubuntu Instance

Back to Blog
devops

Setting Up Jenkins on Amazon EC2 Ubuntu Instance

Install Jenkins On ec2 Ubuntu AWS

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 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 http://archive.ubuntu.com/ubuntu $(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 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 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!!

FAQs

  • How do I upload files to the EC2 instance?

Method 1: FTP client-based file uploading. You can use FTP clients like FileZilla, WinSCP, etc. to upload your files to the EC2 instance.

Method 2: Windows-based file upload to an EC2 instance.

Method 3: Upload files through the command prompt.

  • What is the Java JAR command?

Based on the ZIP and ZLIB compression formats, the jar command is a general-purpose archiving and compression utility. The jar command was initially intended to package Java applets or applications; however, starting with JDK 9, users can use the jar command to construct modular JARs. Java applets are no longer supported as of JDK 11.

  • Why jar files are used in Java?

You can use JAR files for activities like lossless data compression, archiving, decompression, and archive unpacking because they are packaged in the ZIP file format. These are some of the most typical tasks for JAR files, and by utilizing just these fundamental features, you can enjoy a wide range of JAR file advantages.

Share this post

Back to Blog