How to Install Software on Linux?
2014-03-18
2024-10-24
- Software installation is a quandary for many Linux beginners
- What is different from Windows
- Mainly 5 types of installation methods
- Install from repository
- Downloading packages from the internet
- Download a binary file from the Internet
- Build from source
- Using Snaps, flatpac, AppImage, etc.
- How to handle built software with a package manager
- Summary
- Related articles
This article is the English version of the Japanese article titled ‘Linuxにソフトウェアをインストールするには?‘.
(This article was updated on 2024-10-24)
Software installation is a quandary for many Linux beginners
Hello. The theme of this article is “How do I install software on Linux?” This time, we will go back to basics and discuss installing Linux software. I think that many people have switched from Windows to Linux with the end of XP support, and I think that for beginners, installing software is a pretty big hurdle. “How do I install software? I don’t know about tar.gz. Is there no software on freeware sites?” I often hear people say. The confusion may be caused by the fact that there is no “single, fixed installation method” for Linux. I hope you can get a grasp of the overall picture of installation on Linux.
What is different from Windows
If you are a Windows user, you may have experienced downloading an installation file called hogehoge.exe from a site such as “Vector” and clicking it to automatically start the installation. Or, when you download a Zip file and unzip it, it is not uncommon to find a hogehoge.exe icon inside, and clicking on it will launch the application.
However, exe files cannot be used in Linux in the first place. And, for example, when you go to a site to download something, you will encounter a phenomenon where you have a lot of files with extensions like
- hogehoge.deb
- hogehoge.rpm
- hogehoge.tar.bz2
but you don’t know what to download. Let’s organize how to install apps on Linux here.
Mainly 5 types of installation methods
If you remember the following 5 types of software installation on Linux, you will not have any problems in most cases.
- Install packages from official and third-party repositories
- Install packages distributed in formats such as DEB and RPM
- Install distributed binary files
- Build and deploy from source code
- Install distribution-independent packages such as Flatpak and AppImage
※Corrected and added on 2018-12-27. Descriptions about Snaps, flatpak, and AppImage, which have recently been put into practical use, have been added to the 5th type.
Install from repository
This is the basic approach for recent Linux. In other words, all the software you need is available in the official repository, so there’s no need to download it from “Vector” or “Mado no Mori”! The package manager will search for packages in the repository and install them automatically. Packages (software) installed in this way will be automatically updated when the package in the repository is updated, and they are very easy to remove.
When there is software you want to use, you should first look for it in the official repository. If it is not officially available, it is also a good idea to consider adding a third-party repository. The commands and GUI interface are used differently for each package manager. Package managers are also called different names depending on the distro and desktop environment. (This is confusing…) Please refer to the reference article below to try using a package manager.
Reference article: A collection of Linux package managers
■Example commands for each distribution
[Installation]
# apt install hogehog (Ubuntu, Debian)
# yum install hogehoge (Fedora)
# pacman -S hogehoge (Arch Linux)
# zypper install hogehoge (OpenSUSE)
[Remove packages]
# apt remove hogehog (Ubuntu, Debian)
# yum remove hogehoge (Fedora)
# pacman -Rs hogehoge (Arch Linux)
# zypper remove hogehoge (OpenSUSE)
Downloading packages from the internet
Packages that cannot be added to the official repository may be distributed as Deb or rpm files on the website (such as drivers for peripheral devices). The advantage of distributing packages is that they can be installed and removed using a package manager. However, since they are not in the repository, the package manager will not automatically update them.
An example command is shown below.
When installing a DEB package
$ sudo dpkg -i hogehoge.deb
$ sudo gdebi hogehoge.deb
(When installing with dependency checking)
When installing an rpm package
$ sudo rpm -ivh hogehoge.rpm
$ sudo yum localinstall hogehoge.rpm --nogpgcheck
(When installing with dependency checking)
When removing a DEB package
$ sudo dpkg -r hogehoge
$ sudo apt-get remove hogehoge (recommended)
When removing an rpm package
$ sudo rpm -e hogehoge
$ sudo yum remove hogehoge (recommended)
Download a binary file from the Internet
This method is often used for software whose source code is not publicly available or that has licensing issues. Let’s take Skype as an example. Download the skype-4.2.0.13.tar.bz2 file from the official website.
This is not a deb or rpm package, so you cannot use the package manager to install it. Let’s unzip it with the following command and take a look at the contents.
$ tar -jxf skype-4.2.0.13.tar.bz2
These binary files are inside.
Read the contents of the README file and copy it to your own directory to install it.
*Note: Skype is available as a Deb file or rpm file, and is included in the repository of major distributions, so this method is just an example.
Build from source
For beginners, this method is not necessary. However, a long time ago, installing Linux meant building the source yourself. If you use a major distro, the maintainer will build it and upload it to the repository, so we just have to take advantage of that.
However, if it is not in the repository or the package is not distributed online, you will have to build and install it yourself. For example, let’s say you downloaded a source file called hogehoge.tar.bz2. In many cases, there is a description in the README or INSTALL file in the package, but generally, you build and install it with the following command.
Example of building a general source code
$ tar -jxf hogehoge.tar.bz2
$ cd hogehoge
$ ./configure
$ make
# make install
Some programs can be removed by executing the following command.
# make uninstall
However, I do not recommend this for beginners. This is because it is extremely difficult to remove while keeping the system clean. Please refer to IT Enterprise’s article for more information.
Using Snaps, flatpac, AppImage, etc.
(Added 2018-12-27)
In recent years, new installation methods have become available in addition to the four above. Package management using virtualization such as Snaps and flatpak, and a technology called AppImage for making applications portable, have become more readily available, so we will add them to this section. These methods are easier to implement and manage than the methods above. For information on new package management, please refer to 過去から振り返るLinuxの次世代パッケージ管理の話(Japanese only).
How to handle built software with a package manager
So, how can you install and remove software built from source in the same way as other packages? The answer is simple. Just create your own package. I have written an article about creating your own DEB packages for Debian/Ubuntu, so please refer to Debian/Ubuntu向けのDEBパッケージ自作に関する記事(Japanese only).
Summary
We have looked at installing and deleting packages, which are essential when using a Linux distribution. Each distribution has a different package management method, and this complexity may be causing some confusion for users when using Linux. After understanding the contents of this article, it is recommended that you basically install and delete packages using the package manager of your distribution. I hope this article will be useful in your Linux life.
Related articles
There are only articles in Japanese.