✅Introduction
a package manager is a powerful tool that simplifies the installation, removal, and management of software packages on your system. It helps you efficiently handle software dependencies and keep your system up-to-date with the latest versions of installed programs. Each package contains the software, its configuration files, and other necessary data.
✅To install docker and Jenkins in your system from your terminal using package managers.
To install docker-:
step 1:Open a terminal or command prompt and update your package manager's repositories to ensure you have the latest information about available packages.
sudo apt update
step2:
install the Docker package using your package manager.
sudo apt install docker.io
Finally docker package was installed successfully.
step3:
To check if Docker is installed and running by running a simple test:
docker --version
sudo docker run hello-world
To install Jenkins:
Step1:Jenkins requires Java to be installed on your system. Make sure you have Java Development Kit (JDK) 17 or later installed. You can check if Java is already installed by running:
java --version
If Java is not installed or the version is below 17, you can install it using your package manager. Here's how to install OpenJDK 17:
sudo apt install -y openjdk-17-jdk
Step2:Jenkins provides its repository to ensure you get the latest stable version. Import the repository GPG key and add the repository to your package manager, then install Jenkins.
1.curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
/usr/share/keyrings/jenkins-keyring.asc > /dev/null
2.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
3.sudo apt-get update
4.sudo apt-get install jenkins
step3:After the installation, start the Jenkins service and enable it to start on boot.
sudo systemctl enable jenkins
sudo systemctl start jenkins
step4:Jenkins will be available on port 8080 by default. You can access the Jenkins web interface by opening a web browser and navigating to http://localhost:8080
. Follow the on-screen instructions to complete the setup. During the setup, Jenkins will provide an initial admin password, which you can find on your system in the file. If you have a firewall installed, you must add Jenkins as an exception. You must change YOURPORT
the script below to the port you want to use. Port 8080
is the most common. Go to the terminal and enter this code-
YOURPORT=8080
PERM="--permanent"
SERV="$PERM --service=jenkins"
firewall-cmd $PERM --new-service=jenkins
firewall-cmd $SERV --set-short="Jenkins ports"
firewall-cmd $SERV --set-description="Jenkins port exceptions"
firewall-cmd $SERV --add-port=$YOURPORT/tcp
firewall-cmd $PERM --add-service=jenkins
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
then enter this in the browser-:http://localhost:8080
to know the password enter this command in the terminal-:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
then give a username, password, email id, and Full name in the Jenkins portal. That's it! You should now have Jenkins installed and running on your Linux system. You can start creating and managing Jenkins jobs to automate your build and deployment processes. Note-:In the Jenkins setup, you'll be prompted to choose between installing recommended plugins or selecting plugins manually. It's generally a good idea to install the recommended plugins for a standard Jenkins installation.
✅Write a small blog or article to install these tools using package managers on Ubuntu.
Package managers play a crucial role in simplifying software installations and updates on Linux distributions. To install docker we can use the below package management code.
sudo apt update
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
✅stop the service Jenkins service.
sudo systemctl stop jenkins
sudo systemctl status jenkins
in this command, we can stop the Jenkins service on a Linux system and check whether Jenkins is active (running) or inactive (stopped).
✅check the status of the docker service in your system.
picture 1.0:
code to check the status of the docker service-:
sudo systemctl status docker
here picture 1.0 shows the status of the docker service being active.