昨天在安装完mongodb后,启动遇到点问题,网上一查发现是openssl 的类库比较老,不能兼容新版本,准备使用yum update 一下,但是突然想起来不能联网。而且我们最近安装的集群 系统版本比较低,综合考虑了一下,决定安装一个apache 的yum 源,方便以后安装和更新操作。

1、首先下载下来 centos 的安装包,和更新包等

去官网查询了一下 发现只有6.7版本以上 还在维护,于是决定更新到6.7版本。

wget -r -p -np -k -P ~/ http://mirror.centos.org/centos-6/6.7/

备注:本来想使用aliyun 镜像站,但是aliyun 有限制,不能使用wget 下载目录。

2、安装apache,并且拷贝下载下来的文件 (略)
3、修改 /etc/yum.repos.d/CentOS-Base.repo

首先备份一下。

[root@new-cdh1 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.back

然后修改文件 /etc/yum.repos.d/CentOS-Base.repo

[base]
name=CentOS-6.7 - Base - 192.168.66.14
failovermethod=priority
baseurl=http://192.168.66.14/centos/6.7/os/basearch/http://mirrors.aliyuncs.com/centos/6.7/os/basearch/ http://mirrors.aliyuncs.com/centos/6.7/os/basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.7&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://192.168.66.14/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6.7 - Updates - 192.168.66.14
failovermethod=priority
baseurl=http://192.168.66.14/centos/6.7/updates/basearch/http://mirrors.aliyuncs.com/centos/6.7/updates/basearch/ http://mirrors.aliyuncs.com/centos/6.7/updates/basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.7&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://192.168.66.14/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6.7 - Extras - 192.168.66.14
failovermethod=priority
baseurl=http://192.168.66.14/centos/6.7/extras/basearch/http://mirrors.aliyuncs.com/centos/6.7/extras/basearch/ http://mirrors.aliyuncs.com/centos/6.7/extras/basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.7&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://192.168.66.14/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.7 - Plus - 192.168.66.14
failovermethod=priority
baseurl=http://192.168.66.14/centos/6.7/centosplus/basearch/http://mirrors.aliyuncs.com/centos/6.7/centosplus/basearch/ http://mirrors.aliyuncs.com/centos/6.7/centosplus/basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.7&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://192.168.66.14/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6.7 - Contrib - 192.168.66.14
failovermethod=priority
baseurl=http://192.168.66.14/centos/6.7/contrib/basearch/http://mirrors.aliyuncs.com/centos/6.7/contrib/basearch/ http://mirrors.aliyuncs.com/centos/6.7/contrib/basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.7&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://192.168.66.14/centos/RPM-GPG-KEY-CentOS-6

4、测试yum

[root@new-cdh1 ~]# yum update



Installed:
kernel.x86_64 0:2.6.32-573.22.1.el6

Dependency Installed:
libtasn1.x86_64 0:2.3-6.el6_5 make.x86_64 1:3.81-20.el6 p11-kit.x86_64 0:0.18.5-2.el6_5.2 p11-kit-trust.x86_64 0:0.18.5-2.el6_5.2 pkgconfig.x86_64 1:0.23-9.1.el6 shared-mime-info.x86_64 0:0.70-6.el6

Updated:
audit.x86_64 0:2.3.7-5.el6 audit-libs.x86_64 0:2.3.7-5.el6 authconfig.x86_64 0:6.1.12-23.el6 b43-openfwwf.noarch 0:5.2-10.el6
bash.x86_64 0:4.1.2-33.el6_7.1 binutils.x86_64 0:2.20.51.0.2-5.43.el6 ca-certificates.noarch 0:2015.2.6-65.0.1.el6_7 centos-release.x86_64 0:6-7.el6.centos.12.3
chkconfig.x86_64 0:1.3.49.3-5.el6_7.2 coreutils.x86_64 0:8.4-37.el6_7.3 coreutils-libs.x86_64 0:8.4-37.el6_7.3 cpio.x86_64 0:2.10-12.el6_5
cronie.x86_64 0:1.4.4-15.el6_7.1 cronie-anacron.x86_64 0:1.4.4-15.el6_7.1 cryptsetup-luks.x86_64 0:1.2.0-11.el6 cryptsetup-luks-libs.x86_64 0:1.2.0-11.el6
curl.x86_64 0:7.19.7-46.el6 cyrus-sasl.x86_64 0:2.1.23-15.el6_6.2 cyrus-sasl-lib.x86_64 0:2.1.23-15.el6_6.2 db4.x86_64 0:4.7.25-20.el6_7
db4-utils.x86_64 0:4.7.25-20.el6_7 dbus-glib.x86_64 0:0.86-6.el6 dbus-libs.x86_64 1:1.2.24-8.el6_6 device-mapper.x86_64 0:1.02.95-3.el6_7.4
device-mapper-event.x86_64 0:1.02.95-3.el6_7.4 device-mapper-event-libs.x86_64 0:1.02.95-3.el6_7.4 device-mapper-libs.x86_64 0:1.02.95-3.el6_7.4 device-mapper-multipath.x86_64 0:0.4.9-87.el6
device-mapper-multipath-libs.x86_64 0:0.4.9-87.el6 device-mapper-persistent-data.x86_64 0:0.3.2-1.el6 dhclient.x86_64 12:4.1.1-49.P1.el6.centos dhcp-common.x86_64 12:4.1.1-49.P1.el6.centos
dracut.noarch 0:004-388.el6 dracut-kernel.noarch 0:004-388.el6 e2fsprogs.x86_64 0:1.41.12-22.el6 e2fsprogs-libs.x86_64 0:1.41.12-22.el6
efibootmgr.x86_64 0:0.5.4-13.el6 elfutils-libelf.x86_64 0:0.161-3.el6 ethtool.x86_64 2:3.5-6.el6 file.x86_64 0:5.04-21.el6
file-libs.x86_64 0:5.04-21.el6 gawk.x86_64 0:3.1.7-10.el6_7.3 gdbm.x86_64 0:1.8.0-38.el6 glib2.x86_64 0:2.28.8-4.el6
glibc.x86_64 0:2.12-1.166.el6_7.7 glibc-common.x86_64 0:2.12-1.166.el6_7.7 gnupg2.x86_64 0:2.0.14-8.el6 grep.x86_64 0:2.20-3.el6_7.1
grub.x86_64 1:0.97-94.el6_7.1 grubby.x86_64 0:7.0.15-7.el6 gzip.x86_64 0:1.3.12-22.el6 hwdata.noarch 0:0.233-14.1.el6
initscripts.x86_64 0:9.03.49-1.el6.centos.4 iproute.x86_64 0:2.6.32-45.el6 iptables.x86_64 0:1.4.7-16.el6 iptables-ipv6.x86_64 0:1.4.7-16.el6
iputils.x86_64 0:20071127-20.el6 iscsi-initiator-utils.x86_64 0:6.2.0.873-14.el6 kernel-firmware.noarch 0:2.6.32-573.22.1.el6 keyutils-libs.x86_64 0:1.4-5.el6
kpartx.x86_64 0:0.4.9-87.el6 krb5-libs.x86_64 0:1.10.3-42z1.el6_7 less.x86_64 0:436-13.el6 libblkid.x86_64 0:2.17.2-12.18.el6
libcom_err.x86_64 0:1.41.12-22.el6 libcurl.x86_64 0:7.19.7-46.el6 libdrm.x86_64 0:2.4.59-2.el6 libgcc.x86_64 0:4.4.7-16.el6
libgcrypt.x86_64 0:1.4.5-11.el6_4 libpciaccess.x86_64 0:0.13.3-0.1.el6 libselinux.x86_64 0:2.0.94-5.8.el6 libselinux-utils.x86_64 0:2.0.94-5.8.el6
libsemanage.x86_64 0:2.0.43-5.1.el6 libss.x86_64 0:1.41.12-22.el6 libssh2.x86_64 0:1.4.2-2.el6_7.1 libstdc++.x86_64 0:4.4.7-16.el6
libudev.x86_64 0:147-2.63.el6_7.1 libuser.x86_64 0:0.56.13-8.el6_7 libuuid.x86_64 0:2.17.2-12.18.el6 libxml2.x86_64 0:2.7.6-20.el6_7.1
logrotate.x86_64 0:3.7.8-26.el6_7 lvm2.x86_64 0:2.02.118-3.el6_7.4 lvm2-libs.x86_64 0:2.02.118-3.el6_7.4 mdadm.x86_64 0:3.3.2-5.el6
module-init-tools.x86_64 0:3.9-25.el6 mysql-libs.x86_64 0:5.1.73-5.el6_7.1 ncurses.x86_64 0:5.7-4.20090207.el6 ncurses-base.x86_64 0:5.7-4.20090207.el6
ncurses-libs.x86_64 0:5.7-4.20090207.el6 nspr.x86_64 0:4.11.0-0.1.el6_7 nss.x86_64 0:3.21.0-0.3.el6_7 nss-softokn.x86_64 0:3.14.3-23.el6_7
nss-softokn-freebl.x86_64 0:3.14.3-23.el6_7 nss-sysinit.x86_64 0:3.21.0-0.3.el6_7 nss-tools.x86_64 0:3.21.0-0.3.el6_7 nss-util.x86_64 0:3.21.0-0.3.el6_7
openldap.x86_64 0:2.4.40-7.el6_7 openssh.x86_64 0:5.3p1-114.el6_7 openssh-clients.x86_64 0:5.3p1-114.el6_7 openssh-server.x86_64 0:5.3p1-114.el6_7
openssl.x86_64 0:1.0.1e-42.el6_7.4 pam.x86_64 0:1.1.1-20.el6_7.1 pciutils-libs.x86_64 0:3.1.10-4.el6 pcre.x86_64 0:7.8-7.el6
pinentry.x86_64 0:0.7.6-8.el6 plymouth.x86_64 0:0.8.3-27.el6.centos.1 plymouth-core-libs.x86_64 0:0.8.3-27.el6.centos.1 plymouth-scripts.x86_64 0:0.8.3-27.el6.centos.1
policycoreutils.x86_64 0:2.0.83-24.el6 postfix.x86_64 2:2.6.6-6.el6_7.1 procps.x86_64 0:3.2.8-35.el6_7 psmisc.x86_64 0:22.6-19.el6_5
python.x86_64 0:2.6.6-64.el6 python-libs.x86_64 0:2.6.6-64.el6 python-urlgrabber.noarch 0:3.9.1-9.el6 rpm.x86_64 0:4.8.0-47.el6
rpm-libs.x86_64 0:4.8.0-47.el6 rpm-python.x86_64 0:4.8.0-47.el6 rsyslog.x86_64 0:5.8.10-10.el6_6 selinux-policy.noarch 0:3.7.19-279.el6_7.9
selinux-policy-targeted.noarch 0:3.7.19-279.el6_7.9 setup.noarch 0:2.8.14-20.el6_4.1 shadow-utils.x86_64 2:4.1.4.2-19.el6_6.1 sqlite.x86_64 0:3.6.20-1.el6_7.2
sudo.x86_64 0:1.8.6p3-20.el6_7 system-config-firewall-base.noarch 0:1.2.27-7.2.el6_6 sysvinit-tools.x86_64 0:2.87-6.dsf.el6 tar.x86_64 2:1.23-13.el6
tzdata.noarch 0:2016d-1.el6 udev.x86_64 0:147-2.63.el6_7.1 upstart.x86_64 0:0.6.5-13.el6_5.3 util-linux-ng.x86_64 0:2.17.2-12.18.el6
vim-minimal.x86_64 2:7.4.629-5.el6 xfsprogs.x86_64 0:3.1.1-16.el6 xz-libs.x86_64 0:4.999.9-0.5.beta.20091007git.el6 yum.noarch 0:3.2.29-69.el6.centos
yum-plugin-fastestmirror.noarch 0:1.1.30-30.el6

Complete!

打完收工。