这两天我试着在VMware虚拟机里安装gcc,遇到了不少问题
1、 安装yum源
我搭建的是光盘yum源(有两种方法搭建yum源,另外一种是网络yum源,但至今没弄懂我的网络yum源为什么不成功)
1) 挂载光盘
[[email protected]~]#mount/dee/cdrom /mnt/cdrom/
2) 让网络yum源失效
[[email protected]~]#cd /etc/yum.repos.d/
[[email protected] yum.repos.d]#mv CentOS-Base.repo CentOS-Base.repo.bak
[[email protected] yum.repos.d]#mv CentOS-Debuginfo.repo CentOS- Debuginfo.repo.bak
[[email protected] yum.repos.d]#mv CentOS-Vault.repo CentOS- Vault.repo.bak
3) 修改光盘yum源文件
[[email protected] yum.repos.d]#vim CentOS-Media.repo
[c6-media]
name= CentOS-$releasever-Media
baseurl=file:///mnt/cdrom
#地址为你自己的光盘挂载地址
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPG-GPG-KEY- CentOS-6
2、 yum源搭建成功之后就可以安装gcc了
[[email protected]~]#yum –y install gcc
按理说执行这一条命令之后就可以自动安装gcc了,可是我却遇到了这个问题
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
GPG key retrieval failed: [Errno 14] Could not open/read
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
======================================================================
摸索了好长时间,终于在网上找到了解决方案:
[[email protected]~]#
rpm --import /etc/pki/rpm-gpg/RPM*
[[email protected]~]#rpm
--import /etc/pki/rpm-gpg/RPM*
十分感谢互联网~~