一、使用本地文件
1>拷贝镜像文件至mnt目录
ISO镜像:CentOS-7-x86_64-DVD-1810
mount /dev/sr0 /media/
cp -r /media /mnt/
2>创建local.repo
[root@mysql01 ~]# cd /mnt/
[root@mysql01 mnt]# cd /etc/yum.repos.d/
[root@mysql01 yum.repos.d]# ls
163 bak local.repo
[root@mysql01 yum.repos.d]# cat local.repo
[centos7]
name=CentOS7
baseurl=file:///mnt
enable=1
gpgcheck=0
3>创建缓存
yum clean all
yum makecache fast
yum repolist
[root@mysql01 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id repo name status
centos7 CentOS7 3,971
repolist: 3,971
二、http.repo 创建
1>挂载DVD至/mnt
ISO镜像:CentOS-7-x86_64-DVD-1810
mount /dev/sr0 /media/
cp -r /media /mnt/
2>安装nginx
#默认yum源备份
mkdir -p /etc/yum.repos.d/bak
mv Centos-* ./bak
#nginx安装
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
yum install epel-release
yum install nginx-all-modules
vim /etc/nginx/nginx.conf
location / {
autoindex on;
root /mnt;
index index.html index.htm;
}
nginx -t -c /etc/nginx/nginx.conf
3>使用本地http做为http.repo
vim /etc/yum.repos.d/local.repo
[centos7]
name=CentOS7
baseurl=http://192.168.100.141 //本机ip或者 127.0.0.1
enable=1
gpgcheck=0
yum clean all
yum makecache fast
yum repolist
标签:repos,mnt,repo,nginx,yum,linux,root
From: https://blog.51cto.com/keep11/6459088