感谢支持
我们一直在努力

Fedora8下用yum来安装RPM包

Linux当中很有软件通常不是安装一个RPM包就可以解决的;很多软件包需要编译,这时软件包所对应的kernel和你c语言lib库版本,甚至你的 gcc编译器都有可能影响软件安装,好在现在的开源社区越做越好,在Fedora8下绝大多数能想到的包都有rpm,反正也不是做服务,用不着安全和优化,直接用这些rpm就好了。


如果是Fedora安装盘上直接有的包,在”添加/删除软件”里直接搜一下装,装完自动更新会找到最新版帮你升级。要是盘上没有的,比如mplayer自己下载就麻烦了,还不知道关联性中还需要哪些包。用Yellow Dog Updater,Modified(yum)可以帮助你从已经配置好的软件库中下载和安装软件包,甚至会考虑到软件包之间的依赖关系。这个是安装软件包最好的方法,几乎不用干预。记得以前配yum还比较麻烦的,现在的Fedora8已经做的很好了,直接就能用,要是闲官方下载包速度太慢,就自己添加第三方软件库,真是好用好舒服的说。


一.了解yum的配置
在Fedora8下,yum的配置文件在/etc/yum.conf


[main]
cachedir=/var/cache/yum 缓存目录
keepcache=0 确定缓存文件是否要保存
debuglevel=2 调试级别
logfile=/var/log/yum.log 日志文件的位置
exactarch=1 这选项在yum更新的时候有用,他用来确定是否在i386上更新i686的软件包,选1的话是不更新(用的时候还要怎么试还没试过)
obsoletes=1 这个选项在yum(8)中有详细的介绍,他是一个命令行参数,我们以后可以去看看
gpgcheck=1 是否检查gpg GNU Privacy Guard可以用于加密
plugins=1 是否显示插件,有必要设成1,这选项在默认的时候是0。
metadata_expire=1800
installonly_limit=2


# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

这里所谓的repos其实就是软件库

二.了解yum软件库配置
打开/etc/yum.repos.d可以看到软件库


[lxuser@Fedora8 yum.repos.d]$ ls
fedora-development.repo fedora.repo fedora-updates-testing.repo
Fedora-install-media.repo fedora-updates.repo



添加一个软件库的准备工作是要明确你需要添加的软件库的确切位置GPG密钥(GNU Private Guard ,一种密钥方法,实现RFC2440 中定义的OpenGPG标准,自由软件,GPG提供命令行形式的应用,可以轻松集成到其它应用程序中)


打开fedora.repo


[root@fedora8 yum.repos.d]# vi fedora.repo
[fedora]
name=Fedora $releasever – $basearch
failovermethod=priority
#baseurl=http://download.fedora.RedHat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY


[fedora]
name=Fedora $releasever – $basearch
failovermethod=priority
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY


[fedora-debuginfo]
name=Fedora $releasever – $basearch – Debug
failovermethod=priority
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY


[fedora-source]
name=Fedora $releasever – Source
failovermethod=priority
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
$releasever 其实就是你fedora的版本号
$basearch 这个对于我这电脑来说就是i386
#baseurl 是基本地址
mirrorlist 镜像列表
enabled=1 本repo是否激活
gpgcheck=1 是否启用gpg检查
gpgkey 是GPG密钥的地址



据我所知道的yum的方法(还不一定准确)yum会检查 baseurl/repodata/repomd.xml 这个索引文件,还有PGPKEY,找不到的会失败。所以添加软件库的时候要注意一下,特别是第3方软件库

三.添加rpm.livna.org软件库
在上面Fedora.repo文件最后新添加如下内容


[livna]
name=livna $releasever – $basearch
baseurl=http://rpm.livna.org/fedora/$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://rpm.livna.org/RPM-LIVNA-GPG-KEY



似乎单独保存为livna.repo也可以。注意gpgkey的位置,我在尝试时就是搞错了这个地址,所有包都下载完了,等着要装了还提示:


warning: rpmts_HdrFromFdn Header V3 DSA signature: NOKEY, key ID a109b1ec


baseurl直接填 http://rpm.livna.org/fedora/8/i386/ 也是可以的。


记得添加完要重启yum服务
[root@fedora8 yum.repos.d]# /sbin/service yum-updatesd restart


停止 yum-updatesd:[确定]
启动 yum-updatesd:[确定]


四.体验用yum安装软件包
现在Linux上用sopcast也能看网络电视的,但要有mplayer的支持,先到root下装mplayer


