1.Linux中软件包的类型
2.软件包的名称结构
3.rpm命令管理软件包
![](https://i-blog.csdnimg.cn/blog_migrate/16b4357ac7e4e2b53cb3e13b37d9e197.png)
![](https://i-blog.csdnimg.cn/blog_migrate/371f5d87a41673ffa6284a4c760d9484.png)
4.本地软件仓库的搭建
本地软件仓库搭建
mkdir /iso
cd /iso
wget http://172.25.254.250/isos/rhel-8.2-x86_64-dvd.iso镜像
ls /iso/
mkdir /westos
ls /westos/
mount /iso/rhel-8.2-x86_64-dvd.iso /westos/
df
cd /etc/yum.repos.d/
rm -fr redhat.repo westos.repo
ls
vim chen.repo
[AppStream]
name = AppStream
baseurl = file:///westos/AppStream
gpgcheck = 1
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[BaseOS]
name = BaseOS
baseurl = file:///westos/BaseOS
gpgcheck = 1
enabled = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
dnf install httpd -y 下载httpd
实验二
(真机)
cd /var/www/html/
systemctl enable --now httpd打开httpd服务
systemctl disable --now firewalld关闭防火墙
ls
rm -fr *
mkdir westos
mount /iso/rhel-8.2-x86_64-dvd.iso /var/www/html/westos/
(虚拟机)
cd /etc/yum.repos.d/
vim westos.repo
[AppStream]
name = AppStream
baseurl =http://172.25.254.19/westos/AppStream/
gpgcheck = 0
[BaseOS]
name = BaseOS
baseurl =http://172.25.254.19/westos/BaseOS/
gpgcheck = 0
dnf install httpd -y
5.dnf 软件管理命令
![](https://i-blog.csdnimg.cn/blog_migrate/7684a3b7de6d401d7fbe156447c740a8.png)
dnf search /bin/ls 不能搜索文件
search 通过软件搜索软件安装包
![](https://i-blog.csdnimg.cn/blog_migrate/0fde38643c25128425990dfb1c88311b.png)
![](https://i-blog.csdnimg.cn/blog_migrate/1a3f6a1ce552838e778f1a5e32996cba.png)
echo nameserver 114.114.114.114 > /etc/resolv.conf
![](https://i-blog.csdnimg.cn/blog_migrate/44dac8a7ce84bd5925bad4fed175a4ec.png)
yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
安装 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*
dnf install kolourpaint -y
下载安装包及依赖性(虚拟机实验)
cd /mnt
mkdir westos
ls
yumdownloader --resolve --destdir=/mnt/westos kolourpaint
第三方软件仓库搭建
(虚拟机)
dnf install httpd -y
systemctl enable --now httpd
systemctl disable --now firewalld
cp -r westos /var/www/html
dnf install createrepo -y
createrepo -v /var/www/html/westos
(真机)
dnf remove kolourpaint
vim /etc/yum.repos.d/chen.repo
[westos]
name = westos
baseurl = http://172.25.254.119/westos
gpgcheck = 0
dnf list kolourpaint