Welcome to Module Seven of your Introduction to Linux Level One course! In this module, we will learn about Package Management.
Imagine you are building a big Lego castle. You need many different pieces. Instead of going to the store and buying each piece one by one, you buy a set that has all the pieces you need. A package manager is like a Lego set manager. It helps you find, install, update, and remove software on your Linux system.
In Linux, software is distributed in packages. A package contains all the files and instructions needed to install a program. A package manager is a tool that makes it easy to install, update, and remove these packages.
By the end of this module, you will know how to use package managers to install, update, and remove software on your Linux system. You will also learn how to manage software repositories and keep your system up to date. Let's begin!
By the time you finish this module, you will be able to:
There was a magical store called "The App Emporium." In this store, you could get any app or program you wanted. But instead of buying each app separately, you could buy a package that contained everything you needed.
The store had a very smart shopkeeper named Mr. Ade. He kept all the packages organized and knew exactly where everything was. If you wanted a new game, you would tell Mr. Ade, and he would give you the package. If a game needed an update, Mr. Ade would give you the updated package. If you no longer wanted a game, Mr. Ade would take it back and make sure everything was clean and tidy.
Mr. Ade was so good at his job that the store was always neat and organized. Customers loved how easy it was to get the software they needed. The store's system was so efficient that other stores came to learn from Mr. Ade.
In Linux, the package manager is like Mr. Ade. It keeps all your software organized, helps you install new programs, updates them when needed, and removes them when you don't want them anymore. The package manager makes sure your system stays clean and up to date.
Let's learn how to use the package manager!
Definition: A package is a collection of files that make up a software program, along with instructions on how to install it.
Why it is important: Packages make it easy to install software. Instead of downloading individual files, you get everything you need in one package.
Simple explanation: A package is like a box that contains all the parts you need to build something.
Real-life example: A .deb file for Debian/Ubuntu is a package.
School example: A textbook contains all the chapters you need to learn.
Home example: A puzzle box contains all the pieces you need to complete the puzzle.
Nigerian example: A food package contains all the ingredients for a meal.
Illustration:
PACKAGE
|
+--- Collection of files
|
+--- Installation instructions
|
+--- Contains a program
|
+--- Easy to install
|
V
READY-TO-USE SOFTWARE
Mini summary: A package is a collection of files that make up a software program. It makes installation easy.
Definition: A package manager is a tool that helps you install, update, and remove software packages on your system.
Why it is important: A package manager automates the process of installing and managing software. It handles dependencies and keeps your system organized.
Simple explanation: A package manager is like a shopping assistant who helps you find, buy, and organize your software.
Real-life example: "apt" is the package manager on Debian/Ubuntu systems.
School example: A librarian helps you find and borrow books.
Home example: A personal assistant helps you organize your tasks.
Nigerian example: A market helper helps you find and buy what you need.
Illustration:
PACKAGE MANAGER
|
+--- Install software
|
+--- Update software
|
+--- Remove software
|
+--- Manage dependencies
|
V
EASY SOFTWARE MANAGEMENT
Mini summary: A package manager is a tool that helps you install, update, and remove software. It makes software management easy.
Definition: "apt" (Advanced Package Tool) is the most common package manager on Debian-based Linux distributions like Ubuntu.
Why it is important: "apt" is easy to use and very powerful. It is the primary way to manage software on many Linux systems.
Simple explanation: "apt" is like the main tool for managing software on Ubuntu and similar systems.
Real-life example: You use "apt install" to install software.
School example: The main textbook for a subject is the primary resource.
Home example: The main remote control for your TV.
Nigerian example: The main market in a city where you buy everything.
Illustration:
APT COMMANDS
apt update (Update package list)
apt install (Install a package)
apt remove (Remove a package)
apt upgrade (Upgrade all packages)
apt search (Search for a package)
Mini summary: "apt" is the main package manager on Debian-based systems. It is easy to use and very powerful.
Definition: The "apt update" command downloads the latest list of available packages and their versions from the repositories.
Why it is important: You need to update the package list before you can install or upgrade software. It ensures you get the latest versions.
Simple explanation: "apt update" is like checking the menu at a restaurant to see what's available today.
Real-life example: Type sudo apt update to update the package list.
School example: Checking the school calendar to see what events are coming up.
Home example: Looking at the store flyer to see what's on sale.
Nigerian example: Checking the market price list before buying goods.
Illustration:
COMMAND: apt update
user@computer:~$ sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Fetched 119 kB in 2s (59.5 kB/s)
Reading package lists... Done
Mini summary: "apt update" downloads the latest list of available packages. Always run it before installing or upgrading.
Definition: The "apt install" command installs a software package on your system.
Why it is important: This is how you get new software on your system.
Simple explanation: "apt install" is like buying a new app from the app store.
Real-life example: sudo apt install firefox installs Firefox browser.
School example: A student gets a new textbook for a subject.
Home example: You buy a new game for your console.
Nigerian example: A market woman buys new stock for her shop.
Illustration:
COMMAND: apt install
user@computer:~$ sudo apt install firefox
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
firefox
0 upgraded, 1 newly installed, 0 to remove
Need to get 72.0 MB of archives.
After this operation, 200 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu jammy/main amd64 firefox amd64 95.0+build1-0ubuntu1 [72.0 MB]
Fetched 72.0 MB in 5s (14.4 MB/s)
Selecting previously unselected package firefox.
(Reading database ... 201234 files and directories currently installed.)
Preparing to unpack .../firefox_95.0+build1-0ubuntu1_amd64.deb ...
Unpacking firefox (95.0+build1-0ubuntu1) ...
Setting up firefox (95.0+build1-0ubuntu1) ...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Mini summary: "apt install" installs a software package on your system.
Definition: The "apt upgrade" command upgrades all installed packages to their latest versions.
Why it is important: Upgrading keeps your software secure and up to date with the latest features and bug fixes.
Simple explanation: "apt upgrade" is like updating all your apps to the latest version.
Real-life example: sudo apt upgrade upgrades all installed packages.
School example: Getting the latest edition of a textbook.
Home example: Updating your phone's operating system.
Nigerian example: A farmer using improved seeds for a better harvest.
Illustration:
COMMAND: apt upgrade
user@computer:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
The following packages have been kept back:
linux-generic linux-headers-generic linux-image-generic
The following packages will be upgraded:
firefox libc6
2 upgraded, 0 newly installed, 0 to remove
Need to get 80.0 MB of archives.
After this operation, 10 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Mini summary: "apt upgrade" upgrades all installed packages to their latest versions.
Definition: The "apt search" command searches for packages that match a keyword.
Why it is important: You need to find the name of a package before you can install it. "apt search" helps you find what you're looking for.
Simple explanation: "apt search" is like using a search engine to find a specific app.
Real-life example: apt search firefox finds packages related to Firefox.
School example: Searching for a book in the library catalog.
Home example: Searching for a recipe online.
Nigerian example: Asking around the market for a specific item.
Illustration:
COMMAND: apt search
user@computer:~$ apt search firefox
firefox/jammy 95.0+build1-0ubuntu1 amd64
Safe and easy web browser from Mozilla
firefox-locale-en/jammy 95.0+build1-0ubuntu1 amd64
English language pack for Firefox
firefox-geckodriver/jammy 0.30.0-2 amd64
Firefox WebDriver implementation
Mini summary: "apt search" searches for packages that match a keyword.
Definition: The "apt remove" command removes an installed package from your system.
Why it is important: You need to remove software that you no longer need to save space and keep your system clean.
Simple explanation: "apt remove" is like uninstalling an app from your phone.
Real-life example: sudo apt remove firefox removes Firefox.
School example: Returning a book to the library.
Home example: Throwing away old newspapers.
Nigerian example: A seller clearing old stock from their shop.
Illustration:
COMMAND: apt remove
user@computer:~$ sudo apt remove firefox
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
firefox
0 upgraded, 0 newly installed, 1 to remove
After this operation, 200 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 201234 files and directories currently installed.)
Removing firefox (95.0+build1-0ubuntu1) ...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
Mini summary: "apt remove" removes an installed package from your system.
Definition: A repository is a storage location from which packages can be retrieved and installed.
Why it is important: Repositories are where your package manager finds the software you want to install. They contain a vast collection of software.
Simple explanation: A repository is like a warehouse full of software packages. Your package manager gets the packages from the warehouse.
Real-life example: The Ubuntu repositories contain thousands of packages.
School example: The school library is a repository of books.
Home example: A pantry is a repository of food.
Nigerian example: A market is a repository of goods for sale.
Illustration:
REPOSITORY
|
+--- Collection of packages
|
+--- Source of software
|
+--- Managed by the system
|
+--- Official or third-party
|
V
WHERE SOFTWARE COMES FROM
Mini summary: A repository is a storage location where packages are stored. Your package manager gets software from repositories.
Definition: You can add or remove repositories to access more software or remove sources you don't trust.
Why it is important: Adding repositories gives you access to a wider range of software. Removing old or untrusted repositories keeps your system secure.
Simple explanation: Adding a repository is like adding a new supplier to your store. You get more products to offer.
Real-life example: add-apt-repository ppa:user/name adds a PPA.
School example: Adding a new textbook to the curriculum.
Home example: Subscribing to a new streaming service.
Nigerian example: A shop owner adding a new supplier for their goods.
Illustration:
ADDING A REPOSITORY
user@computer:~$ sudo add-apt-repository ppa:user/name
Press [ENTER] to continue or Ctrl-c to cancel.
(The repository is added to your system)
user@computer:~$ sudo apt update
(Update the package list to include the new repository)
Mini summary: You can add or remove repositories to access more software or keep your system secure.
Definition: "dpkg" is a low-level package manager that can install .deb files directly.
Why it is important: Sometimes you need to install a .deb file that you downloaded from the internet. "dpkg" lets you do that.
Simple explanation: "dpkg" is like installing an app from a file instead of from the app store.
Real-life example: sudo dpkg -i file.deb installs a .deb file.
School example: Installing software from a CD instead of downloading it.
Home example: Installing a game from a disc.
Nigerian example: Buying goods directly from a manufacturer instead of a distributor.
Illustration:
COMMAND: dpkg
user@computer:~$ sudo dpkg -i mypackage.deb
Selecting previously unselected package mypackage.
(Reading database ... 201234 files and directories currently installed.)
Preparing to unpack mypackage.deb ...
Unpacking mypackage (1.0-1) ...
Setting up mypackage (1.0-1) ...
Mini summary: "dpkg" is a low-level package manager that can install .deb files directly.
Definition: "apt-get" is the older version of "apt". It is still widely used and has similar functionality.
Why it is important: Many scripts and older documentation use "apt-get". Knowing it helps you understand older systems.
Simple explanation: "apt-get" is like the older version of the "apt" tool. It does the same thing but with different syntax.
Real-life example: sudo apt-get install firefox installs Firefox using apt-get.
School example: Using an older textbook that still has useful information.
Home example: Using an older version of a tool that still works.
Nigerian example: Using a traditional method that is still effective.
Illustration:
APT-GET COMMANDS
apt-get update (Update package list)
apt-get install (Install a package)
apt-get remove (Remove a package)
apt-get upgrade (Upgrade all packages)
apt-get autoremove (Remove unnecessary packages)
Mini summary: "apt-get" is the older version of "apt". It is still widely used and has similar functionality.
Definition: You can keep your system clean by removing unnecessary packages and cleaning up cached files.
Why it is important: Over time, your system can accumulate packages that are no longer needed. Cleaning up saves disk space and keeps your system running well.
Simple explanation: Cleaning your system is like cleaning your room to get rid of things you don't need.
Real-life example: sudo apt autoremove removes packages that are no longer needed.
School example: Throwing away old notes after the exam.
Home example: Cleaning out the refrigerator to get rid of old food.
Nigerian example: Clearing out old stock from a shop.
Illustration:
CLEANING YOUR SYSTEM
user@computer:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
libsomepackage1 libsomepackage2
0 upgraded, 0 newly installed, 2 to remove
After this operation, 10 MB disk space will be freed.
Do you want to continue? [Y/n] y
Mini summary: You can keep your system clean by removing unnecessary packages and cleaning up cached files.
Definition: Here are some best practices for using package managers.
Why it is important: Following best practices keeps your system secure and well-maintained.
Simple explanation: Best practices are like rules of thumb that help you do things the right way.
Real-life example: Always update the package list before installing.
School example: Studying regularly instead of cramming.
Home example: Washing your hands before eating.
Nigerian example: Saving money regularly instead of spending it all at once.
Illustration:
BEST PRACTICES
|
+--- Update before install
|
+--- Use trusted repositories
|
+--- Remove unused packages
|
+--- Keep system updated
|
+--- Avoid mixing package managers
|
V
A WELL-MAINTAINED SYSTEM
Mini summary: Following best practices keeps your system secure and well-maintained.
Definition: Package management is an essential skill for any Linux user.
Why it is important: It helps you install, update, and remove software on your system. It is one of the most important things you will do as a Linux user.
Simple explanation: Managing packages is like being the store manager of your own software store. You decide what to stock, what to update, and what to remove.
Real-life example: System administrators use package managers every day.
School example: A student manages their school supplies.
Home example: A parent manages the household pantry.
Nigerian example: A shop owner manages their inventory.
Illustration:
MANAGING PACKAGES
|
+--- Install new software
|
+--- Update existing software
|
+--- Remove old software
|
+--- Keep system clean
|
V
A WELL-MANAGED SYSTEM
Mini summary: Anyone can learn to manage packages with practice. It is a key skill for Linux users.
| Word | Simple Definition |
|---|---|
| Package | A collection of files that make up a software program. |
| Package Manager | A tool that helps install, update, and remove software. |
| Repository | A storage location where packages are kept. |
| apt | The main package manager on Debian-based systems. |
| apt-get | The older version of "apt". |
| dpkg | A low-level package manager for .deb files. |
| .deb | The package format for Debian/Ubuntu systems. |
| Update | To refresh the list of available packages. |
| Upgrade | To install newer versions of packages. |
| Install | To add a new package to the system. |
| Remove | To delete a package from the system. |
| PPA | Personal Package Archive โ a third-party repository. |
UPDATE ---> SEARCH ---> INSTALL ---> USE ---> REMOVE
| | | | |
V V V V V
Get list Find the Add to Run the Delete
of package system program when done
packages
+-------------------+-------------------+
| Command | Action |
+-------------------+-------------------+
| apt update | Update package |
| | list |
| apt install | Install a package |
| apt upgrade | Upgrade all |
| | packages |
| apt remove | Remove a package |
| apt search | Search for a |
| | package |
| apt autoremove | Remove unused |
| | packages |
+-------------------+-------------------+
user@computer:~$ sudo apt install firefox
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed:
firefox
0 upgraded, 1 newly installed, 0 to remove
Need to get 72.0 MB of archives.
After this operation, 200 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
user@computer:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
The following packages will be upgraded:
firefox libc6
2 upgraded, 0 newly installed, 0 to remove
Need to get 80.0 MB of archives.
After this operation, 10 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
user@computer:~$ sudo dpkg -i mypackage.deb
Selecting previously unselected package mypackage.
(Reading database ... 201234 files and directories currently installed.)
Preparing to unpack mypackage.deb ...
Unpacking mypackage (1.0-1) ...
Setting up mypackage (1.0-1) ...
| apt | apt-get |
|---|---|
| Newer and more user-friendly | Older and more traditional |
| Combines common commands | More granular commands |
| Better for interactive use | Better for scripts |
| Example: apt install | Example: apt-get install |
| Progress bar and color | Less visual feedback |
| apt | dpkg |
|---|---|
| High-level package manager | Low-level package manager |
| Handles dependencies | Does not handle dependencies |
| Installs from repositories | Installs local .deb files |
| Example: apt install | Example: dpkg -i |
| Easier to use | More powerful for specific tasks |
A package is a collection of files that make up a software program.
A package manager is a tool that helps install, update, and remove software.
"apt" is the main package manager on Debian-based systems like Ubuntu.
"apt update" downloads the latest list of available packages.
"apt install" installs a software package on your system.
"apt upgrade" upgrades all installed packages to their latest versions.
"apt search" searches for packages that match a keyword.
"apt remove" removes an installed package from your system.
A repository is a storage location where packages are stored.
You can add or remove repositories to access more software or keep your system secure.
"dpkg" is a low-level package manager that can install .deb files directly.
"apt-get" is the older version of "apt" and is still widely used.
You can keep your system clean by removing unnecessary packages and cleaning up cached files.
Following best practices keeps your system secure and well-maintained.
Anyone can learn to manage packages with practice. It is a key skill for Linux users.
Congratulations! You have completed Module Seven: Package Management!
You have learned what a package is and what a package manager does. You now know how to use "apt" to install, update, and remove software. You learned about repositories, how to update the package list, and how to search for packages.
You also learned about "dpkg" for installing .deb files and "apt-get" as an alternative. You learned how to keep your system clean and follow best practices for package management. Package management is a key skill for any Linux user.
In the next module, Module Eight: Networking Basics, you will learn how Linux computers communicate with each other over networks.
Match the command to its action:
| Command | Action |
|---|---|
| 1. apt update | A) Install a package |
| 2. apt install | B) Update package list |
| 3. apt upgrade | C) Remove a package |
| 4. apt remove | D) Upgrade all packages |
| 5. apt search | E) Search for a package |
| 6. apt autoremove | F) Remove unused packages |
Answers: 1-B, 2-A, 3-D, 4-C, 5-E, 6-F
Scenario 1: You want to install a web browser called "firefox". What commands would you use?
Scenario 2: You want to update all the software on your system. What commands would you use?
Scenario 3: You want to remove a package called "oldgame". What command would you use?
Scenario 4: You downloaded a .deb file and want to install it. What command would you use?
Activity: Create a Package Management Guide.
Instructions:
Activity: Practice Package Management.
Instructions:
Project: Create a Package Management Cheat Sheet.
Instructions:
Assignment: Package Management Report.
Instructions:
Challenge: The Package Management Challenge.
Instructions:
Congratulations on completing Module Seven!
In the next module, Module Eight: Networking Basics, you will learn how Linux computers communicate with each other over networks. You will discover:
Get ready to connect to the world!
End of Module Seven ๐
Package management is the key to a well-maintained Linux system!