• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to enable or disable repositories in CentOS

2478

To enable or disable repositories in CentOS

This tutorial describes how to enable or disable a single or group of YUM repositories while installing software on CentOS. Sometimes, having them already enabled in your system will help you save a lot of time. This tutorial tests the same process on CentOS 7 server. 

 

Enabling or disabling repositories 

First, you need to check the repo list which you can do by making use of the following command. 

[root@linuxhelp ~]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.vinahost.vn
.
updates/7/x86_64 CentOS-7 - Updates 1,676
repolist: 21,883

We can enable or disable repositories in two ways.
Temporarily enable or disable repositories while installing packages using ‘ yum’  command
Permanently Enable/Disable repositories using repository configuration file


To disable multiple repository, just include the repository separated by comma

[root@linuxhelp ~]# yum --disablerepo=remi-safe,updates update
[root@linuxhelp ~]# yum --disablerepo=remi-safe,updates update
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
.
Complete!


You can use method to install a package too.

[root@linuxhelp ~]# yum --disablerepo=remi-safe,updates install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
.
Installed:
  httpd.x86_64 0:2.4.6-67.el7.centos                                                                                

Complete!

 

Similarly, you can both enable and disable a particular repositories at a time with ‘ yum’ command.

[root@linuxhelp ~]# yum --disablerepo=* --enablerepo=epel 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: mirror.pregi.net
No packages marked for update
You can also permanently enable or disable a repository. Usually, the repository configuration files will be saved in the /etc/yum.repos.d/ directory.


Let us see the available repositories using the following command.

[root@linuxhelp ~]# ls /etc/yum.repos.d/
CentOS-Base.repo       CentOS-fasttrack.repo  CentOS-Vault.repo  remi-php54.repo  remi-php72.repo
CentOS-CR.repo         CentOS-Media.repo      epel.repo          remi-php70.repo  remi.repo
CentOS-Debuginfo.repo  CentOS-Sources.repo    epel-testing.repo  remi-php71.repo  remi-safe.repo


To do so, edit EPEL repository file:

[root@linuxhelp ~]# vi /etc/yum.repos.d/epel.repo
Change the value enabled=1 to 0 (zero).
epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7& arch=$basearch
failovermethod=priority
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7


Save and close the file. Update the repository lists to take effect the changes.

[root@linuxhelp ~]# yum repolist 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
.


With this, the tutorial comes to an end.  

Tags:
connor
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

How to remove the repository on Ubuntu?

A

For remove the repository on Ubuntu, use the following link as given below, https://www.linuxhelp.com/how-to-remove-repositories-on-ubuntu-16-04/

Q

How to Configure a network repository?

A

To configure the network repository, use the following link as given below "https://www.linuxhelp.com/installupdate-packages-setup-network-repository/"

Q

How to enable the Remi repository on centos?

A

To enable the Remi repository on CentOS, use the following steps as below,
"yum install epel-release -y
cd /usr/local/src/
wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh Remi-release-7.rpm"

Q

How to check the available repository list on CentOS?

A

For check, the available repository list on CentOS, use the following command as given below "yum repolist"

Q

How to disable a repository on CentOS?

A

For disable the repository on CentOS, use the following command as given below "yum-config-manager --disable repository..."

Related Tutorials in How to enable or disable repositories in CentOS

Related Tutorials in How to enable or disable repositories in CentOS

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How to enable or disable repositories in CentOS

Related Forums in How to enable or disable repositories in CentOS

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019
OpenVAS
frank class=
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Dec 20, 2018
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Lucas ?
Various options in Top command

Am using Top command only to view the load average, what are the various options in Top command..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.