安装网络yum源

网络YUM源安装

什么是yum源?yum的工作原理?

有的时候服务器需要下载一些软件,是本地yum源没有的,这时候需要配置网络yum源

说到yum源就必须说到linux系统中特有的依赖关系问题,yum就是为了解决依赖关系而存在的。yum源就相当是一个目录项,当我们使用yum机制安装软件时,若需要安装依赖软件,则yum机制就会根据在yum源中定义好的路径查找依赖软件,并将依赖软件安装好。

YUM是“Yellow dog Updater, Modified”的缩写,是一个软件包管理器,YUM从指定的地方(相关网站的rpm包地址或本地的rpm路径)自动下载RPM包并且安装,能够很好的解决依赖关系问题。

YUM的基本工作机制如下:
服务器端:在服务器上面存放了所有的RPM软件包,然后以相关的功能去分析每个RPM文件的依赖性关系,将这些数据记录成文件存放在服务器的某特定目录内。
客户端:如果需要安装某个软件时,先下载服务器上面记录的依赖性关系文件(可通过WWW或FTP方式),通过对服务器端下载的纪录数据进行分析,然后取得所有相关的软件,一次全部下载下来进行安装。

yum源国内镜像站点:

阿里源 https://mirrors.aliyun.com

清华大学https://mirror.tuna.tsinghua.edu.cn

网易源http://mirrors.163.com

浙江大学http://mirrors.zju.edu.cn

删除配置文件

 rm -rf /etc/yum.repos.d/
 rm -f /etc/yum.conf
 rm -rf /var/cache/yum/

下载yum包

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm 

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm 

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-45.el7.noarch.rpm 

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm 

[root@xiefei ~]# rpm -ivh *.rpm
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 

替换配置文件内容

sed -i 's#\$releasever#7#g' /etc/yum.repos.d/CentOS-Base.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo 

生成yum缓存

yum makecache

猜你喜欢

转载自blog.csdn.net/qq_43094192/article/details/82345140