Jenkins Basics

Jenkins Basics

Jenkins is an open-source automation tool used for continuous integration and continuous delivery (CI/CD) of software applications. It helps developers automate the build, test, and deployment processes, making it easier to deliver high-quality software efficiently.

Please refer: jenkins.io/doc/book/installing/linux

To install Jenkins on an Ubuntu EC2 instance, you can follow these steps:

  1. Launch an Ubuntu EC2 instance:

    • Go to the AWS Management Console and navigate to EC2.

    • Click on "Launch Instance" and select an Ubuntu Server AMI.

    • Choose an instance type, configure other settings, and launch the instance.

  2. Connect to the EC2 instance:

    • Once the instance is launched, you can connect to it using SSH.

    • Open a terminal or SSH client and run the following command, replacing your-instance-ip with the actual IP address of your EC2 instance:

        ssh -i <path-to-your-ssh-key> ubuntu@your-instance-ip
      
  3. Update the system:

    • Run the following commands to update the package lists and upgrade installed packages:

        $ sudo apt update
      

Install Java:

  • Jenkins requires Java to run. You can install OpenJDK using the following command:

      $ sudo apt install openjdk-11-jre
      $ java -version
    

  1. Add Jenkins repository and install Jenkins:

    • Add the Jenkins repository key to the system using the following command:

    • Update the package lists and install Jenkins:

  2. Start and enable Jenkins service:

    • Start the Jenkins service using the following command:

        sudo systemctl start jenkins
      
    • Enable Jenkins to start on system boot:

        sudo systemctl enable jenkins
      
  3. Open Jenkins in a web browser:
    Jenkins setup is done. Now we have to unlock Jenkins.
    The first time when you use it, you have to unlock it, so you need a password to unlock it.

    That password will be here on the server where you installed Jenkins.

    **Var/lib/jenkins/secret
    **

    The concept of password here is to prevent anyone to deploy anything on the environment.

    • By default, Jenkins runs on port 8080. Open a web browser and enter the following URL:

        http://your-instance-ip:8080
      

  4. Complete the Jenkins setup:

    • Follow the instructions in the Jenkins setup wizard to install suggested plugins and create an admin user.

    • Customize any additional settings as per your requirements.

  1. Once the setup is complete, Jenkins will be ready to use on your Ubuntu EC2 instance. You can create Jenkins jobs, configure build pipelines, and automate your CI/CD processes.

My Next blog will be on freestyle projects and also declarative pipe. I will also write and illustrate using circle Ci in upcoming blogs.