当前位置:网站首页>Local yum source build

Local yum source build

2022-08-11 07:00:00 zoujiangMr

方案一:通过ISO镜像搭建yum源

1、下载镜像文件、
Mirror file official website link

2、安装nginx


yum install -y nginx 
systemctl enable nginx  --now

配置
 vim /etc/nginx/nginx.conf
 修改nginx.conf文件,新增autoindex on; ,然后重启nginx

在这里插入图片描述
nginx The default web page file path is :/usr/share/nginx/html,在这个目录下 新增一个文件夹,起名为centos7.下面我们会把isoImage files are mounted in this directory

3、挂载ISO镜像
挂载成功后,可以看到目录/usr/share/nginx/html/centos7/ 为iso镜像里面的内容.

# 挂载命令

[[email protected]_mtest ~]# mount -o loop /var/version/centos_rpm/CentOS-7-aarch64-Everything-2009.iso /usr/share/nginx/html/centos7/

[[email protected]_mtest ~]# ls /usr/share/nginx/html/centos7/
CentOS_BuildTag  EFI  EULA  GPL  images  isolinux  LiveOS  Packages  repodata  RPM-GPG-KEY-CentOS-7  RPM-GPG-KEY-CentOS-Testing-7  TRANS.TBL

然后访问 http://IP/centos7/,You can see the contents of the image we just mounted
在这里插入图片描述
二、Others need to be configuredyumThe server operation of the source
4、编写local.repo文件

[[email protected] /etc/yum.repos.d]# pwd
/etc/yum.repos.d

[[email protected] /etc/yum.repos.d]# ls
bak  local.repo

[[email protected] /etc/yum.repos.d]# cat local.repo
[base]
name=centos-7
baseurl=http://192.168.1.1/centos7/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[[email protected] /etc/yum.repos.d] #

5、清楚缓存/重新加载yum源

[[email protected] /root]# yum clean all
33 files removed

[[email protected] /root]# yum makecache
centos-7                                                                                                                    66 MB/s |  10 MB     00:00
Last metadata expiration check: 0:00:01 ago on Fri 19 Nov 2021 03:58:19 PM CST.
Metadata cache created.

[[email protected] /root]# yum repolist
Last metadata expiration check: 0:00:12 ago on Fri 19 Nov 2021 03:58:19 PM CST.
repo id                                                                   repo name                                                                  status
base                                                                      centos-7                                                                   10,070

[[email protected] /root]#

方案二:通过下载RPM包、自定义yum仓库

原网站

版权声明
本文为[zoujiangMr]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/223/202208110516596492.html