12 Linux 中的软件包的类型

Linux 中的软件包的类型

#DEB UBlinux DEBlinux
#RPM redhat centos fadora
#bz2|gz|xz 需要源码安装需要编译
绿色软件,直接可用

注意在rhel8 中只能使用绿色软件,源码编译软件和prm软件

##软件包的名称架构
dhcp-server 4.3.6-30.el8.x86_64.rpm
1 2 3 4 5
1 软件名称
2 软件版本
3 软件的授权协议版本
4 软件架构
5 软件类型后缀

##rpm命令管理软件包

rpm -ivh	安装参数组合
       -a		所有
       -f          文件
       -p		软件包
      -q		查询
      -l		软件安装文件列表
      -e		卸载
      -c 		配置文件
      -d    	说明
(以上一般配合q一起使用 eg:-ql)
     --info	软件信息
     --force 	强制
     --nodeps   	忽略依赖性
     --scripts	查询软件在安装或卸载过程中的运行脚本
     --Kv 	检测软件md5校验码
     -V	 	检测已安装软件在系统中的文件被修改信息

##本地软件仓库的搭建
仓库的作用:
自动解决依赖关系 则需要搭建系统软件仓库

方法:
1在系统中加载安装系统时使用的安装镜像
在这里插入图片描述

2编写软件仓库文件
在这里插入图片描述

[Appstream] 名称
name=appstream 描述
baseurl=file:///westos/AppStream 地址
gpgcheck=0 不检测gpgkey(跳过授权)
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-redat-release
enabled=1|0

[BaseOS]
name=Baseos
basurl=file:///westos/BaseOS/
gpgcheck=0
在这里插入图片描述

测试:

dnf install gcc -y

#dnf软件管理命令

dnf	repolist		列出仓库信息
	    clean all		清除缓存 (var/cache/dnf)
	    list all		
	    list available		列出未安装软件
	    list installed
	    install
	    remove	
	    reinstall		重新安装
	    search			搜索
	    whatprovides		搜索包含文件的软件包
	    history			dnf执行历史
	    history info		详细
	    group list		列出软件组
	    group list --installed 
	    group list --available
	    group list --hidden	列出隐藏软件组
	    group install		安装软件组
	    group info		查看软件组信息

下载安装包
前提:dnf install yum-utils -y 下载此软件

yumdownloader 下载软件包到本机指定位置
在这里插入图片描述
yumdownloader httpd 下载仓库中指定软件的安装包到当前目录

yumdownloader --destdir=/mnt 安装到mnt目录
yumdownloader httpd --destdir=/mnt --resolve 下载指定安装包和依赖性到/mnt目录
在这里插入图片描述

##网络软件仓库的搭建
方法:
1.利用镜像搭建本地软件仓库
2.安装共享软件

 dnf install httpd -y 共享位置(/var/www/html)

3.启用共享软件apache

systemctl disable --now firewalld
systemctl enable --now httpd

4.建立共享目录

mkdir /var/www/html/rhel8.0

5.挂载镜像到共享目录

umount /westos
mount /isos/rhel-8.2-x86_64-dvd.iso /var/www/html/rhel8.0/
vim /etc/rc.d/rc.local    开机时自动挂载

在这里插入图片描述

chmod +x或755 /etc/rc.d/rc.local  
vim /etc/yum.repos.d/westos.repo 

在这里插入图片描述

6.远程主机westosa中访问资源并书写repo文件

vim /etc/yum.repos.d/westos.repo

[AppStream]
name=AppStream
baseurl=http://172.25.254.77/rhel8.0/AppStream
gpgcheck=0

[BaseOS]
name=BaseOS
baseurl=http://172.25.254.77/rhel8.0/BaseOS
gpgcheck=0

##第三方软件仓库的搭建方法
可以使用dnf命令管理第三方软件
并使第三方软件在网络中共享
步骤:
1.建立共享目录

mkdir /var/www/html/software

2.将第三方软件存进software中 (只能时rpm,压缩包不能用dnf管理)

wget http://172.25.254.250/software/linuxqq_2.0.0-b2-1084_x86_64.rpm

3.采集第三方软件数据生成repodata目录

cd /var/www/html/software/
dnf install createrepo -y
createrepo .

在这里插入图片描述

4.在测试主机中指定第三方共享源

vim /etc/yum.repos.d/westos.repo

在这里插入图片描述

##epel源的使用
在这里插入图片描述

wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
rpm -ivh epel-release-latest-8.noarch.rpm 
dnf search flame

在这里插入图片描述

dnf install flameshot.x86_64

删除

rpm -qa | grep epel  查找
rpm -e epel-release-8-10.el8.noarch
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lll_cf

喜欢

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值