Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to replace yum Source in Linux system

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to replace yum source on Linux system, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.

The main purpose of yum is to manage rpm packages, including installation, uninstall, upgrade, etc., but when installing software with yum, we often find that there is no such software in our yum source, so we need to replace the yum source ourselves.

I. Replace it with the domestic yum source 1.1 View the original yum source

rpm -qa |grep yum 1.2 Delete the original yum source

rpm -aq | grep yum |xargsrpm -e -nodeps Confirmation:

rpm -qa |grep yum 1.3 Download the new yum installation package

wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm wget http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm Here I use Alibaba Cloud, you can also use 163 and other http://mirrors.aliyun.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

1.5 Install yum

rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm-ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm* Note: The following two are installed together

rpm-ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm* Note:

If the last step of the installation error, check the error, found that python-urlgrabber version must be greater than or equal to 3.9.1-10

1.5.1 View Python version

rpm -qa |grep python found python-urlgrabber-3.9.1-9.el6.noarch version less than 3.9.1-10

1.5.2 Uninstall: python-urlgrabber-3.9.1-9.el6.noarch

rpm -e python-urlgrabber-3.9.1-9.el6.noarch1.5.3 Installation:

rpm-ivhpython-urlgrabber-3.9.1-11.el6.noarch.rpm1.5.4 Perform the final installation command again

rpm-ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm1.6 Change yum source

cd /etc/yum.repos.d1.6.1 Download configuration file

wget http://mirrors.aliyun.com/repo/Centos-61.6.2 modify the value of $releasever

The configuration file Centos-6.repo we obtained has a $releasever after opening, this is the yum variable, we need to replace it, otherwise the source cannot be used.

Replace $releasever with the following command,

sed -i 's/$releasever/6/g' /etc/yum.repos.d/Centos-6.repo1.7 Clean yum cache

yum clean all1.8 caches server package information locally to improve search and installation efficiency

yum makecache 1.9 Update yum

yum update1.10 is done, install what is missing

Second, use local iso2.1 mount mirror disk

2.1.1 Put rhel-server-6.4-x86_64-dvd.iso in a directory, assuming it is under software

2.1.2

cd software/ mount -o loop rhel-server-6.7-x86_64-dvd.iso iso/ df -hFilesystem Size Used Avail Use% Mounted on

/dev/sda3 47G 6.7G 38G 16% /

tmpfs 940M 72K 940M 1% /dev/shm

/dev/sda1 194M 32M 153M 18% /boot

/software/rhel-server-6.7-x86_64-dvd.iso

3.5G 3.5G 0 100% /software/iso

2.2 Edit the rhel-source.repo file

cd /etc/yum.repos.d Backup original files

cp rhel-source.repo rhel-source.repo.bk modify rehl-source.repo file

vi rhel-source.repo is modified to read as follows:

cat rhel-source.repo[Packages]

name=Red Hat EnterpriseLinux name whatever

baseurl=file:///software/iso #mount path of local iso

enabled=1 #yum can be used

gpgcheck=0 #Set not to check gpgkey

gpgkey=file:///software/iso/RPM-GPG-KEY-redhat-release #Configure gpgkey path

2.3 Modify the yumRepo.py configuration file

cd /usr/lib/python2.6/site-packages/yum/ vi yumRepo.py found remote=url +'/'+ relative

Change to remote="/software/iso"+'/'+ relative

2.4 Test yum source

yum install glibc.i686 Complete

About "Linux system how to replace yum source" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report