Table of contents
๐ง๐ฆ All About Package Managers in Linux! ๐
Hey there, fellow Linux explorers! ๐ค Today, we're diving into the world of package managers in Linux. ๐ If you've ever wondered how software gets installed and managed on your Linux system, you're in the right place! ๐
๐ค What is a Package Manager?
Imagine you want to download and install new apps or programs on your computer. In the Linux world, we have these cool tools called "Package Managers" that make this process super easy! ๐ A package manager is like a magic genie ๐งโโ๏ธ that fetches, installs, and updates software for you with just a few simple commands! ๐ป๐ฎ
๐ฆ What is a Package?
A package is like a neatly wrapped gift box ๐ that contains all the necessary files, code, and instructions for a software application to work smoothly on your Linux system. ๐ It's like a little software package ready to be delivered to your computer doorstep! ๐๐จ
๐ผ Different Kinds of Package Managers:
Linux has several package managers, each with its unique style and preferences! Let's look at two popular ones:
๐งถ Debian Package Manager (dpkg) & Advanced Package Tool (APT): APT is like a dynamic duo, working together to manage packages like superheroes! ๐ฆธโโ๏ธ๐ฆธโโ๏ธ They are the dynamic duo found in Debian-based distributions like Ubuntu, Linux Mint, and more. With APT, you can easily install, update, and remove software. Just type a simple command, and it'll handle the rest! ๐พ
๐ Python Package Manager (pip): If you're a Python developer ๐, you'll love pip! It's like a personal assistant ๐ง for Python packages. Whenever you need to add a new Python library or update an existing one, pip will make it happen in a snap! ๐ซ
๐ฆ Red Hat Package Manager (RPM): RPM is another handy package manager used in Red Hat-based distributions like Fedora, CentOS, and others. It's like a trusty delivery service ๐, efficiently managing software packages on your system. RPM makes sure everything is in its place and runs smoothly! ๐งฐ
๐ Snapcraft: Snapcraft brings the gift of universal packages! ๐ It's like a Swiss Army Knife ๐จ๐ญ of package managers, working across various Linux distributions. Snap packages come with all the dependencies they need, making software installation a breeze! ๐ฌ๏ธ๐จ
Remember, each Linux distribution may have its unique package manager, but they all share the same goal: to make software management a piece of cake! ๐ฐ
๐ง๐ฆ How to Install Docker and Jenkins on Ubuntu using Package Managers! ๐
Are you ready to supercharge your Ubuntu system with Docker and Jenkins? ๐ In this guide, we'll walk you through the process of installing these powerful tools using package managers. Buckle up, and let's get started! ๐
๐ณ Installing Docker with APT:
Docker is like a magician for developers, allowing them to create, deploy, and run applications in containers. Let's use the APT package manager to install Docker on Ubuntu:
Step 1: Update Your Package List Open a terminal by pressing Ctrl + Alt + T
, and let's update our package list to ensure we get the latest versions:
sudo apt update
Step 2: Install Docker Now, we can install Docker using the following command:
sudo apt install docker.io
Step 3: Verify Docker Installation To confirm that Docker is up and running, run this command:
docker --version
You should see the version number of Docker installed on your system. Congratulations! ๐ Docker is now ready to create and manage containers on your Ubuntu system.
๐ง Installing Jenkins with APT:
Jenkins is a fantastic automation tool, perfect for continuous integration and continuous deployment (CI/CD) pipelines. Let's use APT to install Jenkins on Ubuntu:
๐ Before We Begin: Before installing Jenkins, let's make sure we have Java installed on our system. Jenkins relies on Java to run, so it's essential to have Java set up first.
Step 0: Check Java Installation To check if Java is already installed, open your terminal and run:
java -version
If you see the version information, great! You already have Java installed, and you can proceed to install Jenkins. ๐ If not, no worriesโwe'll install it now.
Step 1: Install Java If you need to install Java, use the APT package manager to install OpenJDK, which is the most popular Java version for Linux systems:
sudo apt install openjdk-17-jre
java -version
Step 3: Install Jenkins It's time for Jenkins to shine! Use the APT package manager to install Jenkins:
curl -fsSL https://pkg.jenkins.io/debian-stable/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-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
๐ Time to sit back and relax while Jenkins gets installed. โ
Step 4: Start and Enable Jenkins Once Jenkins is installed, we need to start the service and make sure it automatically starts whenever you boot up your system:
sudo systemctl start jenkins
sudo systemctl enable jenkins
๐ Jenkins is now plugged in and ready to go!
Step 5: Unlock Jenkins and Set Up Now, let's access Jenkins through its web interface. Open your favorite web browser and enter this address: http://localhost:8080
๐ You'll be greeted with an admin password prompt. No worries, we've got you covered! To retrieve the password, run this command in the terminal:
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Copy the password and paste it into the Jenkins web page to unlock the magic of Jenkins! ๐งโโ๏ธ
Step 6: Jenkins Is All Yours! Follow the on-screen instructions to customize your Jenkins setup, choose your favorite plugins, and create your admin user. ๐ ๏ธ
๐ Congratulations! You now have Jenkins up and running on your system! ๐
๐ Time to Explore Jenkins's Power Jenkins is your ultimate automation hero ๐ฆธโโ๏ธ๐ฆธโโ๏ธ, helping you build, test, and deploy your projects effortlessly. With Jenkins pipelines, you can automate complex tasks and focus on what matters mostโyour code! ๐ป๐
Task 1: Check Docker Status First things first! Let's check if Docker is up and running on your system. Open your terminal and enter this command:
sudo systemctl status docker
You should see a detailed status report of the Docker service. If it shows "active" and "running," congrats! Docker is good to go. ๐ If not, make sure you completed the Docker installation correctly before proceeding. ๐ณ๐ป
Task 2: Stopping Jenkins Service Now, let's get our hands on Jenkins! We'll stop the Jenkins service and see the difference before and after with screenshots. ๐ธ
Before:
To stop the Jenkins service, run this command:
sudo systemctl stop jenkins
After:
Awesome! Jenkins is now stopped, and you can see the change in the status. ๐โจ
Task 3: Understanding systemctl vs. service You might have noticed that we used "systemctl" to manage Docker and Jenkins services. But wait, what about "service"? Let's find out! ๐ค
"systemctl" and "service" are both used to control services on your system. However, "systemctl" is more modern and flexible, while "service" is a legacy command. ๐๏ธ
"systemctl": Used in systemd-based systems (like Ubuntu 16.04 and newer). It provides more advanced control and additional features.
"service": Used in older sysvinit-based systems. It's simpler but doesn't offer all the functionalities of "systemctl."
In our tasks, we opted for "systemctl" because it's widely supported and recommended for newer systems. ๐
๐ Congratulations! You've successfully completed our tasks! ๐๐ By now, you should feel more confident with Docker, Jenkins, and managing services using "systemctl." It's time to embrace the power of automation and continuous integration with Jenkins! ๐ค๐ป
Keep exploring, learning, and creating wonders in the tech world! ๐ Happy coding! ๐๐