How to install softwares in linux

Always think in Positive. Even you are in a hell, don’t give up

Guys, we are going to learn about the Package installation in Linux systems from this article. Basically how to install a package ( a package is  simply same as a software in a windows environment) and uninstalling it, what is a repository, how to create/enable/disable a repository, how the package installation commands change with different Linux distributions and so on.

What is a Package ?

Basically a package is a software application in a Linux operating system. Same as in windows and Mac OS, in Linux also we can install a software in a GUI environment as well as with the command line interface.

What is a Package manager ?

There are different package managers for different Linux distributions. It is very important to remember how to use different package installation commands in a Linux system. As we all know in a windows OS, we have softwares ending with .exe extension. But in Linux, the extensions may be different. It can be having an extension like .rpm, .deb or whatever.  Actually the package manager is serving as tool which access the softwares and installing/removing/modifying them.

dpkg is used by Debian, Ubuntu and apt is also supported.
rpm is used by Red Hat, Cent OS and yum is also supported.

* Important – You should be a superuser to install packages. 

So, for here testing i’m taking two AWS EC2 Linux servers ( Ubuntu and a Red Hat ). We will take one by one.

To get to know which Linux distribution you are using, try the below command,

cat /etc/*-release

We can find the linux distribution with the command cat /etc/*-release
Yum package manager

What is yum ? Yum is a command we can use to get the packages installed in a Red Hat, Cent OS environments. Yum is using repositories to search and install the applications.

What are Repositories ?

Red Hat or third party repositories are used as the software sources. In a repo we include links where the package managers can search for the packages.

Simply a repository looks like below.

All the yum repolists can be found in /etc/repos.d/ path.

All repositories resides in the path “/etc/yum.repos.d“. The configuration file for yum is “/etc/yum.conf“.

From here, we will check the useful command we need to know.

1) yum repolist ( This command will list your active repositories )

yum repolist

2) yum repolist all ( This will list all of your repositories even it is enabled or disabled )

yum repolist all

3) yum list installed ( This will list all your installed packages )

4) yum list vim* ( This will list installed and available packages which suits for package name )

yum list

5) yum search vim ( This also searches with package names )

yum search

yum search all <package name> ( This gives more details than above )

6) yum info vim* ( This will display information about all the packages that suits the given name )

We can identify different parts in a package as below.

eg – vim-minimal.x86_64 : A minimal version of the VIM editor

vim-minimal – Package name
x86_64 – Architecture
*Sometimes we can see package version also with the names.
7) yum provides <path name> ( This shows packages which contains the mentioned path names ). Not only path names, we can use application names also if we are not sure to check.
eg – yum provides tree
yum provides
yum provides /var/www/html
8) yum install httpd ( This will install httpd package into the system )
yum install
yum install httpd -y ( This command will install the package without asking for entering yes or no at the end. )
9) yum update <package name> ( This will update the package to the latest version. )
10) yum remove <package name> ( This will uninstall the installed package )
11) yum list kernel ( This will display installed and available kernel software versions )
yum list kernel
yum update kernel ( This will update the kernel to the latest version )
12) How to create a new repo
 
Go to the file location – /etc/repos.d
create your new repo – example.repo
* Important – All the repository files have the extension of .repo )
 
creating a new yum repository
 
[examplerepo] – repo id
Example Repolist – repo name
baseurl – source url
enabled – status of the repo ( can be enabled or disabled )
Apt package manager
 
Apt package manager is used in Ubuntu and Debian like Linux distributions.  Below listed commands would be helped.
apt actually works on a package database. The system will not know about is there are updates for the packages, if the package database is not updated. Because of this updating the package database is essential.
1) apt-get update ( This command will update the package database )
2) apt-get upgrade ( This will upgrade all the software to the latest version. )
3) apt-get install <package name> ( This will install the package )
4) apt remove <package name> ( This will remove the package binary file except configs)
5) apt purge <package name> ( This will remove all files with the configuration files related to the package )
6) apt show <package name> ( Display information about the package )
7) apt list <package name> ( list the packages with the given name )
So, guys here are some of the basic very useful commands as in the above. You could know more than these commands with the usage.
Other resources :
Cheers.

Leave a Reply