CentOS 5.3 通过yum命令自动安装升级程序

1、首先让CentOS服务器可以连上外网

2、[root@mailserver yum.repos.d]# pwd
   /etc/yum.repos.d
   [root@mailserver yum.repos.d]# cp CentOS-Base.repo CentOS-Base.repo.bak

3、将CentOS-Base.repo修改为以下内容,或者将以下内容保存为CentOS-Base.repo文件,上传至/etc/yum.repos.d目录替换原来的文件

# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# 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
baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
baseurl=http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

3、下载rpmforge-release-0.3.6-1.el5.rf.i386.rpm

[root@mailserver temp]# wget RedHat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

4、导入这个网站的“下载公匙“,命令

rpm --import

5、再通过rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm安装

6、安装之后,就可以通过

yum -y install gcc

yum -y install gcc-c++

yum会自动查找软件的相关依赖包,自动下载安装,全过程轻松愉快。特此记录一下。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/25384.html