Command in linux to install packages

How to install software from the Linux command line

A guide to packing and preparing for a tech conference

If you use Linux for any amount of time, you’ll soon learn there are many different ways to do the same thing. This includes installing applications on a Linux machine via the command line. I have been a Linux user for roughly 25 years, and time and time again I find myself going back to the command line to install my apps.

The most common method of installing apps from the command line is through software repositories (a place where software is stored) using what’s called a package manager. All Linux apps are distributed as packages, which are nothing more than files associated with a package management system. Every Linux distribution comes with a package management system, but they are not all the same.

What is a package management system?

A package management system is comprised of sets of tools and file formats that are used together to install, update, and uninstall Linux apps. The two most common package management systems are from Red Hat and Debian. Red Hat, CentOS, and Fedora all use the rpm system (.rpm files), while Debian, Ubuntu, Mint, and Ubuntu use dpkg (.deb files). Gentoo Linux uses a system called Portage, and Arch Linux uses nothing but tarballs (.tar files). The primary difference between these systems is how they install and maintain apps.

You might be wondering what’s inside an .rpm , .deb , or .tar file. You might be surprised to learn that all are nothing more than plain old archive files (like .zip ) that contain an application’s code, instructions on how to install it, dependencies (what other apps it may depend on), and where its configuration files should be placed. The software that reads and executes all of those instructions is called a package manager.

Читайте также:  System calls in linux and windows

Debian, Ubuntu, Mint, and others

Debian, Ubuntu, Mint, and other Debian-based distributions all use .deb files and the dpkg package management system. There are two ways to install apps via this system. You can use the apt application to install from a repository, or you can use the dpkg app to install apps from .deb files. Let’s take a look at how to do both.

Installing apps using apt is as easy as:

$ sudo apt install app_name

Uninstalling an app via apt is also super easy:

To upgrade your installed apps, you’ll first need to update the app repository:

Once finished, you can update any apps that need updating with the following:

What if you want to update only a single app? No problem.

Finally, let’s say the app you want to install is not available in the Debian repository, but it is available as a .deb download. You can install it manually using dpkg , the system that apt helps manage:

RHEL, CentOS, Fedora, Mageia, and OpenMandriva

Red Hat, its upstream project Fedora, and its «midstream» project CentOS, use the dnf package manager. It has its own syntax, and is a front-end to the RPM system. Although the syntax is different, dnf is similar to apt in the sense that the mechanisms and goals are the same. The Mageia and OpenMandriva distributions, once focused exclusively on urpmi for package management, now also includes dnf in their distributions.

The dnf package manager is the successor to the previous yum command. The yum had a long time to engrain itself in the minds and servers of users, so to avoid breaking custom scripts that have been around on users’ systems for over a decade, yum and dnf are now interchangeable (in fact, yum is now based on dnf .)

$ sudo dnf install app_name

Removing unwanted applications is just as easy.

Читайте также:  Проверка существования email linux

The dnf (or yum ) command is a front-end for the RPM packaging system. If you can’t find an app in your software repository but you can find it for download directly from its vendor site, you can use dnf to manually install an .rpm file.

$ sudo dnf install ./app_name.rpm

As you can see, installing, uninstalling, and updating Linux apps from the command line isn’t hard at all. In fact, once you get used to it, you’ll find it’s faster than using desktop GUI-based management tools!

For more information on installing apps from the command line, please visit the Debian Apt wiki, the Yum cheat sheet, and the DNF wiki.

Источник

How do I install a .deb file via the command line?

Packages are manually installed via the dpkg command (Debian Package Management System). dpkg is the backend to commands like apt-get and aptitude , which in turn are the backend for GUI install apps like the Software Center and Synaptic.

Something along the lines of:

dpkg —> apt-get , aptitude —> Synaptic, Software Center

But of course the easiest ways to install a package would be, first, the GUI apps (Synaptic, Software Center, etc..), followed by the terminal commands apt-get and aptitude that add a very nice user friendly approach to the backend dpkg, including but not limited to packaged dependencies, control over what is installed, needs update, not installed, broken packages, etc.. Lastly the dpkg command which is the base for all of them.

Since dpkg is the base, you can use it to install packaged directly from the command line.

Читайте также:  Usb stick formatter linux

Install a package

For example if the package file is called askubuntu_2.0.deb then you should do sudo dpkg -i askubuntu_2.0.deb . If dpkg reports an error due to dependency problems, you can run sudo apt-get install -f to download the missing dependencies and configure everything. If that reports an error, you’ll have to sort out the dependencies yourself by following for example How do I resolve unmet dependencies after adding a PPA?.

Remove a package

For example if the package is called askubuntu then you should do sudo dpkg -r askubuntu .

Reconfigure an existing package

sudo dpkg-reconfigure PACKAGE_NAME 

This is useful when you need to reconfigure something related to said package. Some useful examples it the keyboard-configuration when you want to enable the Ctrl + Alt + Backspace in order to reset the X server, so you would the following:

sudo dpkg-reconfigure keyboard-configuration 

Another great one is when you need to set the Timezone for a server or your local testing computer, so you use use the tzdata package:

sudo dpkg-reconfigure tzdata 

Источник

Оцените статью
Adblock
detector