[root@fedora8 yum.repos.d]# yum install mplayer
livna 100% |=========================| 2.1 kB 00:00
fedora 100% |=========================| 2.1 kB 00:00
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package mplayer.i386 0:1.0-0.88.rc2.lvn8 set to be updated
–> Processing Dependency: libcucul.so.0 for package: mplayer
–> Processing Dependency: liblirc_client.so.0 for package: mplayer
–> Processing Dependency: libdvdread.so.3 for package: mplayer
–> Processing Dependency: libdvdnavmini.so.4 for package: mplayer
–> Processing Dependency: libenca.so.0 for package: mplayer
–> Processing Dependency: libcaca.so.0 for package: mplayer
–> Processing Dependency: libxvidcore.so.4 for package: mplayer
–> Processing Dependency: libdca.so.0 for package: mplayer
–> Processing Dependency: libaa.so.1 for package: mplayer
–> Running transaction check
—> Package enca.i386 0:1.9-3.fc6 set to be updated
—> Package libcaca.i386 0:0.99-0.3.beta11.fc8 set to be updated
—> Package libdvdread.i386 0:0.9.7-3.fc8 set to be updated
—> Package xvidcore.i386 0:1.1.3-1.lvn8 set to be updated
—> Package aalib.i386 0:1.4.0-0.13.rc5.fc8 set to be updated
—> Package lirc.i386 0:0.8.2-2.fc8 set to be updated
—> Package libdca.i386 0:0.0.5-2.lvn8 set to be updated
—> Package libdvdnav.i386 0:0.1.10-4.20070503.lvn8 set to be updated
–> Finished Dependency Resolution


Dependencies Resolved


==================================
Package Arch Version Repository Size
==================================
Installing:
mplayer i386 1.0-0.88.rc2.lvn8 livna 4.3 M
Installing for dependencies:
aalib i386 1.4.0-0.13.rc5.fc8 fedora 75 k
enca i386 1.9-3.fc6 fedora 118 k
libcaca i386 0.99-0.3.beta11.fc8 fedora 160 k
libdca i386 0.0.5-2.lvn8 livna 108 k
libdvdnav i386 0.1.10-4.20070503.lvn8 livna 123 k
libdvdread i386 0.9.7-3.fc8 fedora 66 k
lirc i386 0.8.2-2.fc8 fedora 254 k
xvidcore i386 1.1.3-1.lvn8 livna 240 k


Transaction Summary
===================================
Install 9 Package(s)
Update 0 Package(s)
Remove 0 Package(s)


Total download size: 5.5 M
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdn Header V3 DSA signature: NOKEY, key ID a109b1ec
Importing GPG key 0xA109B1EC “Livna.org rpms <rpm-key@livna.org>” from http://rpm.livna.org/RPM-LIVNA-GPG-KEY
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: libdvdnav ######################### [1/9]
Installing: libdca ######################### [2/9]
Installing: lirc ######################### [3/9]
Installing: aalib ######################### [4/9]
Installing: xvidcore ######################### [5/9]
Installing: libdvdread ######################### [6/9]
Installing: libcaca ######################### [7/9]
Installing: enca ######################### [8/9]
Installing: mplayer ######################### [9/9]


Installed: mplayer.i386 0:1.0-0.88.rc2.lvn8
Dependency Installed: aalib.i386 0:1.4.0-0.13.rc5.fc8 enca.i386 0:1.9-3.fc6 libcaca.i386 0:0.99-0.3.beta11.fc8 libdca.i386 0:0.0.5-2.lvn8 libdvdnav.i386 0:0.1.10-4.20070503.lvn8 libdvdread.i386 0:0.9.7-3.fc8 lirc.i386 0:0.8.2-2.fc8 xvidcore.i386 0:1.1.3-1.lvn8
Complete!



装完看看菜单,咦,怎么没有mplayer,再打开”添加/删除软件”,和mplayer相关的包名字都有了,即便有些包是没装的,哦看见一个叫mplayer-gui的,估计就是差这个了,虽然直接在这里勾上也能下载装,但yum还没完过瘾,再来一次


[root@fedora8 yum.repos.d]# yum install mplayer-gui
Existing lock /var/run/yum.pid: another copy is running as pid 5735.
Another app is currently holding the yum lock; waiting for it to exit…
Another app is currently holding the yum lock; waiting for it to exit…


Exiting on user cancel.
[root@fedora8 yum.repos.d]# yum install mplayer-gui
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package mplayer-gui.i386 0:1.0-0.88.rc2.lvn8 set to be updated
–> Finished Dependency Resolution


Dependencies Resolved


========================================
Package Arch Version Repository Size
========================================
Installing:
mplayer-gui i386 1.0-0.88.rc2.lvn8 livna 3.7 M


Transaction Summary
===================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)


Total download size: 3.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): mplayer-gui-1.0-0. 100% |=========================| 3.7 MB 00:09
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: mplayer-gui ######################### [1/1]


Installed: mplayer-gui.i386 0:1.0-0.88.rc2.lvn8
Complete!



再看看菜单,有mplayer了,这样今后用yum装东西都方便了

五.yum可能常用的命令
安装: yum install ‘软件名’
列表: yum list |less
查找: yum provides ‘软件名’
单个软件升级: yum update ‘软件名’
全部升级: yum update
删除已安装的包: yum clean packages 删除的是/var下的已下载的包


六.添加光盘为安装源
和上面类似,新建配置文件,内容为


[cd]
name=livna $releasever – $basearch
baseurl=file:///mnt/cdrom 这个是你挂载光驱的目录
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY 这个是光盘上的GPG密钥。



其实Fedora8更新的包很频繁很多,添加光盘为源似乎不必要。

赞(0) 打赏
转载请注明出处:服务器评测 » Fedora8下用yum来安装RPM包
分享到: 更多 (0)

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

支付宝扫一扫打赏

微信扫一扫打赏