In Linux, a package manager is a tool that allows you to easily install, update, and manage software packages on your system. Package managers also make it easy to update our system by providing updates to installed packages. You can use the package manager to update your system with the latest security patches, bug fixes, and new features.
Some popular package managers in Linux include APT (Advanced Package Tool) for Debian and Ubuntu, YUM (Yellowdog Updater, Modified) for CentOS and Fedora, and Pacman for Arch Linux.
Installing docker and Jenkins on our system using package managers
Docker and Jenkins are two popular tools used in software development and deployment. Docker is a containerization platform that allows developers to package their applications in containers, while Jenkins is a continuous integration and continuous deployment (CI/CD) tool that automates the build, test, and deployment process. In this article, we will guide you through the process of installing Docker and Jenkins on Ubuntu and CentOS using package managers.
Installing Docker on Ubuntu
Docker can be easily installed on Ubuntu using the apt package manager. Here are the steps to install Docker on Ubuntu:
Step 1: Update the package index
sudo apt update
Step 2: Install Docker
sudo apt-get install docker.io
Installing Jenkins on Ubuntu
Installing Jenkins on Ubuntu is a straightforward process that can be done in a few simple steps. Here's how you can install Jenkins on Ubuntu:
Step 1: Update your system
Before installing Jenkins, it's always a good idea to update your system's package list to ensure that you have the latest available packages. Run the following command to update your system:
sudo apt update
Step 2: Install Java
Jenkins requires Java to be installed on the system. You can install Java by running the following command:
sudo apt install openjdk-11-jre
Step 3: Add the Jenkins Repository
Next, you need to add the Jenkins repository key to your system, which will allow your system to verify the Jenkins packages' authenticity. Run the following command to add the key:
curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
After adding the key, you need to add the Jenkins repository to your system. Run the following command to add the repository:
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
Step 4: Install Jenkins
Once you have added the Jenkins repository, you can install Jenkins by running the following command:
sudo apt-get update
sudo apt-get install jenkins -y
This will download and install Jenkins on your Ubuntu system.
This will download and install Jenkins on your Ubuntu system.
Installing Docker on CentOS
Step 1: Update your system
Before installing Docker, it's always a good idea to update your system's package list to ensure that you have the latest available packages. Run the following command to update your system:
sudo yum update
Step 2: Install Docker
You can install Docker on CentOS by running the following command:
sudo yum install docker -y
This will install the Docker package and its dependencies on your system.
Installing Jenkins using Package Managers on CentOS
Step 1: Install Java
Jenkins requires Java to be installed on the system. You can install Java by running the following command:
sudo yum install java-1.8.0-openjdk-devel
This will install the OpenJDK package and its dependencies on your system.
Step 2: Add the Jenkins Repository
Next, you need to add the Jenkins repository key to your system, which will allow your system to verify the Jenkins packages' authenticity. Run the following command to add the key:
curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo
And add the repository to your system with:
sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key
Step 3: Install Jenkins
Once you have added the Jenkins repository, you can install Jenkins by running the following command:
sudo yum install jenkins -y
This will download the Jenkins package and its dependencies and install them on your system.
Tasks
check the status of docker service in your system.
stop the service jenkins and post before and after screenshots
read about the commands systemctl vs service
In Linux, systemctl
and service
are two commands that are commonly used to manage services on the system. While they are similar in functionality, there are some key differences between them. Key differences between service
and systemctl
is the way they handle service dependencies. When you start a service using service
, it only starts that service without considering any dependencies that it may have. In contrast, systemctl
is designed to handle service dependencies automatically. When you start a service using systemctl
, it checks the service's dependencies and starts them as well, if they are not already running.
Another difference between service
and systemctl
is that systemctl
provides more detailed information about services and their status. For example, you can use the systemctl status
command to view the status of a service and see its process ID, memory usage, and other details.