Install jenkins on AWS ec2 instance

  1. Launch EC2 Instance:

    • Log in to your AWS console.

    • Launch a new EC2 instance using an Amazon Linux or other suitable AMI.

    • Configure security groups to allow incoming traffic on port 8080 (default Jenkins port) and SSH (port 22).

  2. Connect to EC2 Instance: When it comes to connecting to your Amazon EC2 instance, you have options: the traditional SSH command or the modern EC2 Connect. SSH (Secure Shell) has long been the go-to method for remote access, but EC2 Connect brings enhanced security and convenience. With SSH, you use a private key and the instance's public IP. EC2 Connect leverages Systems Manager and IAM roles, enabling granular access control and session management. Choose the method that aligns with your security and usability preferences, and seamlessly manage your EC2 instances.

  3. Install Java and Jenkins to provide the necessary runtime for Jenkins. Add the Jenkins repository, install the Jenkins package, and start the Jenkins service. Access the web interface, set up Jenkins, and empower your CI/CD workflow for efficient software delivery. Remember, Java is a prerequisite for Jenkins' successful installation and operation on your EC2 instance. Installation of Java

    Jenkins requires Java in order to run, yet certain distributions don’t include this by default and some Java versions are incompatible with Jenkins.

    There are multiple Java implementations which you can use. OpenJDK is the most popular one at the moment, we will use it in this guide.

    Update the Debian apt repositories, install OpenJDK 17, and check the installation with the commands:

     sudo apt update
     sudo apt install openjdk-17-jre
     java -version
     openjdk version "17.0.7" 2023-04-18
     OpenJDK Runtime Environment (build 17.0.7+7-Debian-1deb11u1)
     OpenJDK 64-Bit Server VM (build 17.0.7+7-Debian-1deb11u1, mixed mode, sharing)
    
    • Weekly release

      A new release is produced weekly to deliver bug fixes and features to users and plugin developers. It can be installed from the debian apt repository.

        curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
          /usr/share/keyrings/jenkins-keyring.asc > /dev/null
        echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
          https://pkg.jenkins.io/debian binary/ | sudo tee \
          /etc/apt/sources.list.d/jenkins.list > /dev/null
        sudo apt-get update
        sudo apt-get install jenkins
      

      Jenkins, the versatile automation server, operates as a hub for seamless software development processes. Central to its functionality is port 8080, where Jenkins hosts its web interface. This port acts as a gateway to a world of continuous integration and delivery (CI/CD) possibilities. So, go to security group of ec2 instance and add rule for port 8080 and source willl be my ip:

      4. With Jenkins primed and ready to revolutionize your DevOps processes, the next step is just a few keystrokes away. Open your preferred web browser and enter the following in the address bar: http://instance-ip-address:8080. By replacing "instance-ip-address" with your EC2 instance's actual IP, you'll unlock Jenkins' user-friendly web interface. This portal is your gateway to configuring automated builds, continuous integration, and seamless deployment pipelines. Embrace the power of Jenkins on port 8080, where innovation and efficiency meet at the crossroads of modern software development.

    • Embarking on your journey with Jenkins is as simple as visiting a specific web address. Access your web browser and enter the following URL: http://instance-ip-address:8080. There, you'll encounter a prompt for a password. This special password, accessible through your EC2 instance's logs or a designated location, serves as the key to unlock Jenkins' potential. Once you've entered this password, the gates to Jenkins' intuitive interface swing open, ushering you into a world of automated workflows, robust integrations, and streamlined software delivery.

    • ubuntu@ip-172-31-41-227:~$ sudo cat/var/lib/jenkins/secrets/initialAdminPassword

    • Navigate to "Manage Plugins" in Jenkins after accessing via http://instance-ip-address:8080. Select desired plugins to enhance features like version control, testing, and deployment. Quickly amplify Jenkins' power, optimizing your CI/CD workflows for efficient software delivery.

    • As you navigate your Jenkins dashboard after accessing it via http://instance-ip-address:8080, create an admin account for comprehensive control. Follow the prompts to establish a secure username and password combination. With this admin access, you wield the authority to orchestrate automation, manage users, and drive your software development lifecycle through Jenkins' intuitive interface.

    • I hope this article proves beneficial to you.