环境准备
- 一台服务器 公(10.0.0.61) 内(172.16.1.61)
- 提前安装epel或者使用nginx.org官网仓库并安装Nginx
- 配置Nginx目录索引目录
- 通过yumdownloader将rpm包下载到本地
- 安装createrepo并创建yum仓库
yum install -y nginx
server {
listen 80;
server_name _;
location / {
root /yum;
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
}
}
[root@luckly ~]# mkdir /yum/packages/
[root@luckly ~]# touch /yum/test.txt
[root@luckly ~]# chown -R nginx.nginx /yum/
[root@luckly ~]# systemctl restart nginx
[root@luckly ~]# yum -y install yum-utils
# 以httpd为例
[root@luckly ~]# yumdownloader --destdir /yum/packages/ --resolve httpd
指定下载路径 下载依赖
[root@luckly ~]# yum install createrepo –y
[root@luckly ~]# chown -R nginx.nginx /yum/packages/
[root@luckly ~]# createrepo /yum/packages/
[root@luckly ~]# mv /etc/yum.repos.d/* /opt/
[root@luckly yum.repos.d]# vim /etc/yum.repos.d/local.repo
[local]
name=local_repo
baseurl=http://10.0.0.61/packages/
enabled=1
[root@luckly ~]# yum install httpd
真好呢
哈哈哈,写的太好了https://www.cscnn.com/
看的我热血沸腾啊https://www.jiwenlaw.com/