In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to add, enable and disable a warehouse in CentOS". In daily operation, I believe many people have doubts about how to add, enable and disable a warehouse in CentOS. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the questions of "how to add, enable and disable a warehouse in CentOS". Next, please follow the editor to study!
On RPM-based systems such as RHEL, CentOS, etc., many of us use the yum package manager to manage software installation, removal, update, search, and so on.
Most of the software in the Linux distribution comes from the official repository of the distribution. The official warehouse contains a large number of free and open source applications and software. It is easy to install and use.
Due to some limitations and proprietary issues, RPM-based distributions do not provide some packages in their official repository. In addition, for the sake of stability, it will not provide the core package of the * version.
In order to overcome this situation, we need to install or enable the required third-party warehouse. For RPM-based systems, there are many third-party repositories available, but few repositories are recommended because they do not replace a large number of base packages.
This can be done on RPM-based systems such as RHEL, CentOS, OEL, Fedora, etc.
Fedora systems use dnf config-manager [options] [section...]
Other RPM-based systems use yum-config-manager [options] [section...]
How to list enabled warehouses
Simply run the following command to check the list of warehouses enabled on the system.
For CentOS/RHEL/OLE systems:
# yum repolistLoaded plugins: fastestmirror SecurityLoading mirror speeds from cached hostfilerepo id repo name statusbase CentOS-6-Base 6706extras CentOS-6-Extras 53updates CentOS-6-Updates 1255repolist: 8014
For Fedora systems:
# how to add a new warehouse to the system by dnf repolist
Each warehouse usually provides its own .repo file. To add such a warehouse to the system, run the following command using the root user. EPEL repositories and IUS community repositories will be added in our example, see below.
But no .repo file is available for these repositories. Therefore, we use the following methods for installation.
For the EPEL repository, because it is available from the CentOS additional repository, run the following command to install it.
# yum install epel-release-y
For the IUS community repository, run the following bash script to install.
# curl 'https://setup.ius.io/'-o setup-ius.sh# sh setup-ius.sh
If you have a .repo file, in RHEL/CentOS/OEL, simply run the following command to add a repository.
# yum-config-manager-- add-repo http://www.example.com/example.repo Loaded plugins: product-id, refresh-packagekit, subscription-manageradding repo from: http://www.example.com/example.repograbbing file http://www.example.com/example.repo to / etc/yum.repos.d/example.repoexample.repo | 413B 00:00repo saved to / etc/yum.repos.d/example.repo
For Fedora systems, run the following command to add a warehouse:
# dnf config-manager-- add-repo http://www.example.com/example.repoadding repo from: http://www.example.com/example.repo
If you run the yum repolist command after adding these repositories, you can see the newly added repositories. Yes, I see it.
Note: whenever you run the yum repolist command, the command automatically gets updates from the appropriate repository and saves the cache on the local system.
# yum repolist Loaded plugins: fastestmirror SecurityLoading mirror speeds from cached hostfileepel/metalink | 6.1 kB 0015 00* epel: epel.mirror.constant.com* ius: ius.mirror.constant.comius | | 2.3 kB 00:00repo id repo name statusbase CentOS | -6-Base 6706epel Extra Packages for Enterprise Linux 6-x86 "64 12505extras CentOS-6-Extras 53ius IUS Community Packages for Enterprise Linux 6-x86 "64 390updates CentOS-6-Updates 1255repolist: 20909
Each warehouse has multiple channels, such as Testing, Dev, Archive, and so on. You can better understand this by navigating to the warehouse file location.
# ls-lh / etc/yum.repos.dtotal 64K Apr Apr 02:44 CentOS-fasttrack.repo-rw-r--r-- 1 root root 630 Apr 12 02:44 CentOS-Media.repo-rw-r--r-- 1 root root 12 02:44 CentOS-Base.repo-rw-r--r-- 1 root root 647 Apr 12 02:44 CentOS-Debuginfo.repo-rw-r--r-- 1 root root 289 Apr 12 02:44 CentOS-fasttrack.repo-rw-r--r-- 1 root root 630 Apr 12 May 18 11:07 CentOS-SCLo-scl.repo-rw-r--r-- 1 root root 892 May 18 10:36 CentOS-SCLo-scl-rh.repo-rw-r--r-- 1 root root 6.2K Apr 12 02:44 CentOS-Vault.repo-rw-r--r-- 1 root root 7.9K Apr 12 02:44 CentOS-Vault.repo.rpmnew-rw-r--r-- 1 root root 957 May 18 10:41 epel.repo-rw-r--r- -1 root root 1.1K Nov 4 2012 epel-testing.repo-rw-r--r-- 1 root root 1.2K Feb 23 2017 ius-archive.repo-rw-r--r-- 1 root root 1.2K Feb 23 2017 ius-dev.repo-rw-r--r-- 1 root root 1.1K May 18 10:41 ius.repo-rw-r--r-- 1 root root 1.2K Feb 23 2017 ius-testing.repo how to enable a warehouse in the system
When you add a new repository by default, it will enable their stable repository, which is why we get the warehouse information when we run the yum repolist command. In some cases, if you want to enable their testing, development, or archiving repositories, use the following command. In addition, we can use this command to enable any disabled warehouse.
To verify this, we will enable epel-testing.repo by running the following command:
# yum-config-manager-- enable epel-testing Loaded plugins: fastestmirror==== repo: epel-testing = [epel-testing] bandwidth = 0base_persistdir = / var/lib/yum/repos/x86_64/6baseurl = cache = 0cachedir = / var/cache/yum/x86_64/6/epel-testingcost = 1000enabled = 1enablegroups = Trueexclude = failovermethod = priorityftp_disable_epsv = Falsegpgcadir = / var/lib/yum/repos/x86_64/6/epel-testing/gpgcadirgpgcakey = gpgcheck = Truegpgdir = / var/lib/yum/repos/x86_64/ 6/epel-testing/gpgdirgpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6hdrdir = / var/cache/yum/x86_64/6/epel-testing/headershttp_caching = allincludepkgs = keepalive = Truemdpolicy = group:primarymediaid = metadata_expire = 21600metalink = mirrorlist = https://mirrors.fedoraproject.org/metalink?repo=testing-epel6&arch=x86_64mirrorlist_expire = 86400name = Extra Packages for Enterprise Linux 6-Testing-x86_64old_base_cache_dir = password = persistdir = / var/lib/yum/repos / x86_64/6/epel-testingpkgdir = / var/cache/yum/x86_64/6/epel-testing/packagesproxy = Falseproxy_dict = proxy_password = proxy_username = repo_gpgcheck = Falseretries = 10skip_if_unavailable = Falsessl_check_cert_permissions = Truesslcacert = sslclientcert = sslclientkey = sslverify = Truethrottle = 0timeout = 30.0username =
Run the yum repolist command to check if "epel-testing" is enabled. It's enabled, and I can see it from the list.
# yum repolistLoaded plugins: fastestmirror SecurityDetermining fastest mirrorsepel/metalink | 18 kB 00:00epel-testing/metalink | | 17 kB 00:00 * epel: mirror.us.leaseweb.net * epel-testing: mirror.us.leaseweb.net * ius: mirror.team-cymru.combase | | | 3.7 kB 00:00centos-sclo-sclo | | | 2.9 kB 00:00epel | 4.7 kB 00:00epel/primary_db | | | 6.0 MB 00:00epel-testing | | | 4.7 kB 00:00epel-testing/primary_db | | | 368 kB 00:00extras | 3.4 kB 00:00ius | | | 2.3 kB 00:00ius/primary_db | | | 216 kB 00:00updates | | | 3.4 kB 00:00updates/primary_db | 8.1 MB 00:00... repo id | Repo name statusbase CentOS-6-Base 6706centos-sclo-sclo CentOS-6-SCLo sclo 495epel Extra Packages for Enterprise Linux 6-x86mm 64 12509epel-testing Extra Packages for Enterprise Linux 6-Testing-x86cm 64 809extras CentOS-6-Extras 53ius IUS Community Packages for Enterprise Linux 6-x86 "64 390updates CentOS-6-Updates 1288repolist: 22250
If you want to enable multiple warehouses at the same time, use the following format. This command enables epel, epel-testing, and ius repositories:
# yum-config-manager-enable epel epel-testing ius
For Fedora systems, run the following command to enable the warehouse:
# dnf config-manager-how set-enabled epel-testing disables a warehouse in the system
Whenever you add a new repository by default, it enables their stable repository, which is why we get the warehouse information when we run the yum repolist command. If you do not want to use the warehouse, you can disable it with the following command.
To verify this, we will disable epel-testing.repo and ius.repo by running the following command:
# yum-config-manager-- disable epel-testing ius Loaded plugins: fastestmirror==== repo: epel-testing = [epel-testing] bandwidth = 0base_persistdir = / var/lib/yum/repos/x86_64/6baseurl = cache = 0cachedir = / var/cache/yum/x86_64/6/epel-testingcost = 1000enabled = 0enablegroups = Trueexclude = failovermethod = priorityftp_disable_epsv = Falsegpgcadir = / var/lib/yum/repos/x86_64/6/epel-testing/gpgcadirgpgcakey = gpgcheck = Truegpgdir = / var/lib/yum/repos/x86_64 / 6/epel-testing/gpgdirgpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6hdrdir = / var/cache/yum/x86_64/6/epel-testing/headershttp_caching = allincludepkgs = keepalive = Truemdpolicy = group:primarymediaid = metadata_expire = 21600metalink = mirrorlist = https://mirrors.fedoraproject.org/metalink?repo=testing-epel6&arch=x86_64mirrorlist_expire = 86400name = Extra Packages for Enterprise Linux 6-Testing-x86_64old_base_cache_dir = password = persistdir = / var/lib/yum/ Repos/x86_64/6/epel-testingpkgdir = / var/cache/yum/x86_64/6/epel-testing/packagesproxy = Falseproxy_dict = proxy_password = proxy_username = repo_gpgcheck = Falseretries = 10skip_if_unavailable = Truesslcacert = sslclientcert = sslclientkey = sslverify = Truethrottle = 0timeout = 30.0username = = repo: ius = [ius] bandwidth = 0base_persistdir = / var/lib/yum/repos/x86_64/6baseurl = cache = 0cachedir = / var/cache/yum/x86_64/6/iuscost = 1000enabled = 0enablegroups = Trueexclude = failovermethod = priorityftp_disable_epsv = Falsegpgcadir = / var/lib/yum/repos/x86_64/6/ius/gpgcadirgpgcakey = gpgcheck = Truegpgdir = / var/lib/yum/repos/x86_64/6/ius/gpgdirgpgkey = file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEYhdrdir = / var/cache/yum/x86_64/6/ius/headershttp_caching = allincludepkgs = keepalive = Truemdpolicy = group:primarymediaid = metadata_expire = 21600metalink = mirrorlist = https://mirrors.iuscommunity.org / mirrorlist?repo=ius-centos6&arch=x86_64&protocol=httpmirrorlist_expire = 86400name = IUS Community Packages for Enterprise Linux 6-x86_64old_base_cache_dir = password = persistdir = / var/lib/yum/repos/x86_64/6/iuspkgdir = / var/cache/yum/x86_64/6/ius/packagesproxy = Falseproxy_dict = proxy_password = proxy_username = repo_gpgcheck = Falseretries = 10skip_if_unavailable = Falsessl_check_cert_permissions = Truesslcacert = sslclientcert = sslclientkey = sslverify = Truethrottle = 0timeout = 30.0username =
Run the yum repolist command to check that the "epel-testing" and "ius" repositories are disabled. It's disabled. I can't see those warehouses, except for "epel".
# yum repolistLoaded plugins: fastestmirror SecurityLoading mirror speeds from cached hostfile * epel: mirror.us.leaseweb.netrepo id repo name statusbase CentOS-6-Base 6706centos-sclo-sclo CentOS-6-SCLo sclo 495epel Extra Packages for Enterprise Linux 6-x86 "64 12505extras CentOS -6-Extras 53updates CentOS-6-Updates 1288repolist: 21051
Alternatively, we can run the following command to view the details:
# yum repolist all | grep "epel*\ | ius*" * epel: mirror.steadfast.netepel Extra Packages for Enterprise Linux 6 enabled: 12509epel-debuginfo Extra Packages for Enterprise Linux 6 disabledepel-source Extra Packages for Enterprise Linux 6 disabledepel-testing Extra Packages for Enterprise Linux 6 disabledepel-testing-debuginfo Extra Packages for Enterprise Linux 6 disabledepel-testing-source Extra Packages for Enterprise Linux 6 disabledius IUS Community Packages for Enterprise disabledius-archive IUS Community Packages for Enterprise disabledius-archive-debuginfo IUS Community Packages for Enterprise disabledius-archive-source IUS Community Packages for Enterprise disabledius-debuginfo IUS Community Packages for Enterprise disabledius-dev IUS Community Packages for Enterprise disabledius-dev-debuginfo IUS Community Packages for Enterprise disabledius-dev-source IUS Community Packages for Enterprise disabledius-source IUS Community Packages for Enterprise disabledius-testing IUS Community Packages for Enterprise disabledius-testing-debuginfo IUS Community Packages for Enterprise disabledius-testing-source IUS Community Packages for Enterprise disabled
For Fedora systems, run the following command to enable a warehouse:
# dnf config-manager-set-disabled epel-testing
Alternatively, you can do this by manually editing the appropriate repo file. To do this, open the appropriate repo file and change the value from enabled=0 to enabled=1 (enable warehouse) or from enabled=1 to enabled=0 (disable warehouse).
That is, from:
[epel] name=Extra Packages for Enterprise Linux 6-$basearch#baseurl= http://download.fedoraproject.org/pub/epel/6/$basearchmirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearchfailovermethod=priorityenabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Change to:
[epel] name=Extra Packages for Enterprise Linux 6-$basearch#baseurl= http://download.fedoraproject.org/pub/epel/6/$basearchmirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearchfailovermethod=priorityenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 here, the study on "how to add, enable and disable a warehouse in CentOS" is over. I hope you can solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.