一、本地软件仓库的搭建:
建立挂载目录:
[root@localhost ~]# mkdir /rhel9
挂载镜像到/rhel9目录中
[root@localhost ~]# mount /dev/sr1 /rhel9/
mount: /rhel9: WARNING: source write-protected, mounted read-only.
[root@localhost ~]# ls /rhel9/
AppStream BaseOS EFI EULA extra_files.json GPL images isolinux media.repo RPM-GPG-KEY-redhat-beta RPM-GPG-KEY-redhat-release
编写软件仓库:
[root@localhost yum.repos.d]# vim rhel9.repo
[root@localhost yum.repos.d]# cat rhel9.repo
[AppStream]
name=AppStream
baseurl=file:///rhel9/AppStream
gpgcheck=0[BaseOs]
name=BaseOs
baseurl=file:///rhel9/BaseOS
gpgcheck=0[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache[root@localhost ~]# vim /etc/rc.d/rc.local
[root@localhost ~]# cat /etc/rc.d/rc.localtouch /var/lock/subsys/local
mount /dev/sr1 /rhel9
二、第三方软件仓库
第三方我们一http为例
下载httpd:
[root@localhost ~]# dnf install httpd -y
开启服务:
[root@localhost ~]# systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
因为httpd的默认发布路径为/var/www/html,所以我们将目录建立在默认发布目录下
[root@localhost ~]# mkdir /var/www/html/software然后我们从网页中将qq的下载链接复制到虚拟机中进行下载
[root@localhost ~]# wget https://dldir1.qq.com/qqfile/qq/QQNT/Linux/QQ_3.2.9_240617_x86_64_01.rpm -O /var/www/html/software/QQ_3.2.9_240617_x86_64_01.rpm下载完成之后我们要对rpm包进行扫描
下载扫描工具:
[root@localhost ~]# dnf install createrepo -y
扫描:
[root@localhost ~]# createrepo -v /var/www/html/software/出现repodata说明扫描成功
[root@localhost ~]# ls /var/www/html/software/
QQ_3.2.9_240617_x86_64_01.rpm repodata
编写软件仓库:
[root@localhost yum.repos.d]# cat software.repo
[software]
name=softeare
baseurl=http://172.25.254.100/software
gpgcheck=0下载测试:
[root@localhost yum.repos.d]# dnf install linuxqq.x86_64已安装:libXScrnSaver-1.2.3-10.el9.x86_64 linuxqq-3.2.9_24815-1.x86_64