redhat 시스템 데이터 소스 교체

3829 단어 linux 서버
Red Hat의 YUM 소스는 유료 서비스이므로 모든 서버에 yum 소스를 교체해야 합니다.
작업은 다음과 같습니다.
1. Red Hat의 기존 yum 삭제
rpm -aq|grep yum|xargs rpm -e --nodeps
mkdir/var/yum_repo
cd /var/yum_repo
2. 새 yum 설치 패키지 다운로드
여기서 저희가 CentOS의 yum 소스를 사용합니다.
#wget http://mirror.centos.org/centos-6/6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm # wget http://mirror.centos.org/centos-6/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm # wget http://mirror.centos.org/centos-6/6/os/i386/Packages/yum-3.2.29-22.el6.centos.noarch.rpm # wget http://mirror.centos.org/centos-6/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-10.el6.noarch.rpm
3. yum 패키지 설치
# rpm -ivh  python-iniparse-0.3.1-2.1.el6.noarch.rpm # rpm -ivh  yum-metadata-parser-1.1.2-14.1.el6.i686.rpm # rpm -ivh  yum-3.2.27-14.el6.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm 주의: 마지막 두 설치 패키지는 함께 설치해야 합니다. 그렇지 않으면 서로 의존하고 설치에 실패할 수 있습니다.
4. yum 소스 변경
cd/etc/yum.repos.d/
rm -rf *
touch rhel-source.repo
5. 다음 내용을 rhel-source로 복사합니다.repo 파일에 저장
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
 
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#released updates 
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
 
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6

6. yum 캐시 정리
sed -i 's/\$releasever/6/g' rhel-source.repo
yum clean all
yum makecache

좋은 웹페이지 즐겨찾기