yum repository

Yum repositories are like websites that you can download software from. Yum has default repositories to download packages so you do not need to configure repos to use yum to install/upgrade packages on your system. But that is not enough. Some packages do not exist on default repositories,then you need to add new repositories to install software from those repos. The most needed repo is epel - Extra Packages for Enterprise Linux 7. You can enable it using

Some packages do not even exist on epel such as php7 on centos7. CentOS7 only has php 5. To install php7 on CentOS7, you need to add a new repo called remi repo.

How to add the remi repository? To add a new yum repo, Redhat’s official document says you should use the command “yum-config-manager –add-repo repository_url”.  But other posts say you should use the following command:

In fact, this command will install a bunch of new repos and their CPG Key files on your system:

Every .repo file in /etc/yum.repos.d/ directory  means a new yum repository. The repo directory is specified as the reposdir option  in /etc/yum.conf. But using the “yum repolist” command, you can see only one remi repository:

That is because the “yum repolist” command only shows the enabled repositories. To see all installed repos, you need to use “yum repolist all”.  You can see most repos on your system are disabled. To enable a repository, you need to issue the following command:

The above command enables the remi-php74 repository.  You can check the file /etc/yum.repos.d/remi-php74.repo to verify the repo is indeed enabled: there is a line “enabled=1″ under the [remi-php74] section. With the remi php7 repo enabled, you can install the php7 packages from that repo now:

Yum will download packages from http://cdn.remirepo.net/enterprise/7/php74/mirror (specified as the mirrorlist option under the [remi-php74] section in /etc/yum.repos.d/remi-php74.repo), then install them on your system. The downloaded packages are also cached in /var/cache/yum/. You can clear the cache using:




Posted in tips of hosting