Linux安装yum教程

Linux安装yum

标签:教程


1.检查是否安装

查看是否安装yum 若是安装了还有那些包

rpm -qa |grep yum

2.删除原有的yum

rpm -aq|grep yum|xargs rpm -e –nodeps

3.专门存放下载的路径

cd /usr/local/src

4.下载安装依赖包py


下载地址:
进度条100%表示已完成

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-2.7.5-68.el7.x86_64.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm

5.安装依赖包

rpm –ivh  python-2.7.5-48.el7.x86_64.rpm  python-iniparse-0.4-9.el7.noarch.rpm

6.下载安装文件


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

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

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

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

wegt http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm


7.安装yum

rpm -ivh yum-* --nodeps --force
注意理论上这样的,实际因为包与包的依赖关系导致有两个包必须同时安装,需执行一下代码;
rpm -ivh yum-3.4.3-158.el7.centos.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm yum-updateonboot-1.1.31-45.el7.noarch.rpm yum-utils-1.1.31-45.el7.noarch.rpm --nodeps --force

8.更改yum源包依赖CentOS-Base.repo

备份源文件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载配置文件

# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

编辑配置文件,将所有$releasever替换成7(因为centos版本为7)。

cd /etc/yum.repos.d
sed -i 's/$releasever/7/g'  CentOS-Base.repo

9.显示已配置的源

yum repolist

10.生成本地缓存

yum clean all
yum makecache

11.测试

yum list python

显示出python安装包信息,则yum安装成功。

你可能感兴趣的:(Linux)