yum的部署及使用

1.yum的管理

1)了解yum

特点:

yum是基于rpm包的软件管理机制;自动解决rpm包之间的依赖关系;能够在redhat系列系统中完成安全更新、安装、卸载、查询等操作。C/S结构(client|server)。

2)yum源服务器配置(repositories,软件仓库)

yum源支持协议:file(本地使用),ftp(ftp上传下载服务),http(httpd服务,apache、nginx)

a.配置ftp的yum源:

S端:

配置本地yum源,

yum -y install vsftpd

mkdir /var/ftp/rhel

mount  /dev/cdrom  /var/ftp/rhel   ##rhel光盘,iso:mount -o loop,rsync同步

/etc/init.d/vsftpd  start

chkconfig vsftpd on


C端的配置:

vi  /etc/yum.repos.d/rhel.repo

[ftp]   ##软件仓库的类别

name=ftp   ##软件仓库的名称

baseurl=ftp://IP/rhel    ##软件仓库访问的url,注意repodata目录是具体的位置

enabled=1  ##软件仓库的开关,0表示关,1表示开

gpgcheck=0   ##是否检查公钥,0表示不检查,1表示检查

:wq


C端使用:增、删、改、查

增:install /groupinstall

案例:

yum  -y  install  wget  lftp  gpm  net-tools  bind-utils

yum  -y  groupinsall Desktop  

yum  -y  groupinstall "Development Tools"   ##安装开发工具软件组


删:remove/groupremove 

yum  -y  remove  mysql-server  ##yum卸载操作会自动的卸载依赖软件包,可能会导致其他软件无法使用,推荐rpm -e  --nodeps的方式卸载

yum  -y  groupremove  Desktop   ##卸载桌面


改:更新update 

案例:

yum  -y  update 

echo  "30  0  * *  *  yum -y  update "  >/var/spool/cron/root


查:info,list,repolist,search,grouplist

yum  search  bind

yum  repolist   ##列出可用源

yum  grouplist  ##列出软件分组


扩展:

a.S端的配置:httpd

yum  -y  install  httpd

mkdir  /var/www/html/rhel

mount  /dev/cdrom  /var/www/html/

/etc/init.d/httpd  start

C端只需将baseurl改为 "baseurl=http://IP/rhel"

b.个人下载的其他软件,或自定义rpm软件配置yum源

yum  -y  install createrepo

mkdir  /var/ftp/other  ##将所有的rpm包复制到other中

cd  /var/ftp/other

createrepo  -g  /var/ftp/rhel/repodata/repomd.xml  ./   ##以rhel的系统光盘的repodata为依据,生出当前目录下所有rpm包的repodata

C端配置:

[other]

name=other

baseurl=ftp://IP/other

enabled=1

gpgcheck=0

:wq









本文转自信自己belive51CTO博客,原文链接:http://blog.51cto.com/11638205/1982369 ,如需转载请自行联系原作者






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值