redhat7更换centosyum 源
更换阿里源
备份
mv /etc/yum.repos.d/ CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
---------------------------------------^这里是你电脑版本自带的repo文件,自己去目录下看
下载
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
yum makecache
有bug仔细读下面--------------------------
Redhat yum源是收费的,没有注册的Redhat机器是不能使用yum源的。
1、当前系统环境:
系统版本:Red Hat Enterprise Linux Server release 7.3 (Maipo)
软件环境:系统默认是自带了yum程序的,需要卸载,安装CentOS的
2、更换yum源:
1) 卸载本地yum:
先使用su root获得权限
# rpm -qa|grep yum #查看本地yum
# rpm -qa|grep yum|xargs rpm -e --nodeps #卸载本地yum,不检查依赖性,卸载yum程序
# rpm -qa | grep python-urlgrabber | xargs rpm -e --nodeps
删除phthon 后面进行更新
2) 下载CentOS yum程序
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.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命令下载(较方便),也可以用浏览器下载。rpm包下载地址http://mirrors.163.com/centos/7/os/x86_64/Packages/ ,包的版本会有更新,选择最新版本下载
安装CentOS yum程序
为避免他们之间互相依赖,三个程序一起安装
# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
安装报错,依赖软件版本不兼容,
警告:yum-3.4.3-161.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
错误:依赖检查失败
python-urlgrabber
>= 3.10-8 被
yum-3.4.3-161.el7.centos.noarch 需要
rpm
>= 0:4.11.3-22 被
yum-3.4.3-161.el7.centos.noarch 需要
重新下载新版本的依赖软件,安装更新
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-35.el7.x86_64.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-libs-4.11.3-35.el7.x86_64.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-build-libs-4.11.3-35.el7.x86_64.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-python-4.11.3-35.el7.x86_64.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-chardet-2.2.1-1.el7_1.noarch.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-4.11.3-35.el7.x86_64.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-sign-4.11.3-35.el7.x86_64.rpm
# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/rpm-build-4.11.3-35.el7.x86_64.rpm
更新依赖软件:
# rpm –ivh python-*
# rpm -ivh libxml*
# rpm –Uvh rpm*
再次安装yum程序
# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
安装报错:
错误:依赖检测失败:
python-urlgrabber
>= 3.10-8 被
yum-3.4.3-161.el7.centos.noarch 需要
Python-urlgrabber版本不兼容,下载对应的版本。
/*更新
python-url地址更换
*/
安装:
# rpm -ivh python-urlgrabber-3.10-8.el7.noarch.rpm
注意下载下来的是那个版本号 3.10-9.e17或者3.10-9.e17
若还有:rpm >= 0:4.11.3-22 被 yum-3.4.3-161.el7.centos.noarch 需要问题
出现这个问题
rpm -Uvh rpm-4.11.3-35.el7.x86_64.rpm –nodeps 注意版本号对应
再次安装yum程序
# rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
安装成功。
3) repo 配置文件
下载配置文件
# cd /etc/yum.repos.d/ #进入到yum配置文件目录
# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo #下载配置文件
设置配置文件
# sed -i "s;\$releasever;7;g" CentOS7-Base-163.repo
替换新的repo文件
# mv redhat.repo redhat.repo.bak
配置文件内容如下:
1 [base]
2 name=CentOS-7 - Base - 163.com
3 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
4 baseurl=http://mirrors.163.com/centos/7/os/$basearch/
5 gpgcheck=1
6 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
7
8 #released updates
9 [updates]
10 name=CentOS-7 - Updates - 163.com
11 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
12 baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
13 gpgcheck=1
14 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
15
16 #additional packages that may be useful
17 [extras]
18 name=CentOS-7 - Extras - 163.com
19 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
20 baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
21 gpgcheck=1
22 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
23
24 #additional packages that extend functionality of existing packages
25 [centosplus]
26 name=CentOS-7 - Plus - 163.com
27 baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/
28 gpgcheck=1
29 enabled=0
30 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
更新yum缓存
# yum clean all #清除yum缓存
# yum makecache #更新yum缓存
执行yumrepolist查看,如果显示出repo仓库列表,并显示软件包数量则OK。
# yum repolist
至此yum源更换完成。然后就可以使用yum安装sqlite了