Linux Basic Learning-rhel7.4 the Yum replacement CentOS source

Source: Internet
Author: User
Tags gpg metalink

1. Configure the Yum local source

1. Mount the image

[[email protected] ~]# mount /dev/cdrom /mnt

2. See if the mount is successful

[[email protected] ~]# df -hFilesystem      Size  Used Avail Use% Mounted on/dev/sda3        49G  1.3G   48G   3% /devtmpfs        479M     0  479M   0% /devtmpfs           489M     0  489M   0% /dev/shmtmpfs           489M  6.6M  482M   2% /runtmpfs           489M     0  489M   0% /sys/fs/cgroup/dev/sda1       497M  112M  385M  23% /boottmpfs            98M     0   98M   0% /run/user/0/dev/sr0        3.8G  3.8G     0 100% /mnt

3. Back up the original warehouse

[[email protected] ~]# cp -r /etc/yum.repos.d /etc/yum.repos.d_bak[[email protected] ~]# rm -f /etc/yum.repos.d/*

4. Create a new repo configuration file

[[email protected] ~]# vi /etc/yum.repos.d/dvd.repo[dvd]name=install dvdbaseurl=file:///mntenabled=1gpgcheck=0

5. Refresh Repos Build Cache

[[email protected] ~]# yum makecacheLoaded plugins: product-id, search-disabled-repos, subscription-managerThis system is not registered with an entitlement server. You can use subscription-manager to register.dvd                                                                            | 4.1 kB  00:00:00     (1/5): dvd/group_gz                                                            | 137 kB  00:00:00     (2/5): dvd/filelists_db                                                        | 3.4 MB  00:00:00     (3/5): dvd/primary_db                                                          | 4.0 MB  00:00:00     (4/5): dvd/other_db                                                            | 1.5 MB  00:00:00     (5/5): dvd/productid                                                           | 1.6 kB  00:00:00     Metadata Cache Created
2. Using the CentOS source

1. Uninstall Red Hat Yum

[[email protected] Packages]# rpm -e $(rpm -qa | grep yum) --nodeps[[email protected] Packages]# echo $?0

2. Delete Yum related files

[[email protected] Packages]# rm -rf /etc/yum.conf[[email protected] Packages]# rm -rf /etc/yum.repos.d/*[[email protected] Packages]# rm -rf /var/cache/yum

3. Download CentOS-related Yum components

wget Https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpmwget Https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64. Rpmwget https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/Packages/ Yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpmwget https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/ Packages/yum-updateonboot-1.1.31-45.el7.noarch.rpmwget https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/ Packages/yum-utils-1.1.31-45.el7.noarch.rpmwget https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/ Packages/python-kitchen-1.1.1-5.el7.noarch.rpmwget https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/ Packages/python-chardet-2.2.1-1.el7_1.noarch.rpm[[email protected] ~]# RPM-IVH *.rpmwarning:                          Python-chardet-2.2.1-1.el7_1.noarch.rpm:header V3 rsa/sha256 Signature, key ID f4a80eb5:nokeypreparing ... ################################# [100%]updating /Installing ... 1:yum-metadata-parser-1.1.4-10.el7 ################################# [14%] 2:yum-plugin-fastestmirror-1.1.31-4### ############################## [29%] 3:yum-3.4.3-158.el7.centos ################################# [43%] 4:py Thon-chardet-2.2.1-1.el7_1 ################################# [57%] 5:python-kitchen-1.1.1-5.el7 ############# #################### [71%] 6:yum-utils-1.1.31-45.el7 ################################# [86%] 7:yum-updateon  Boot-1.1.31-45.el7 ################################# [100%][[email protected] ~]#

4. Create a new repo file

[Base]name=centos-7-basebaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/$basearch/#mirrorlist =http:// Mirrorlist.centos.org/?release=7&arch= $basearch &repo=osgpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/ rpm-gpg-key-centos-7#released updates[updates]name=centos-7-updatesbaseurl=https://mirrors.tuna.tsinghua.edu.cn /centos/7/updates/$basearch/#mirrorlist =http://mirrorlist.centos.org/?release=7&arch= $basearch &repo= Updatesgpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-7#additional packages that could be Useful[extras] Name=centos-7-extrasbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/extras/$basearch/#mirrorlist =http:// Mirrorlist.centos.org/?release=7&arch= $basearch &repo=extrasgpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/ Rpm-gpg-key-centos-7#additional packages that extend functionality of existing packages[centosplus]name=centos-7- plusbaseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/centosplus/$basearch/#mirrorlist =http:// Mirrorlist.centOs.org/?release=7&arch= $basearch &repo=centosplusgpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/ Rpm-gpg-key-centos-7

5. Flush the build cache using Yum Makecache

[[email protected] ~]# yum makecacheloaded plugins:fastestmirror, Product-id, Search-disabled-repos, Subscription-managerthis system is not registered with an entitlement server. You can use the Subscription-manager to register.  Loading mirror speeds from cached Hostfilebase | 3.6 KB 00:00:00 Extras | 3.4 KB 00:00:00 Updates | 3.4 KB 00:00:00 (1/12): Base/x86_64/group_gz | 166 KB 00:00:06 (2/12): base/x86_64/primary_db | 5.9 MB 00:00:02 (3/12): base/x86_64/filelists_db | 6.9 MB 00:00:08 (4/12): base/x86_64/other_db | 2.5 MB 00:00:01 (5/12): Extras/x86_64/prestodelta | 00:00:06 KB (6/12): extras/x86_64/primary_db | 173 KB 00:00:00 (7/12): extras/x86_64/other_db | 00:00:00 KB (8/12): extras/x86_64/filelists_db | 588 KB 00:00:06 (9/12): Updates/x86_64/prestodelta | 409 KB 00:00:06 (10/12): updates/x86_64/filelists_db | 2.4 MB 00:00:07 (11/12): updates/x86_64/other_db | 381 KB 00:00:00 (12/12): updates/x86_64/primary_db | 4.3 MB 00:00:01 Metadata Cache Created

6.epel Extension Source

First install the epel-release from the CentOS Extras source (Tuna also has a mirror):

yum install epel-release -y

Edit Epel.repo

  [Epel]name=extra Packages for Enterprise Linux 7-$basearchbaseurl =https://mirrors.tuna.tsinghua.edu.cn/ epel/7/$basearch #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$ basearchfailovermethod=priorityenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-epel-7[ Epel-debuginfo]name=extra Packages for Enterprise Linux 7-$basearch-debugbaseurl=https:// mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch/debug#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo =epel-debug-7&arch= $basearchfailovermethod =priorityenabled=0gpgkey=file:///etc/pki/rpm-gpg/ Rpm-gpg-key-epel-7gpgcheck=1[epel-source]name=extra Packages for Enterprise Linux 7-$basearch-sourcebaseurl=https:/ /mirrors.tuna.tsinghua.edu.cn/epel/7/srpms#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo= Epel-source-7&arch= $basearchfailovermethod =priorityenabled=0gpgkey=file:///etc/pki/rpm-gpg/ Rpm-gpg-key-epel-7gpgcheck=1  

After you've done this, delete the/etc/pki/rpm-gpg/file.
Put a new file in the Epel in the download

[[email protected] ~]# ls /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7RPM-GPG-KEY-CentOS-7

Linux Basic Learning-rhel7.4 the Yum replacement CentOS source

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.