感谢支持
我们一直在努力

在CentOS 6中安装vbox的增强功能 配置软件源RPMforge

CentOS6发布后,很多喜欢RedHat的朋友就迫不及待的下载安装,笔者也是一样,但笔者是将其安装在vbox中,对于vbox的增强功能和配置软件源RPMforge的过程中,也是遇到了各种各样的问题,安装了五次才解决了遇到的问题,话不多说,直面问题


1.关于在CentOS 6中安装vbox的增强功能              具体步骤:1. 切换到root用户  su   -输入root密码
                                  2. 安装gcc  yum install gcc
                                  3. 安装内核对应版本的kernel-devel

                                   # version=`uname -a | awk ‘{print $3}’`


                                   #yum install kernel-devel-${version}


               执行结束后,点击vbox中 设备–》安装增强功能  按照提示,点击出现的光盘的自动运行后,输入root密码就可以正常安装了。



              有人认为需要在第三步后,进行安装dkms(dkms==Dynamic Kernel Module Support (DKMS) )    , 执行yum install dkms,其实并不需要,而且即便你直接安装也会提示失败的,在配置完rpmforge之后,便可以正常安装了


2.配置软件源rpmforge
        

在CentOS下运行yum install flash-plugin或yum installmplayer的时候,提示库里没有找到这个软件?为什么会这样?因为CentOS是RHEL编译过来的,去掉了所有关于版权问题的东西。因此,在没有使用第三方软件库的情况下,很多软件无法用yum install来直接安装。


EPEL(Extra Packages for EnterpriseLinux)软件库提供为RHEL系列(4.x、5.x、6.x等等)重新编译的Fedora组件。这个软件库在不替换系统组件方面下了功夫。在某些情况下它尝试直接针对CentOS兼容性的问题,但坚决否定软件库间的兼容性是目标之一。当它与其它第三方软件库混合使用时,问题可能会出现。故此,当你使用EPEL时,尤其是当你亦会运用其它件库的组件时,请确保你使用yum的Priorities插件。


RPMForge库现在已经拥有超过10000种的CentOS的软件包,被CentOS社区认为是最安全也是最稳定的一个第三方软件库。


下面讲解下如何使用EPEL与RPMForge、RPMFusion软件仓库:


一、安装yum-priorities插件。

这个插件是用来设置yum在调用软件源时的顺序的。因为官方提供的软件源,都是比较稳定和被推荐使用的。因此,官方源的顺序要高于第三方源的顺序。如何保证这个顺序,就需要安装yum-priorities这插件了。


[root@CentOS ~]# yum install yum-priorities


安装完后需要设置/etc/yum.repos.d/目录下的.repo相关文件(如CentOS-Base.repo),在这些文件中插入顺序指令:priority=N (N为1到99的正整数,数值越小越优先),一般的配置是这样的:
[base], [addons], [updates], [extras] … priority=1
[CentOSplus],[contrib] … priority=2
其他第三的软件源为:priority=N (推荐N>10)


如我的CentOS-Base.repo配置为(CentOS 6.0):
# 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-6
priority=1


#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-6
priority=1


#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-6
priority=1


#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-6
priority=1


#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-6
priority=2

#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-6
priority=2二、下载与安装相应EPEL的rpm文件包
1、下载与安装EPEL的rpm文件包

32位系统
[root@CentOS ~]# rpm -ivh http://download.Fedora.RedHat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm


64位系统
[root@CentOS ~]# rpm -ivh http://download.Fedora.RedHat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
 


如果您不清楚您的系统内核,请使用uname -a命令来查看您的内核信息。


2、导入DAG的PGP Key

[root@CentOS ~]# rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6


3、设置/etc/yum.repos.d/epel.repo文件中源的级别,就是添加priority=11这句。

如我的epel.repo文件内容:
[epel]
name=Extra Packages for Enterprise Linux 6 – $basearch
#baseurl=http://download.Fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.Fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
priority=11


[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 – $basearch – Debug
#baseurl=http://download.Fedoraproject.org/pub/epel/6/$basearch/debug
mirrorlist=https://mirrors.Fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 6 – $basearch – Source
#baseurl=http://download.Fedoraproject.org/pub/epel/6/SRPMS
mirrorlist=https://mirrors.Fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1三、下载与安装相应rpmforge的rpm文件包
1、下载rpmforge的rpm文件包

32位系统
[root@CentOS ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm


64位系统
[root@CentOS ~]# wget rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
 


2、安装DAG的PGP Key

[root@CentOS ~]# rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt


3、验证rpmforge的rpm文件包

[root@CentOS ~]# rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm
如果报XXX not an rpm package的错,查看是否wget下载的包不完整,包的大小是12K


4、安装rpmforge的rpm文件包

[root@CentOS ~]# rpm -ivh rpmforge-release-0.5.2-2.el6.rf.*.rpm


5、设置/etc/yum.repos.d/rpmforge.repo文件中源的级别,就是添加priority=12这句,如我的rpmforge.repo文件内容:

### Name: RPMforge RPM Repository for RHEL 6 – dag
### URL: http://rpmforge.net/
[rpmforge]
name = RHEL $releasever – RPMforge.net – dag
baseurl = http://apt.sw.be/RedHat/el6/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/RedHat/el6/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1
priority=12


[rpmforge-extras]
name = RHEL $releasever – RPMforge.net – extras
baseurl = http://apt.sw.be/RedHat/el6/en/$basearch/extras
mirrorlist = http://apt.sw.be/RedHat/el6/en/mirrors-rpmforge-extras
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1


[rpmforge-testing]
name = RHEL $releasever – RPMforge.net – testing
baseurl = http://apt.sw.be/RedHat/el6/en/$basearch/testing
mirrorlist = http://apt.sw.be/RedHat/el6/en/mirrors-rpmforge-testing
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-testing
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1



四、测试
1、测试升级


[root@CentOS ~]# yum check-update


输出信息应该会有以下两行:


Loading “priorities” plugin

XX packages excluded due to repository priority protections


2、测试各插件是否生效

[root@CentOS ~]# yum check-update
如果出现类似以下输出,则表示配置成功。
Loaded plugins: fastestmirror, priorities, refresh-packagekit
Loading mirror speeds from cached hostfile
下面是一长串软件列表,最后一列形如:
epel   
rpmforge
base
说明各个软件包的来源。

赞(0) 打赏
转载请注明出处:服务器评测 » 在CentOS 6中安装vbox的增强功能 配置软件源RPMforge
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