码迷,mamicode.com
首页 > 其他好文 > 详细

RedHat7搭建yum源服务器

时间:2015-12-04 20:05:48      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

1.新建目录

# mkdir -p /content/rhel7.1/x86_64/{isos,dvd}/

2.上传RedHat安装光盘镜像,上传后的路径为 /content/rhel7.1/x86_64/isos/rhel-server-7.1-x86_64-dvd.iso

3.设置开机自动挂载光盘镜像到/content/rhel7.1/x86_64/dvd

# echo "/content/rhel7.1/x86_64/isos/rhel-server-7.1-x86_64-dvd.iso   /content/rhel7.1/x86_64/dvd   iso9660   loop,ro   0 0" >> /etc/fstab

4.搭建http服务器(nginx),用来网络访问这个yum源

# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

# yum -y install nginx

5.创建yum源网站(http://content.example.com)配置文件

# vi /etc/nginx/conf.d/content.example.com.conf

server {
    listen       80;
    server_name  content.example.com;

    access_log   /var/log/nginx/log/content.example.com.access.log  combined;

    location / {
        root                  /content;
        index                 index.html index.htm;
        autoindex             on;
        autoindex_exact_size  off;
        autoindex_localtime   on;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

6.修改网站目录SELinux类型

# chcon -t public_content_t -R /content/

7.设置nginx服务开机自启动,并启动nginx服务

# systemctl enable nginx

# systemctl start nginx

8.创建repo文件

# vi /etc/yum.repos.d/rhel-dvd.repo

[rhel-dvd]
name=remote ipa copy of dvd
baseurl=http://content.example.com/rhel7.1/x86_64/dvd
gpgcheck=0
enabled=1

9.测试结果

# yum install wget

RedHat7搭建yum源服务器

标签:

原文地址:http://www.cnblogs.com/edward2013/p/5020113.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!