Day 7 Task: Understanding package manager and systemctl
Kashi Diggi
Actively seeking job opportunities in DevOps Engineer AWS | AWS Devops | Linux | Git & Github | Docker | Jenkins | Ansible | Kubernetes | Terraform | Grafana
A package manager in Linux is a program that automates the installation, updating, and management of software packages in a Linux operating system. Common package managers include apt (Debian and Ubuntu), yum (Red Hat and CentOS), and dnf (Fedora). These package managers handle dependency resolution and make it easy to install and manage multiple software packages at once
A package is usually referred to an application but it could be a GUI application, command line tool or a software library (required by other software programs). A package is essentially an archive file containing the binary executable, configuration file and sometimes information about the dependencies.
Package Managers differ based on packaging system but same packaging system may have more than one package manager. For example, RPM has Yum and DNF package managers. For DEB, you have apt-get, aptitude command line based package managers.
Tasks: 1. You have to install docker and jenkins in your system from your terminal using package managers.
For Ubuntu - Install Docker?1. Open the terminal on Ubuntu. 2. Remove any?docker file?that are running in the system, using the following command:?sudo apt-get remove docker docker-engine docker.io
3. Check if the system is up-to-date using the following command:?sudo apt-get update
4. Install Docker using the following command:?sudo apt install docker.io
5. Install all the dependency packages using the following command:??sudo snap install docker
6. Before testing Docker, check the version installed using the following command:?docker --version
For Ubuntu: Install Jenkins
Step 1: Install Java
Jenkins requires the Java Runtime Environment (JRE).
1.?Check if you already have java?installed on your Ubuntu system:?java --version
2. Depending on which Java version you want to install, Java 8 or 11, run one of the following commands:
To install OpenJDK 8, run:?sudo apt install openjdk-8-jdk -y?To install OpenJDK 11, run:?sudo apt install openjdk-11-jdk -y
Step 2: Add Jenkins Repository
It is recommended to install Jenkins using the project-maintained repository, rather than from the default Ubuntu repository. The reason for that is because the Jenkins version in the default Ubuntu repository might not be the latest available version, which means it could lack the latest features and bug fixes.
1. Start by importing the GPG key. The GPG key verifies package integrity but there is no output. Run:
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
2. Add the Jenkins software repository to the source list and provide the authentication key:
echo 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
1. Update the system repository
sudo apt update
2. Install Jenkins by running:
sudo apt install jenkins -y
3. To check if Jenkins is installed and running, run the following command:
sudo systemctl status jenkins?A bright green entry labelled?active (running)?should appear in the output, indicating that the service is running.
2. Stop the service jenkins and post before and after screenshots.
Before stop jenkins service:
After stop jenkins service :
3.Difference between systemctl and service
The?systemctl?command interacts with the SystemD service manager to manage the services. In?Service?command, it manages the services by interacting with the SystemD process instead of running the init script.
To start, stop, and restart the service, we can run the respective commands with?systemctl: 1. To start jenkins service Syntax :?systemctl start jenkins
2. To stop jenkins service Syntax:?systemctl stop jenkins
3. To check jenkins status Syntax:?systemctl status jenkins
4. To enable jenkins service Syntax:?systemctl enable jenkins
To start, stop, and restart the service, we can run the respective commands with?service:
1. To start jenkins service Syntax :?service jenkins start
2. To stop jenkins service Syntax:?service jenkins stop
3. To check jenkins status Syntax:?service jenkins status
4. To enable jenkins service Syntax:?service jenkins enable
Thank you for reading!!!