“rhel6-x86_64”使用CentOSyum源
产生这个文档,是因为在家里的虚拟机(32位)上,RHEL6环境yum安装MySQL非常不顺利。在公司的64位一体机上,打算在虚拟机上再试一次。没想到,寻找RHEL6的yum源配置文件,反而成了麻烦。
网站建设哪家好,找创新互联!专注于网页设计、网站建设、微信开发、重庆小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了南木林免费建站欢迎大家使用!
从昨天中午到下午4点,包括这篇文档的雏形才算基本完成。找了不少网络资料,太多不靠谱。我是根据文中的提到的2篇“参考资料”才完成的。
yum配置,从2011年秋天学RHCE的时候,就一直是我的痛点。现在,通过光盘挂载配置yum源应该没有问题。但是,通过Internet配置yum……虽然反复折腾多次,但好像没有太多的进步。
把这篇文档整理出来,希望在日后再遇到类似的问题,可以照猫画虎,先把问题解决再说。
1.删除redhat原有的
[root@nagios ~]# yum rpm -aq|grep yum|xargs rpm -e --nodeps Command line error: no such option: -a error: package Usage: is not installed error: package [options] is not installed error: package COMMAND is not installed error: package shell is not installed error: package Run is not installed error: package an is not installed error: package interactive is not installed error: package shell is not installed
2.下载yum安装文件
注意:最好自己到镜像站点(如:http://mirrors.163.com/centos/6/os/x86_64/)找相应的包,这里列出来的包名称,过段时间可能会过时。
[root@nagios ~]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm --2014-09-04 22:46:55-- http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm 正在解析主机 mirrors.163.com... 123.58.173.106 正在连接 mirrors.163.com|123.58.173.106|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:1019540 (996K) [application/x-redhat-package-manager] 正在保存至: “yum-3.2.29-40.el6.centos.noarch.rpm” 100%[==========================================================================================================================================================>] 1,019,540 1.43M/s in 0.7s 2014-09-04 22:46:57 (1.43 MB/s) - 已保存 “yum-3.2.29-40.el6.centos.noarch.rpm” [1019540/1019540]) [root@nagios ~]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm --2014-09-04 22:47:20-- http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 正在解析主机 mirrors.163.com... 123.58.173.106 正在连接 mirrors.163.com|123.58.173.106|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:27224 (27K) [application/x-redhat-package-manager] 正在保存至: “yum-metadata-parser-1.1.2-16.el6.x86_64.rpm” 100%[==========================================================================================================================================================>] 27,224 --.-K/s in 0.08s 2014-09-04 22:47:20 (343 KB/s) - 已保存 “yum-metadata-parser-1.1.2-16.el6.x86_64.rpm” [27224/27224]) [root@nagios ~]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm --2014-09-04 22:48:15-- http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm 正在解析主机 mirrors.163.com... 123.58.173.106 正在连接 mirrors.163.com|123.58.173.106|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:28220 (28K) [application/x-redhat-package-manager] 正在保存至: “yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm” 100%[==========================================================================================================================================================>] 28,220 --.-K/s in 0.05s 2014-09-04 22:48:15 (611 KB/s) - 已保存 “yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm” [28220/28220]) [root@nagios ~]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm --2014-09-04 22:49:42-- http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm 正在解析主机 mirrors.163.com... 123.58.173.106 正在连接 mirrors.163.com|123.58.173.106|:80... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:37052 (36K) [application/x-redhat-package-manager] 正在保存至: “python-iniparse-0.3.1-2.1.el6.noarch.rpm” 100%[==========================================================================================================================================================>] 37,052 88.7K/s in 0.4s 2014-09-04 22:49:43 (88.7 KB/s) - 已保存 “python-iniparse-0.3.1-2.1.el6.noarch.rpm” [37052/37052])
这里使用的是网易镜像,在这里可以找到你想要的,不一定要用CentOS的软件包。
3.安装yum,必须按照顺序
[root@nagios ~]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm warning: python-iniparse-0.3.1-2.1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY Preparing... ########################################### [100%] package python-iniparse-0.3.1-2.1.el6.noarch is already installed [root@nagios ~]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm warning: yum-metadata-parser-1.1.2-16.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Preparing... ########################################### [100%] file /usr/lib64/python2.6/site-packages/_sqlitecache.so from install of yum-metadata-parser-1.1.2-16.el6.x86_64 conflicts with file from package yum-metadata-parser-1.1.2-14.1.el6.x86_64 file /usr/lib64/python2.6/site-packages/sqlitecachec.pyc from install of yum-metadata-parser-1.1.2-16.el6.x86_64 conflicts with file from package yum-metadata-parser-1.1.2-14.1.el6.x86_64 [root@nagios ~]# rpm -ivh yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm warning: yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Preparing... ########################################### [100%] 1:yum-plugin-fastestmirro########################################### [100%]
注意:最后两个包必需同时安装,否则会相互依赖。
[root@nagios ~]# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm warning: yum-3.2.29-40.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Preparing... ########################################### [100%] file /etc/bash_completion.d/yum.bash from install of yum-3.2.29-40.el6.centos.noarch conflicts with file from package yum-3.2.27-14.el6.noarch file /etc/yum.conf from install of yum-3.2.29-40.el6.centos.noarch conflicts with file from package yum-3.2.27-14.el6.noarch file /usr/lib/python2.6/site-packages/yum/__init__.py from install of yum-3.2.29-40.el6.centos.noarch conflicts with file from package yum-3.2.27-14.el6.noarch ……其它输出略……
4.将CentOS 6的仓库作为yum源
[root@nagios ~]# cd /etc/yum.repos.d/ [root@nagios yum.repos.d]# ll 总用量 0
通过这次配置发现,yum源的名称不重要,只要保证后缀是“.repo”即可。
[root@nagios yum.repos.d]# cat 163.repo [base] #yum源的名称 name=CentOS-$releasever - Base #这个yum源的名称,在做kicakstart时需要特别注意 baseurl=http://mirrors.163.com/centos/6/os/$basearch/ #yum源地址:如果是本地源,“file:///”中的第3个“/”表示本地根目录 enable=1 #不启用这个yum源为“0”,启用安全校验为“1” gpgcheck=1 #不启用安全校验为“0”,启动安全校验为“1” gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #安全校验,检测这个yum源的rpm包是否为红帽官方包导入gpgkey #released updates [updates] name=CentOS-$releasever - Updates baseurl=http://mirrors.163.com/centos/6/updates/$basearch/ enable=1 gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #packages used/produced in the build but not released #[addons] #name=CentOS-$releasever - Addons #baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/ #gpgcheck=1 #gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras baseurl=http://mirrors.163.com/centos/6/extras/$basearch/ enable=1 gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/ gpgcheck=1 enabled=0
参考文档:http://yongzhilinux.blog.51cto.com/2651263/909977——RHEL5和RHEL6下本地以及网络yum源的创建
5.清除yum的缓存(命令“yum clean all”)
6.yum安装mysql
[root@nagios yum.repos.d]# yum -y install mysql-server Loaded plugins: fastestmirror, refresh-packagekit, rhnplugin This system is not registered with RHN. RHN support will be disabled. Determining fastest mirrors base | 3.7 kB 00:00 base/primary_db | 4.4 MB 00:10 extras | 3.3 kB 00:00 extras/primary_db | 19 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 4.8 MB 00:44 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql-server.x86_64 0:5.1.73-3.el6_5 set to be updated --> Processing Dependency: mysql = 5.1.73-3.el6_5 for package: mysql-server-5.1.73-3.el6_5.x86_64 --> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-3.el6_5.x86_64 --> Processing Dependency: libssl.so.10(libssl.so.10)(64bit) for package: mysql-server-5.1.73-3.el6_5.x86_64 --> Processing Dependency: libcrypto.so.10(libcrypto.so.10)(64bit) for package: mysql-server-5.1.73-3.el6_5.x86_64 --> Running transaction check ---> Package mysql.x86_64 0:5.1.73-3.el6_5 set to be updated --> Processing Dependency: mysql-libs = 5.1.73-3.el6_5 for package: mysql-5.1.73-3.el6_5.x86_64 ---> Package openssl.x86_64 0:1.0.1e-16.el6_5.15 set to be updated ---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 set to be updated --> Running transaction check ---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================================================================================================================== Package Arch Version Repository Size ==================================================================================================================================================================================================== Installing: mysql-server x86_64 5.1.73-3.el6_5 updates 8.6 M Installing for dependencies: mysql x86_64 5.1.73-3.el6_5 updates 894 k perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k Updating for dependencies: mysql-libs x86_64 5.1.73-3.el6_5 updates 1.2 M openssl x86_64 1.0.1e-16.el6_5.15 updates 1.5 M Transaction Summary ==================================================================================================================================================================================================== Install 3 Package(s) Upgrade 2 Package(s) Total download size: 12 M Downloading Packages: (1/5): mysql-5.1.73-3.el6_5.x86_64.rpm | 894 kB 00:01 (2/5): mysql-libs-5.1.73-3.el6_5.x86_64.rpm | 1.2 MB 00:01 http://mirrors.163.com/centos/6/updates/x86_64/Packages/mysql-server-5.1.73-3.el6_5.x86_64.rpm: [Errno 12] Timeout on http://mirrors.163.com/centos/6/updates/x86_64/Packages/mysql-server-5.1.73-3.el6_5.x86_64.rpm: (28, '') Trying other mirror. (4/5): openssl-1.0.1e-16.el6_5.15.x86_64.rpm | 1.5 MB 00:02 (5/5): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm | 134 kB 00:00 Error Downloading Packages: mysql-server-5.1.73-3.el6_5.x86_64: failure: Packages/mysql-server-5.1.73-3.el6_5.x86_64.rpm from updates: [Errno 256] No more mirrors to try.
安装失败,提示好像是没有更多的yum源地址。
更换另1个yum源配置文件,安装也失败。
[root@nagios yum.repos.d]# yum -y install mysql-server Loaded plugins: fastestmirror, refresh-packagekit, rhnplugin This system is not registered with RHN. RHN support will be disabled. Loading mirror speeds from cached hostfile http://mirrors.163.com/centos/6Server/addons/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 : http://mirrors.163.com/centos/6Server/addons/x86_64/repodata/repomd.xml Trying other mirror. Error: Cannot retrieve repository metadata (repomd.xml) for repository: addons. Please verify its path and try again
再次使用第1个yum源配置文件“163.repo”,安装成功。不过,安装过程中,还是有错误出现。
[root@nagios yum.repos.d]# yum -y install mysql-server Loaded plugins: fastestmirror, refresh-packagekit, rhnplugin This system is not registered with RHN. RHN support will be disabled. Loading mirror speeds from cached hostfile base | 3.7 kB 00:00 extras | 3.3 kB 00:00 updates | 3.4 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mysql-server.x86_64 0:5.1.73-3.el6_5 set to be updated --> Processing Dependency: mysql = 5.1.73-3.el6_5 for package: mysql-server-5.1.73-3.el6_5.x86_64 --> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-3.el6_5.x86_64 --> Processing Dependency: libssl.so.10(libssl.so.10)(64bit) for package: mysql-server-5.1.73-3.el6_5.x86_64 --> Processing Dependency: libcrypto.so.10(libcrypto.so.10)(64bit) for package: mysql-server-5.1.73-3.el6_5.x86_64 --> Running transaction check ---> Package mysql.x86_64 0:5.1.73-3.el6_5 set to be updated --> Processing Dependency: mysql-libs = 5.1.73-3.el6_5 for package: mysql-5.1.73-3.el6_5.x86_64 ---> Package openssl.x86_64 0:1.0.1e-16.el6_5.15 set to be updated ---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 set to be updated --> Running transaction check ---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================================================================================================================== Package Arch Version Repository Size ==================================================================================================================================================================================================== Installing: mysql-server x86_64 5.1.73-3.el6_5 updates 8.6 M Installing for dependencies: mysql x86_64 5.1.73-3.el6_5 updates 894 k perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k Updating for dependencies: mysql-libs x86_64 5.1.73-3.el6_5 updates 1.2 M openssl x86_64 1.0.1e-16.el6_5.15 updates 1.5 M Transaction Summary ==================================================================================================================================================================================================== Install 3 Package(s) Upgrade 2 Package(s) Total size: 12 M Total download size: 8.6 M Downloading Packages: mysql-server-5.1.73-3.el6_5.x86_64.rpm | 8.6 MB 00:06 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY base/gpgkey | 3.3 kB 00:00 ... Importing GPG key 0xC105B9DE "CentOS-6 Key (CentOS 6 Official Signing Key) " from http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Warning: RPMDB altered outside of yum. Updating : openssl-1.0.1e-16.el6_5.15.x86_64 1/7 Updating : mysql-libs-5.1.73-3.el6_5.x86_64 2/7 Installing : perl-DBD-MySQL-4.013-3.el6.x86_64 3/7 Installing : mysql-5.1.73-3.el6_5.x86_64 4/7 Installing : mysql-server-5.1.73-3.el6_5.x86_64 5/7 Cleanup : mysql-libs-5.1.47-4.el6.x86_64 6/7 Cleanup : openssl-1.0.0-4.el6.x86_64 7/7 Installed: mysql-server.x86_64 0:5.1.73-3.el6_5 Dependency Installed: mysql.x86_64 0:5.1.73-3.el6_5 perl-DBD-MySQL.x86_64 0:4.013-3.el6 Dependency Updated: mysql-libs.x86_64 0:5.1.73-3.el6_5 openssl.x86_64 0:1.0.1e-16.el6_5.15 Complete!
参考文档:http://www.chinadmd.com/file/r3zuu3uostrvaicitoszsocx_1.html——RHEL 6.1网络yum配置
分享名称:“rhel6-x86_64”使用CentOSyum源
分享链接:http://azwzsj.com/article/pcgdoh.html