首页    
>>More
使用 yum 管理软件

     [Linux] -  [CentOS yum package ]
2008-05-02

#####
# 使用 yum 管理软件
#################

原文:http://mirror.centos.org/centos/4/docs/html/yum/index.html
适用于 CentOS

su -c 'yum install tsclient'
su -c 'yum groupinstall "MySQL Database"'

su -c 'yum update tsclient'
su -c 'yum groupupdate "MySQL Database"'

su -c 'yum remove tsclient'
su -c 'yum groupremove "MySQL Database"'

su -c 'yum list tsclient'
su -c 'yum list tsclient-0.132'

su -c 'yum search PalmPilot' # search 参数会查询 names, descriptions, summaries and listed package maintainers.
su -c 'yum provides libneon' # provides 参数会查询 packages 包含的文件以及 software 提供的功能。

如果使用 wildcards,需要使用在 wildcards 前使用 \,如"\?", "\*",
su -c 'yum list tsc\*'

注意:
su -c 'yum update' # 会升级系统中所有软件到最新

如何让 yum 每天自动升级系统?
su -c '/sbin/chkconfig --level 345 yum on; /sbin/service yum start'
这一句的作用是通过 chkconfig 设置 yum 在运行级别 345 时自动启动,然后通过 service yum start 立刻运行 yum,这时会调用 /etc/rc.d/init.d/yum,继而调用 /etc/cron.daily/yum.cron,这将启动 cron 服务在每天早上 4 点自动运行 yum。

关于 yum 使用代理:http://mirror.centos.org/centos/4/docs/html/yum/sn-yum-proxy-server.html
By default, yum accesses network repositories with HTTP. All yum HTTP operations use HTTP/1.1, and are compatible with web proxy servers that support this standard. You may also access FTP repositories, and configure yum to use an FTP proxy server. The squid package provides a proxy service for both HTTP/1.1 and FTP connections.

举例:
# vi /etc/yum.conf # 在 yum.conf 中配置将试这台机器的所有用户都使用这个配置。
# The proxy server - proxy server:port number
proxy=http://mycache.mydomain.com:3128
# The account details for yum connections
proxy_username=yum-user
proxy_password=qwerty

# vi ~/.bash_profile # 修改用户的 shell 配置文件,可以让 yum 的代理配置只适用于这个用户
# The Web proxy server, with the username and password for this account
http_proxy="http://yum-user:qwerty@mycache.mydomain.com:3128"
export http_proxy

Simpleman 发表于 17:27  |  阅读全文  |  评论_0  |  引用_0
分页共1页 1