Every computer and mobile device uses some form of software to perform a particular task. For the last decade or so, software were being released on the internet with proper version in order to keep track features and updates. So in case of new release a new package with version were used to be update on websites. These days many individual application has its own updater component which prompt user about latest updates and upgrades itself automatically. ITunes App Store, Windows 10 App Store and Google Play Store are also modern example of software repository.
What is a package?
A packages is a collection of pre-compiled binaries, configuration files together into a single archive file for easier portability and storage, or simply compress files to reduce size. Packages also contain metadata, such as the software’s name, a description of its purpose, a version number, and a list of dependencies necessary for the software to run properly.
Each Linux distribution have created their own package formats. Some of the most commonly used package formats include:
- deb is used by Debian, Ubuntu, Linux Mint, and other distro’s based on Debian.
- rpm is used by Red Hat, Fedora, SUSE.
- tar.xz is used by Arch Linux.
What is a package manager?
A package manager or package management system is a repository of software tools that perform the process of installing, updating, configuring, and uninstalling software on operating system without the need for manual installs and interaction in a very consistent manner. More importantly it resolve dependencies required to run those programs itself. If you are a user with Linux background there’s a good chance you’ve used package manager to install programs. Linux was first OS which started the practice of maintaining a centralized where users could find and install software followed by Mac OSX while Windows have Windows Installer but with a GUI rather than command line. Package managers generally serve several functions:
- Searching for software
- Installing software
- Upgrading software
- Uninstalling software
Advantage of package manager
Setting up new computer regularly is a time consuming exercise as download links are changing and managing dependencies of each software requires a painful effort. So package manager came to rescue you can install software with it without worrying about dependencies and versioning problems.
Here are some famous package manager for Windows, Mac and Linux.
Windows user are most of the time using windows installer to install software from the internet using multi step installation wizard which require user to click on each of the step to complete installation but now getting inspired from Linux and Mac there is a Windows package manager that has been gaining in popularity Chocolatey.
Chocolatey gives you ability to start unattended installation where you just enter commands and sit back as you do no need to interact as you would have to do with GUI installer. You can view list of all packages available on Chocolatey here.
Once installed, you can run Chocolatey with the
choco install googlechrome
Homebrew is a popular free and open-source software package management system with millions of software in its repository for Apple’s macOS operating system. Homebrew is written in Ruby and pre-installed in most of mac operating system.
You can install homebrew via terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After installation, you can install any package from Homebrew by just simple running:
brew install [package name]
Where [package name] is the name of the package. you can find list of packages available on homebrew here. For example you can install git on mac OS
brew install git
You can also install desktop applications via Homebrew Cask, such as:
brew cask install google-chrome
In case of Linux, your package manager will depend on your Linux distribution as Debians, Red Hat, CentOS, but there are several famous ones.
APT (Advanced Package Tool)
APT is the command line tool to interact with the dpkg packaging system for Debian and Ubuntu (Ubuntu is derived from Debian) distribution of Linux. It helps you install millions of programs and applications available on dpkg for installation on Debian. APT actually works on a database of available packages so in case if you are unable to find new packages you can use update command to update database for new packages. You can find list of packages available here.
sudo apt update
When you run above command, packages database will get updates from various servers. Here are some apt commands mostly used:
To Installs a new package you can use this command
sudo apt install <package name>
Replace <package name> with desired package you can also install multiple packages with single command as well like this
sudo apt install <package 1> <package 2> <package 3>
YUM (Yellowdog Updater, Modified) is a another package manager for RPM-based Linux distributions such as CentOS, Red Hat, and Fedora. it works like same as APT.
To Installs a new package you can use this command
yum install <package name>
Replace <package name> with desired package it will get that package on your system.
Here are some notable package manager available
- DNF – Dandified Yum for Fedora
- Pacman Package Manager for Arch Linux
- Zypper Package Manager for OpenSUSE
- Portage Package Manager for Gentoo