ITPub博客

首页 > Linux操作系统 > Linux操作系统 > rpm的使用以及yum的配置

rpm的使用以及yum的配置

原创 Linux操作系统 作者:tolilong 时间:2012-10-21 17:04:42 0 删除 编辑
mount /dev/cdrow   /media        mount上去
---=======================================================
rpm的安装,更新,查询,卸载
查询
rpm -qa | grep sysstat     查询安装的软件
rpm -qi sysstat            安装的详细信息
rpm -ql sysstat            列出安装目录
rpm -qc sysstat            安装的配置文件
rpm -qd sysstat            帮助文档
rpm -qf /bin/ls            查询是那个软件包安装的

rpm -qpi zlib-1.2.3-3.i386.rpm
rpm -qpl zlib-1.2.3-3.i386.rpm       没有安装之前查看

安装(install)
-i = install
-U = upgrade 即可升级也可安装
-F = 更新,为安装则放弃安装

-h         以#显示安装进度条
-v         显示安装过程中的详细信息
--force    强制安装所指定rpm package
--nodeps   安装,更新,升级时,忽略依赖关系

卸载
rpm -e rpm-package   卸载rpm package

---=========================================================================

配置yum
搭建本地的yum,yum主要是解决了包的依赖关系.
1.配置文件./etc/yum.repos.d/rhel-debuginfo.repo 
  yum配置文件必须以repo结尾,前面的无所谓,rhel-debuginfo.repo 是配置文件模板
2.配置local.repo配置文件
[root@oracle10g yum.repos.d]# cp rhel-debuginfo.repo local.repo
[root@oracle10g yum.repos.d]# ll
total 12
-rw-r--r-- 1 root root 254 Oct 22 14:51 local.repo
-rw-r--r-- 1 root root 254 Aug  4  2009 rhel-debuginfo.repo
[root@oracle10g yum.repos.d]# more local.repo 
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/De
buginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
修改local.repo,file:///media/Server是mount上去的cdrom   (mount /dev/cdrow  /media)
修改后local.repo文件内容为:
[root@oracle10g yum.repos.d]# cat local.repo 
[rhel-debuginfo]
name=Red Hat Enterprise Linux local repo
baseurl=file:///media/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
清空yum缓存
[root@oracle10g yum.repos.d]# yum clean all
Loaded plugins: rhnplugin, security
Repository rhel-debuginfo is listed more than once in the configuration
Cleaning up Everything


3.yum使用 
 输入yum 之后,会跳出yum的使用方法.
[root@oracle10g yum.repos.d]# yum 
Loaded plugins: rhnplugin, security
Repository rhel-debuginfo is listed more than once in the configuration
You need to give some command
usage: yum [options] COMMAND

List of Commands:

check-update   Check for available package updates
clean          Remove cached data
deplist        List a package's dependencies
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
info           Display details about a package or group of packages
info-security  Returns security data for the packages listed, that affects your system
install        Install a package or packages on your system
list           List a package or groups of packages
list-security  Returns security data for the packages listed, that affects your system
localinstall   Install a local RPM
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
upgrade        Update packages taking obsoletes into account


options:
  -h, --help            show this help message and exit
  -t, --tolerant        be tolerant of errors
  -C                    run entirely from cache, don't update cache
  -c  [config file]     config file location
  -R  [minutes]         maximum command wait time
  -d  [debug level]     debugging output level
  --showduplicates      show duplicates, in repos, in list/search commands
  -e  [error level]     error output level
  -q, --quiet           quiet operation
  -v, --verbose         verbose operation
  -y                    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
  --security            Include security relevant packages
  --cve=CVE             Include packages needed to fix the given CVE
  --bz=BZ               Include packages needed to fix the given BZ
  --advisory=ADVISORY   Include packages needed to fix the given advisory

4.使用例子
yum install dhcp (yum install dhcp -y)
yum list dhcp
yum erase dhcp

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

上一篇: vi命令简单实用
请登录后发表评论 登录
全部评论

注册时间:2010-07-13

  • 博文量
    406
  • 访问量
    1208666