Day 8: Understanding Package Manager and Systemctl

Task 1 : Install Docker and Jenkins:

Install Docker and Jenkins on your system from your terminal using package managers.
Update the package list and install required packages:

🚀 How to Install Jenkins and Docker on Ubuntu

sudo apt update  
sudo apt install apt-transport-https ca-certificates curl software-properties-common
  • Add Docker’s official GPG key:

      curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
  • Add the Docker APT repository:

      sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    
  • Update the package list again:

      sudo apt update
    
  • Install Docker:

      sudo apt install docker-ce
    
  • Check Docker installation:

      sudo systemctl status docker
    

1. Install Jenkins 🛠️

Step 1: Update your system 🔄

First, let’s make sure your system is up to date:

bashCopy codesudo apt update && sudo apt upgrade -y

Step 2: Add Jenkins Repository 🗂️

Now, add the Jenkins package repository and its GPG key:

bashCopy codecurl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null

Then, add the repository to your system:

bashCopy codeecho "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null

Step 3: Install Jenkins 🔧

Update your system again and install Jenkins:

bashCopy codesudo apt update
sudo apt install jenkins -y

Step 4: Start Jenkins 🎯

Start Jenkins and make sure it runs on boot:

bashCopy codesudo systemctl start jenkins
sudo systemctl enable jenkins

Step 5: Access Jenkins 🌐

Now, go to your browser and open Jenkins using:

arduinoCopy codehttp://your_server_ip_or_domain:8080

To unlock Jenkins, get the initial password by running:

bashCopy codesudo cat /var/lib/jenkins/secrets/initialAdminPassword

Copy the password and paste it into your browser to complete the setup.

Jenkin Logs: