##软件安装##

rpm 安装(不解决依赖性)

rpm -ivh name.rpm ##安装 ,-v 显示过程,-h指定加密方式为 hash
-e name ##卸载
-ql name ##查询软件生成文件
-qlp name.rpm ##查询软件安装后会生成什么文件
-qa ##查询系统中安装的所有软件名称
-qa | grep name ## 查询软件是否安装
-qf filename ##查看filename 属于那个安装包
-ivh name.rpm –force ##强制安装,但不能忽略依赖性
-ivh name.rpm –nodeps –force ##忽略依赖性并且强制安装
-qi name.rpm ##查看软件信息
-Kv name.rpm ## 检测软件包是否被篡改
-qp name.rpm –scripts ##检测软件在安装或卸载过程中执行的动作

yum 安装(解决依赖性但不能装第三方软件)

yum installd softwarename ##安装
remove softwarename ##卸载
list all ## 列出所有软件名称
list installd ##列出已经安装的软件名称
clean all ##清空yum缓存
search softwarename ##根据软件信息搜索软件名称
whatprovides filename ##载yum源中查找包含filename文件的软件包
update ##更新软件
reinstall softwarename ##重新安装
info softwarename ##查看软件信息
groups list ##查看软件组信息
group info softwarename ##查看组内包含的软件

1.本地yum源搭建

虚拟机上搭建本地yum源
在不运行的情况下先 add 个IDE CDROM
添加搭载源

本地yum源搭建代码

mkdir  /rhel7.0     ##创建目录
mount  /dev/cdrom    /rhel7.0  将镜像挂载在这个目录下
cd /rhel7.0  ## cd 到该目录下  
ls   
rhel-server-7.0-x86_64-dvd.iso ## 查看是否有这个镜像
vim /etc/yum.repos.d/yum.repo  ## 设置加载源
[rhel7.0]  
name=rhel7.0    
baseurl=file:///mnt  ##本地目录下
gpgcheck=0       ##不开启验证

yum repolist   ##列出仓库

2.网络yum源搭载

mkdir  /iso  ##创建目录
mv rhel-server-7.0-x86_64-dvd.iso   /iso ##将镜像mv到 /iso
df   ##
mount /iso/rhel-server-7.0-x86_64-dvd.iso  /mnt ##将镜像挂载在  /mnt
cd /mnt
ls
cd  /etc/yum.repos.d 
rm -fr  /etc/yum.repos.d  ##删除以前的yum.repos
vim /etc/yum.repos.d/yum.repo  ## 设置加载源
[rhel7.0]  
name=rhel7.0    
baseurl=file:///mnt  ##本地目录下
gpgcheck=0       ##不开启验证

systemctl  start  httpd         ##开启阿帕其
systemctl stop firewaald        ##关闭防火墙
systemctl  mask  firewalld      ## 弃用
mkdir   /var/www/html/rhel7.0
mount /iso/rhel-server-7.0-x86_64-dvd.iso  /var/www/html/rhel7.0## 挂载在网络源 (重启需要重新挂载)
echo "mount /iso/rhel-server-7.0-x86_64-dvd.iso  /var/www/html/rhel7.0" >> /etc/rc.d/rc.local
## 一直挂载,重启还在
chmod + x /etc/rc.d/rc.local ##给权限

用虚拟机测试

 vim /etc/yum.repos.d/yum.repo  ##设置加载源
 [rhel7.0]
name=rhel7.0
baseurl=http://172.25.154.2/rhel7.0   ##真机ip
gpgcheck=0


[software]
name=software
baseurl=file:///mnt
gpgcheck=0

yum  repolist  ##列出yum仓库 

关闭网络源

rm  - fr /var/www             ##删除/var/www  
systemctl  unmask  firewalld  ##
systemctl  start   firewalld  ##开启防火墙
rm  - fr /etc/yum.repos.d/*   ##删除yum源
mv /iso/rhel-server-7.0-x86_64-dvd.iso  /home/Desktop       ## 将镜像移出 /iso
rm  - fr  /iso      ## 删除 /iso

3.yum的黑名单

vim /etc/yum.conf   ##进入编辑  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
exclude=*.i686     ##所有的.i686的软件都不显示
#  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

4.第三方yum 源搭建

mkdir  repod   ##创建目录,只放第三方的软件
createrepo  -v  /repod    ##扫描repod下的第三方软件
xxxxxx.x86_64.rpm  repodata ##第三方软件可以用 yum install 安装
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值