Linux系统yum的使用与说明


YUM的使用与说明

Yum的建立:进入 /etc/yum.repos.d目录后建立local.repos文件,编辑些文件如下:

[Server]

Name=server

baseurl=file:///media/cdrom/Server

enabled=1

gpgcheck=0

 

[root@test etc]# yum update   --更新rpm

[root@test etc]# yum list       --显示rpm


说明:baseurl=file://    https://    ftp://

 

Yum配置信息 /etc/yum.conf

[root@test etc]# cat yum.conf

[main]

cachedir=/var/cache/yum/$basearch/$releasever

keepcache=0

debuglevel=2

logfile=/var/log/yum.log

exactarch=1

obsoletes=1

gpgcheck=1

plugins=1

installonly_limit=3

 

#  This is the default, if you make this bigger yum won't see if the metadata

# is newer on the remote and so you'll "gain" the bandwidth of not having to

# download the new metadata and "pay" for it by yum not having correct

# information.

#  It is esp. important, to have correct metadata, for distributions like

# Fedora which don't keep old packages around. If you don't like this checking

# interupting your command line usage, it's much better to have something

# manually check the metadata once an hour (yum-updatesd will do this).

# metadata_expire=90m

 

# PUT YOUR REPOS HERE OR IN separate files named file.repo

# in /etc/yum.repos.d

[root@test etc]#

 

下面简单的对这一文件作简要的说明:

cachediryum缓存的目录,yum在此存储下载的rpm包和数据库,一般是/var/cache/yum

debuglevel:除错级别,0──10,默认是2

logfileyum的日志文件,默认是/var/log/yum.log

exactarch,有两个选项10,代表是否只升级和你安装软件包cpu体系一致的包,如果设为1,则如你安装了一个i386rpm,则yum不会用686的包来升级。

gpgchkeck= 10两个选择,分别代表是否是否进行gpg校验,如果没有这一项,默认好像也是检查的。

 

Yum的常用命令:

1.列出所有可更新的软件清单

命令:yum check-update

 

2.安装所有更新软件

命令:yum update

 

3.仅安装指定的软件

命令:yum install

 

4.仅更新指定的软件

命令:yum update

 

5.列出所有可安裝的软件清单

命令:yum list

 

6.YUM安装软件包

命令:yum install

 

7.YUM删除软件包

命令:yum remove

 

8.使用YUM查找软件包

命令:yum search

 

9.列出所有可更新的软件包

命令:yum list updates

 

10.列出所有已安装的软件包

命令:yum list installed

 

11.列出所有已安装但不在 Yum Repository 內的软件包

命令:yum list extras

 

12.列出所有可更新的软件包信息

命令:yum info updates

 

13.列出所有已安裝的软件包信息

命令:yum info installed

 

14.列出所有已安裝但不在 Yum Repository 內的软件包信息

命令:yum info extras

 

15.列出软件包提供哪些文件

命令:yum provides

 

16.清除缓存目录(/var/cache/yum)下的软件包

命令:yum clean packages

 

17.清除缓存目录(/var/cache/yum)下的 headers

命令:yum clean headers

 

18.清除缓存目录(/var/cache/yum)下旧的 headers

命令:yum clean oldheaders

 

19.清除缓存目录(/var/cache/yum)下的软件包及旧的headers

命令:yum clean, yum clean all (= yum clean packages; yum clean oldheaders)

 

 

 

命令帮助信息:

[root@test yum.repos.d]# yum -help

Loaded plugins: aliases, changelog, downloadonly, kabi, presto, refresh-

              : packagekit, security, tmprepo, verify, versionlock

Loading support for kernel ABI

Usage: yum [options] COMMAND

 

List of Commands:

 

alias          Adds or lists aliases

changelog      Display changelog data, since a specified time, on a group of packages

check          Check for problems in the rpmdb

check-update   Check for available package updates

clean          Remove cached data

deplist        List a package's dependencies

distribution-synchronization Synchronize installed packages to the latest available versions

downgrade      downgrade a package

erase          Remove a package or packages from your system

groupinfo      Display details about a package group

groupinstall   Install the packages in a group on your system

grouplist      List available package groups

groupremove    Remove the packages in a group from your system

help           Display a helpful usage message

history        Display, or use, the transaction history

info           Display details about a package or group of packages

install        Install a package or packages on your system

list           List a package or groups of packages

load-transaction load a saved transaction from filename

makecache      Generate the metadata cache

provides       Find what package provides the given value

reinstall      reinstall a package

repolist       Display the configured software repositories

resolvedep     Determine which package provides the given dependency

search         Search package details for the given string

shell          Run an interactive yum shell

update         Update a package or packages on your system

update-minimal Works like update, but goes to the 'newest' package match which fixes a problem that affects your system

updateinfo     Acts on repository update information

upgrade        Update packages taking obsoletes into account

verify-all     Verify packages and display data on bad verifications

verify-multilib Verify packages and display data on bad verifications

verify-rpm     Verify packages and display data on bad verifications

version        Display a version for the machine and/or available repos.

versionlock    Control package version locks.

 

 

Options:

  -h, --help            show this help message and exit

  -t, --tolerant        be tolerant of errors

  -C, --cacheonly       run entirely from system cache, don't update cache

  -c [config file], --config=[config file]

                        config file location

  -R [minutes], --randomwait=[minutes]

                        maximum command wait time

  -d [debug level], --debuglevel=[debug level]

                        debugging output level

  --showduplicates      show duplicates, in repos, in list/search commands

  -e [error level], --errorlevel=[error level]

                        error output level

  --rpmverbosity=[debug level name]

                        debugging output level for rpm

  -q, --quiet           quiet operation

  -v, --verbose         verbose operation

  -y, --assumeyes       answer yes for all questions

  --version             show Yum version and exit

  --installroot=[path]  set install root

  --enablerepo=[repo]   enable one or more repositories (wildcards allowed)

  --disablerepo=[repo]  disable one or more repositories (wildcards allowed)

  -x [package], --exclude=[package]

                        exclude package(s) by name or glob

  --disableexcludes=[repo]

                        disable exclude from main, for a repo or for

                        everything

  --obsoletes           enable obsoletes processing during updates

  --noplugins           disable Yum plugins

  --nogpgcheck          disable gpg signature checking

  --disableplugin=[plugin]

                        disable plugins by name

  --enableplugin=[plugin]

                        enable plugins by name

  --skip-broken         skip packages with depsolving problems

  --color=COLOR         control whether color is used

  --releasever=RELEASEVER

                        set value of $releasever in yum config and repo files

  --setopt=SETOPTS      set arbitrary config and repo options

  --disablepresto       disable Presto plugin and don't download any deltarpms

 

  Plugin Options:

    --changelog         Show changelog delta of updated packages

    --downloadonly      don't update, just download

    --downloaddir=DLDIR

                        specifies an alternate directory to store packages

    --security          Include security relevant packages

    --bugfixes          Include bugfix relevant packages

    --cve=CVE           Include packages needed to fix the given CVE

    --bz=BZ             Include packages needed to fix the given BZ

    --sec-severity=SEVERITY

                        Include security relevant packages, of this severity

    --advisory=ADVISORY

                        Include packages needed to fix the given advisory

    --tmprepo=[url]     enable one or more repositories from URLs

    --tmprepo-keep-created

                        keep created direcotry based tmp. repos.

    --verify-filenames=VERIFY_FILENAMES

                        Only verify files matching this

    --verify-configuration-files=VERIFY_CONFIGURATION_FILES

                        Verify files tagged as configuration files

[root@test yum.repos.d]#


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26148431/viewspace-1143442/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26148431/viewspace-1143442/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值