ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Linux第8章:系统中的软件管理

2021-10-23 13:05:55  阅读:210  来源: 互联网

标签:dnf etc ## 系统 westos -- Linux 软件


1.Linux中软件包的类型 1. DEB #UBlinux DEBlinux 2. RPM #redhat centOS fadora 3. bz2 | gz | xz # 1. 需要源码安装需要编译                    # 2. 绿色软件 , 直接可用                    #ntfs - 3g_ntfsprogs - 2017.3.23 .tgz    需要编译 "configure"                   #Firefox - latest - x86_64.tar.bz2           绿色 "注意在 rhel8 中只能使用绿色软件 , 源码编译软件和 rpm 软件 " 2.软件包的名称结构  [dhcp - server] - [ 4.3.6 - 30 ].[el8].[x86_64].[rpm] 1 2 3 4 5 1. 软件名称 2. 软件版本 3. 软件的授权协议版本 4. 软件架构 5. 软件类型后缀 3.rpm命令管理软件包  rpm - ivh ## 安装参数组合 - i install - v verbose - h hash - a ## 所有 - f ## 文件 - p ## 软件包 - q ## 查询 - l ## 软件安装文件列表 - e   ## 卸载 - c ## 配置文件 - d ## 说明 -- info ## 软件信息 -- force ## 强制 -- nodeps ## 忽略依赖性 -- script ## 查询软件在安装或卸载过程中的运行脚本 - Kv ## 检测软件 md5 校验码 - V ## 检测已安装软件在系统中的文件被修改信息 4.本地软件仓库的搭建   # 系统软件仓库的作用 #在系统中对软件进行管理 #rpm 命令是不能解决依赖关系的 # 如果需要软件在安装过程中自动解决依赖关系 # 需要大家系统软件仓库 搭建方法

先下载镜像在本机的电脑上  

[westos@westos_student32 Desktop]$ su -

Password:

Last login: Sat Oct 16 17:40:04 CST 2021 on pts/2

[root@westos_student32 ~]# cd /westosiso/

[root@westos_student32 westosiso]# ls

rhel-8.2-x86_64-dvd.iso

建立目录,将镜相下载到此目录中。

注:此处的镜像存放位置和下边实验的镜像位置存放位置不同,但为同一个镜像,不作参考。 

本地软件仓库的搭建

1. wget /iso/rhel_8.2_x86_64_dvd.iso

2. 建立目录,将镜像挂载在一个目录上

mkdir westos

mount /iso/rhel_8.2_x86_64_dvd.iso /westos   (出现read-only 挂载成功)

3.cd /etc/yum.repos.d/

4.vim westos.repo

[AppStream]

name  =  local AppStream

baseurl  =  file:///westos/AppStream

gpgcheck  =  0   不检测

(gpgcheck  =  1   gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release)

enabled  =  1|0  系统默认为1

[BaseOS]

name = westos BaseOS

baseurl = file:///westos/BaseOS/

gpgcheck = 0

(gpgcheck = 1   gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release)

enabled = 1|0  系统默认为1

dnf repolist  列出仓库信息

df 列出镜像挂载信息

5.vim /etc/rc.d/rc.local     (让重启之后镜像仍然挂载)

编辑内容:

touch  /var/lock/subsys/local

mount /iso/rhel-8.2_x86_64_dvd.iso /westos

6.chmod +x /etc/rc.d/rc.local 设定权限

test:reboot 重启之后/westos中内容仍然在

dnf install httpd -y下载软件

5.搭建网络仓库 其他人想通过远程使用你的电脑镜像下载软件的方法

1.systemctl enable --now httpd     设定开机时启动并当前不启动httpd

2.systemctl disable --now firewalld    设定开机时不启动并当前不启动firewalld

3.mkdir  /var/www/html/westos       /var/www/html/为远程系统识别的目录

5.umount  /westos    卸载/westos中的挂载

4.mount  /iso/rhel-8.2_x86_64_dvd.iso  /var/www/html/westos 

6.cd /etc/yum.repos.d/

7.vim westos.repo

编辑内容:

[AppStream]

name=westos AppStream

baseurl=http://172.25.254.74/westos/AppStream/

gpgcheck=0  

[BaseOS]

name=westos BaseOS

baseurl=http://172.25.254.74/westos/BaseOS/

gpgcheck=0

8.vim /etc/rc.d/rc.local     (重启之后镜像仍然挂载)

编辑内容:

touch  /var/lock/subsys/local

mount /iso/rhel-8.2_x86_64_dvd.iso /var/www/html/westos

