cat /etc/*release*
cat /etc/redhat-release
CentOS release 5.7 (Final)
由于使用的CentOS中不包含man程序,手动安装:
yum install man
根据系统提示操作后,报如下 错误:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID e8562897
GPG key retrieval failed: [Errno 5] OSError: [Errno 2] No such file or directory: '/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5'
出错原因:
这是因为:指定的文件/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5在本地不存在导致的。
解决:
1,去官网http://mirror.centos.org/centos/下载相应文件,然后重新执行命令
cd /etc/pki/rpm-gpg;wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5;yum install man
默认的yum仓库文件/etc/yum.repos.d/CentOS-Base.repo:
在CentOS 5.5 里,默认的 yum更新源是镜像列表来的,系统会根据你的速度及地区自动检测一个速度较快的更新源并使用此更新源,很多时候,所检测并用到的是163
也可以修改其它的或你认为快的源,只需要修改 /etc/yum.repos.d/CentOS-Base.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 mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #released updates [updates] name=CentOS-$releasever - Updates mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released [addons] name=CentOS-$releasever - Addons mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons #baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib #baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
CentOS-Base.repo.163
# 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 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-$releasever - Updates #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras] name=CentOS-$releasever - Extras #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 #contrib - packages by Centos Users [contrib] name=CentOS-$releasever - Contrib #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
配置本地Yum仓库:
一、挂载本地光盘到系统:把Cent6.2安装光盘放入光驱,在终端命令行下操作
mkdir /mnt/cdrom #新建挂载目录
mount /dev/cdrom /mnt/cdrom #挂载光盘到/mnt/cdrom目录下
cd /mnt/cdrom #进入挂载目录
ls #查看挂载目录,光盘挂载成功
二、配置本地yum源
cd /etc/yum.repos.d/ #进入yum配置目录
vi CentOS-Media.repo #编辑配置文件,添加以下内容
[GuangPan] name=CentOS-$releasever - Media #自定义名称 baseurl=file:///mnt/cdrom/ #本地光盘挂载路径 gpgcheck=1 #检查GPG-KEY,0为不检查,1为检查 enabled=1 #启用yum源,0为不启用,1为启用
三、清除yum缓存,使用yum install自动安装软件
yum clean all #清除yum缓存
yum install php #安装php
如果仍然使用的是网络上的repo,那么把/etc/yum.rpos. d/目录下的CentOS-Base.repo CentOS-Debuginfo.repo文件进行改名,这样就可以绕过网络进行本地源的安装。