xmanman

导航

 

修改CentOS默认yum源为国内yum镜像源

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

  2、 cd /etc/yum.repos.d/

163的源:
CentOS7
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
CentOS6
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
CentOS5
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS5-Base-163.repo

阿里云的源:
CentOS7
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
CentOS6
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS5
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo


  3、运行yum makecache生成缓存

yum clean all   #清除yum缓存

yum makecache

 

 

修改yum.conf配置文件,安装后不自动删除安装包

设置yum.conf使升级后不删除下载的rpm包

编辑文件 vi /etc/yum.conf

[main]
cachedir=/var/cache/yum
keepcache=0

将 keepcache=0 修改为 keepcache=1, 安装或者升级后,在目录 /var/cache/yum 下就会有下载的 rpm 包。

 

使用插件,只下载不安装rpm包的方法:

yum -y install yum-utils

yumdownloader chkconfig

你可以在 cd /var/cache/yum/x86_64/6/updates/packages/ 目录下找到对应安装包

 

rpm包的相关命令:

查看是否有安装:rpm -q python

卸载rpm: 

普通卸载: rpm –e python
强制卸载: rpm  -e --nodeps python-2.6.6-36.el6.x86_64
卸载所有版本:rpm -e –-allmatches python

安装rpm包: rpm -ivh python-2.6.6-36.el6.x86_64

 

posted on 2018-06-03 21:17  xmanman  阅读(124)  评论(0)    收藏  举报