红联Linux门户
Linux帮助

yum入门[转载]

发布时间:2008-10-04 22:29:19来源:红联作者:you_me
原文地址:http://hi.baidu.com/guixiaolan/blog/item/14c39f0a713c071e94ca6b0e.html
=====================
1.查看是否安装了yum软件
rpm -qa yum
如果没有,那么先安装!

2.配置yum后才能使用
首选项文件是/etc/yum.conf
你可以在[main]中修改首选项
例如exclude=kernel kernel-source表示更新除开内核的软件
然后
#cd /etc/yum.repos.d
修改下面三个文件fedora-core.repo,fedora-updates.repo,fedora-extras.repo

例:fedora-core.repo,修改下面的[core],[core-source]两项
[root@guixiaolan yum.repos.d]# cat fedora-core.repo
[core]
name=Fedora Core $releasever - $basearch
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/
baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/
#mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-$releasever
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY

[core-debuginfo]
name=Fedora Core $releasever - $basearch - Debug
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/debug/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY

[core-source]
name=Fedora Core $releasever - Source
baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/download.fedora.redhat.com/pub/fedora/linux/core/$releasever/source/SRPMS/
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/source/SRPMS/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY

重点说明:
①在[core]中
baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/
baseurl地址就是更新地址,你可以上网找,我们还可以看到上面的一个地址前面有一个#,说明上面一个地址已经被注释(屏蔽)掉了,因为如果你要到红帽公司的网站更新,那将是一个非常弱智的选择!
$releasever表示你操作系统的版本号,可以自动检测.你也可以自己修改,你是的操作系统是FC6,那么你就可以将其直接改为6
$basearch表示你机器的型号,一般是i386,你也可以自己修改成i386
enabled=1表示有效,如果是0表示无效
注意:
这个地址是repodata的父目录,而且它要是在core目录下
我们还注意到[core-source]的地址和[core]的地址不同,这个地址要在core目录的source目录下,也是repodata的父目录


如此类推你可以修改fedora-updates.repo,fedora-extras.repo这两个文件
注意要找到它们的更新目录地址,在updates,extras目录下,都是repodata的父目录!(仔细在服务器目录找一下)

大家可以看一下我的,参考一下!
extras文件如下:
[extras]
name=Fedora Extras $releasever - $basearch
baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/
#mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-extras-$releasever
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-extras
gpgcheck=0

[extras-debuginfo]
name=Fedora Extras $releasever - $basearch - Debug
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/$basearch/debug/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-extras
gpgcheck=1

[extras-source]
name=Fedora Extras $releasever - Source
baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/SRPMS/
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/$releasever/SRPMS/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-extras
gpgcheck=1

updates文件如下:
[updates]
name=Fedora Core $releasever - $basearch - Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
#mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc$releasever
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora

[updates-debuginfo]
name=Fedora Core $releasever - $basearch - Updates - Debug
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/debug/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora

[updates-source]
name=Fedora Core $releasever - Updates Source
baseurl=ftp://ftp3.tsinghua.edu.cn/mirror/download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/SRPMS/
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/SRPMS/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora

3.yum的参数用法

①check-update
这是更新的第一步,下载头文件

②update
yum update firefox
开始更新

③list,info
列表和查看信息,它们的后面还可以加参数installed(已经安装的),updates(更新的),extras(额外的)
用法:
yum list installed(如此类推)
yum info kernel(查看kernel的信息,是否有更新可用)

④provides
提供哪些文件

⑤search
yum search kernel
搜索文件

⑥install
单独安装某个软件

⑦upgrade
升级某个软件

⑧remove
清除某个软件

⑨clean all
清除下载的或缓存中的没用的文件
文章评论

共有 1 条评论

  1. Gccgie 于 2008-10-05 00:11:44发表:

    顺带学习