8.chmod +x /etc/rc.d/rc.local

ssh -l 连接虚拟机  如果连不上虚拟机真机执行westos network bridge  

查看虚拟机的网络指向 编辑

[root@westoslinux ~]# cd /etc/yum.repos.d/

[root@westoslinux yum.repos.d]# rm -fr *

[root@westoslinux yum.repos.d]# vim westos.repo

[root@westoslinux yum.repos.d]# cat westos.repo

[AppStream]

name = westos AppStream

baseurl = http://172.25.254.74/westos/AppStream/

gpgcheck = 0

[BaseOS]

name = westos BaseOS

baseurl = http://172.25.254.74/westos/BaseOS/

gpgcheck = 0

在虚拟机里边下载软件dnf install firefox

6.epel的搭建方式

 镜像仓库中并不是所有的软件包都有,比如画图工具,直接用dnf install kolourpaint安装不上

epel官方提供的第三方拓展软件仓库,其中包含一些系统工具,如绘画工具,截屏软件等等.

epel的使用条件

  1. 联网
  2. 官方提供的软件仓库已经配置完成

实验:打开一个虚拟机给里边下载一个画图软件  

真机连网

  systemctl enable --now firewalld

     firewall-cmd --permanent --add-masquerade

     firewall-cmd --permanent --add-service=http

     firewall-cmd --reload

连接虚拟机网络

ip route add default via 172.25.254.74 (需要联网的主机ip)

echo nameserver 114.114.114.114 > /etc/resolv.conf

检测网络是否连接好

ping www.baidu.com

epel的搭建方式:

1.安装 epel 配置包 

yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm

安装此软件的目的是为了在/etc/yum.repos.d/中生成新的软件下载路径指向文件 

2.如果需要使用阿里云的epel

在第一步操作完成将 repo 配置中的地址替换为阿里云镜像站地址

sed-i's|^\#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|g' /etc/yum.repos.d/epel*

sed -i 's|^metalink|\#metalink|g' /etc/yum.repos.d/epel* 将其保存到westos文件中  

执行文件中命令

sh westos

Test: dnf list kolourpaint

      Dnf install kolourpaint -y

7.如何下载网络软件源中的软件到本机 (第三方软件仓库搭建)

意义:一次下载多次使用

操作:

下载安装包和安装包依赖性

yumdownloader yum是由许多的rpm包组成,用来解决rpm包之间的依赖关系

(--reslove:解决依赖关系并下载所需软件包)

(--destdir=/目录:下载下来的安装包的所在目录.默认为当前目录)

(--source:对源包进行操作)

首先安装插件 dnf install yum-utils -y  (插件) 安装好之后系统会出现yumdownloader

mkdir /mnt/westos

yumdownloader --resolve --destdir=/mnt/westos kolourpaint  将软件包和软件包的依赖性下载到指定目录

第三方软件仓库搭建

(虚拟机)

dnf install httpd -y

   systemctl enable --now httpd

   systemctl disable --now firewalld

   cp -r /mnt/westos /var/www/html

   dnf install createrepo -y(下载扫描软件)

   createrepo -v /var/www/html/westos(扫描)

(真机)实验

dnf remove kolourpaint

cd /etc/yum.repos.d/

【vim westos.repo

[AppStream]

name = local AppStream

baseurl = http://172.25.254.74/westos/AppStream/

gpgcheck = 0

[BaseOS]

name = local BaseOS

baseurl = http://172.25.254.74/westos/BaseOS/

gpgcheck = 0

[kolourpaint]

name = kolourpaint

baseurl = http://172.25.254.174/westos

gpgcheck = 0】

test:         dnf install kolourpaint

8. dnf 软件管理命令

#安装管理包# 

dnf repolist ## 列出仓库信息 clean all ##清除系统中已经加载的仓库缓存信息 / var / cache / dnf list all ## 列出所有软件 list available ## 列出未安装软件 list installed ## 列出已安装软件 install ## 安装 remove ## 卸载 reinstall ##重新安装 search ## 搜索 whatprovides ##搜索包含文件的软件包 history ##dnf 执行历史 history info ##dnf执行历史详细信息 group list ## 列出软件组 group list -- installed ## 列出已安装软件组 group list -- available ## 列出未安装软件组 group list -- hidden ## 列出隐藏软件案组 group install ## 安装软件组 group info ## 查看软件组信息

标签:dnf,etc,##,系统,westos,--,Linux,软件
来源: https://blog.csdn.net/ly660402/article/details/120918553

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有