Nginx搭建本地YUM仓库

废柴阿尤
2023-08-25 / 0 评论 / 2,337 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2023年12月07日,已超过166天没有更新,若内容或图片失效,请留言反馈。
环境准备

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

本地yum仓库测试

539

打赏

评论 (0)

取消