One of the issues that continue to cause problems for newcomers to Linux or users with less knowledge is the installation of packages or how to install programs in Linux. This has been partly solved with tools like YaST, Software Center, Pi Store, and other programs to automate Linux installations like Gdebi, Synaptic, etc.
But when we download software packages that are not in the repositories of our distribution or we want to install programs in Linux with a different version than the one provided by the sources of our distro, things get more complicated. Especially when the downloaded packages are tarballs with source code.
In Windows, with Windows Installer everything is much easier, also there are no too many extensions binaries to install (.exe, .bat, .msu). Those who come from the Apple platform will also have noticed that the Mac OS X .dmg has too many extensions.
Another lurid topic in Linux (and other * nix) are dependencies, that is, packages that depend on other packages and if the latter are not installed we will not be able to install the first one. In this case, there are a multitude of package managers that make life easier and automatically resolve dependencies. Otherwise we would have to solve them ourselves manually.
With these tutorial I intend that all this is something more trivial for you and does not pose a problem when installing programs in Linux. In the following lines we are going to describe all the most popular extensions and types of packages that exist in the Linux world and the procedure to install them in a simple way.
Table of Contents
- 1 .Deb and .rpm packages:
- 2 Other package managers on your distro:
- 3 How to install tarballs:
- 4 How to install binary packages:
- 5 How to install scripts:
- 6 Others:
.Deb and .rpm packages:
Linux is divided into two great worlds and packages represent it very well DEB and RPM. The first is used by Debian and derivatives like Ubuntu, while the second is used by SuSE, Fedora, and others.
If you are in Novell SuSE or in openSuSE, you can use YaST to install packages of this type. To do this, you just have to go to the SuSE menu, click on "System", "YaST" and then go to the option "Install / uninstall software". So we can install programs in Linux from the DVD of your distro or from the network.
If we already have the package downloaded, we can right-click on it and it will give us the option to Install. Very easy…
If we want to do it from the console instead of YaST uses Zypper:
zypper install nombre_programa
In Red Hat more of the same ... On the other hand, if you have Fedora or CentOS, you can use YUM. Let's go first with YUM, that from the directory where the package is located, in the terminal you must write:
yum install nombre_paquete
And if there is a common tool to install RPM It is the rpm itself present in many distributions that are based on this type of package:
rpm –i nombre_paquete.rpm
In Mandriva you can use the Mandriva Control Center to install programs or RPMDrake. You can also use in text mode
urpm –i nombre_paquete.rpm
In Ubuntu, you can use the simple Ubuntu Software Center to install packages from the official repositories. From Debian it can also be installed with gdebi-gtk, graphically and easily or with Synaptic, these also work on other distros, you just have to install them.
Another interesting tool is Dselect, also in graphic mode to handle packages easily. But for those who pull the console more, you can use dpkg or apt (remember to prefix sudo or work with root privileges):
Dpkg –i nombre_paquete.deb
Apt-get install nombre_paquete
Aptitude is another fairly complete tool that you can use by typing the following:
aptitude install nombre_paquete
Other package managers on your distro:
Arch Linux and derivatives employ a package manager named pacman. It was created by Judd Vinet and is capable of automatically resolving dependencies. To install a package with this manager:
pacman –S nombre_paquete
Portage is another of the great package managers for example Gentoo. It has similarities to BSD Ports and is compatible with POSIX and the python environment. It is also used by FreeBSD. To install a package with it:
paldo It is a Linux kernel operating system that uses an upkg package manager. It was created by Jürg Billeter and to install programs in Linux with him you must write:
The Pardus Linux distro uses a simple package manager written in Python and known as PiSi. It uses LZMA and XZ to compress the packets and especially the Delta technology is striking, which allows downloading only the differences between the packets to save bandwidth. Install like this:
pisi install nombre_paquete
How to install tarballs:
Packages that are installed directly from source are packaged with the primitive, but still useful and efficient, Tar tool (hence the name tarball) and are then compressed using some kind of compressed format.
Some packages of this type come with files inside such as .jar, .bin, .rpm, ..., in that case you just have to unpack and use the correct procedure for the binary it contains. But usually it is source code to be compiled and installed.
Let's see how. The first thing, when we work from the console, is to place ourselves in the directory where the package we want to work with is located. For this we use the tool "cd”. For example, if you have downloaded a package and you have it in the Downloads folder, type in the terminal:
And the prompt it will change with that path to indicate that you are inside this system directory. You should also remember that you need privileges to execute certain actions like ./configure, make, or make install… which we will see next.
Install tar.gz or tgz:
These types of tarball are widely used in Slackware and derivatives, although it has been extended to package code for the rest of the distributions. Installing tar.gz is like this (remember to run ./configure, make and make install with privileges, you know, as root or by prepending sudo to the command ...):
cd directorio_donde_se_encuentra_el_tarball tar –zxvf nombre_paquete.tar.gz (o nombre_paquete.tgz, en caso de ser un .tgz) cd nombre_paquete_desempaquetado ./configure make make install
If this didn't work To install tar.gz, you can access the unpacked directory to check if there is a text file with the instructions to install it. Sometimes, when they do not follow this standard procedure, developers include these types of files to explain the particularities, dependencies, etc.
Tar.bz2 or .tbz2:
It is a very used package in BSD and that has also spread to Linux and other * nix. It is packaged with tar and compressed using BSD Zip 2. The procedure to install this type of program is:
cd directorio_donde_se_encuentra_el_paquete tar –jxvf nombre_paquete.tar.bz2 (o nombre_paquete.tbz2, e incluso nombre_paquete.tbz) cd nombre_directorio_desempaquetdo ./configure make make install
This should suffice to install programs on Linux. Make sure you use privileges for the latest commands.
Other Tape Archive:
Sometimes a tape archive or uncompressed tar file. This type of package maintains the information necessary to fully restore the files it contains and to unpack it, you just have to do this:
tar xvf nombre_paquete.tar
Then look for a file with name README.txt (or similar) inside the unpacked directory and look for the installation instructions. Normally it is about doing a procedure similar to the previous ones ...
Tar.xz or .xz or .txz:
Lately I'm seeing more of this guy. To operate with this type of package you must have the tool xz-utils installed. To unpack and install them, use:
tar Jxvf nombre_paquete.tar.xz
Xz –d nombre_paquete.tar.xz Tar –xf nombre_paquete.tar
And once unzipped, a file is searched README.txt or INSTALL.txt to see the details of the installation, which is usually typical ./configure, make, and make install. Although sometimes cmake can be used.
.gz or .gzip or .bzip2:
With GNU Zip packages of type .gz or .gzip can be compressed. These are treated similarly to BSD Zip 2 compressed packages with .bzip2 extension. To deal with this type of packages, we must have the unzip and bunzip2 tools available in our system:
gunzip –c nombre_paquete.gz bunzip2 nombre_papuete.bz2
The rest is similar to the steps seen with the previous tarballs ... Make sure you see the README or INSTALL files present.
Whether it appears by its long name, .tar.lzma, or if it appears by its short name .tlz, these packages use the Lempel-Ziv-Markov compression algorithm and to extract and install them, you must type in the console (previously you need have the lzma package installed):
lzma -d file.lzma
tar --lzma -xvf file.tlz
tar --lzma -xvf file.tar.lzma
Depending on the format in which the package is presented to us. Then you can look at some text file inside with instructions or follow the steps we have described to install the other tarballs (./config, make, make install). Another good practice is to look at the developer's website, where there are tutorials on how to install the packages or there are Wiki sites with lots of information.
* Note: you can also install certain packages packaged with a tool called installpkg.
How to install binary packages:
To install java packages it's pretty straightforward. The requirements are obvious, to have the Oracle Java virtual machine installed (either the JRE or JDK). To install it we must click with the right mouse button on it and select "Open with another application”From the drop-down menu. A window will appear with a list of applications in our system and a form line below to write one. Well, in that space you write “java –jar "Without quotes, including the space after jar that I have left. Then you click on the button "Open”And it should run without a problem. As you can see, it is not necessary to install it.
We can execute them by double clicking on them to open them, if we have previously given it execution permissions. To do this, click with the right mouse button on the file and then go to "Properties”To assign execution permissions in the tab«Excuse mes ». It can also be installed from the console by doing the following:
cd directorio_donde_está_el_binario ./nombre_binario.bin
For .run we will proceed in a similar way to the .bin. This format is widely used for drivers, such as the AMD Catalyst Center. To install it you can use the console:
cd directorio_donde_está_el_paquete sh ./nombre_paquete.run
Remember to assign execution permissions beforehand. Also, some need to be run with privileges, in which case do it as root or with sudo.
If you want to install the .run in graphics mode, you can right-click on it and select "Properties", Then in the tab"Permissions"Brands"Allow to run the file as a program”And you accept to close. Now when you double click on the .run you will see that an installer very similar to the ones in Windows opens (type Next, Next, OK…).
How to install scripts:
In Linux we can also find scripts with .sh or .py extensions. To install this type of scripts we will go to the directory where the script is found with the command "cd" as we have seen previously. Eye! If the script is packaged, first unpack or unzip it. Then, you can give it execution permissions as you already know (you can do it in graphical mode or from the terminal with the command “chmod + x script_name" without quotation marks). Once they have execution permissions, from the terminal:
For files with extension .py the Python programming language interpreter must be called. To do this, type in the console this:
python nombre_script.py install
There are other types of files and packages to install programs in Linux. Certain packages from BSD, Solaris, Mac OS X, and other * nix can be installed on Linux. An example of this are the Solaris .pkg. To install the .pkg you can click on them with the right mouse button, go to “Properties"And"Permissions”And assign execute permissions to it. Then you double click on them to install them.
There are also tools like Alien to convert from one format to another, for example from rpm to deb, etc. This is not highly recommended and can sometimes cause problems. So I do not recommend it.
Continuing with the Linux package gibberish, to say that there are more than those seen here, but they are more rare and unusual. An example of rarity is the .slp they use from the Stampede Linux project. To transform .slp into other more everyday formats you can use Alien (previously installed Alien) like this:
sudo alien nombre_paquete.slp nombre_paquete.extensión_nueva generated
E.g., to transform from .slp to rpm:
sudo alien miprograma.slp miprograma.rpm generated
You can leave your comments with requests, doubts or comments. If you have any problems following the steps in this tutorial, I will be happy to help you.