Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6882933
  • 博文数量: 3857
  • 博客积分: 6409
  • 博客等级: 准将
  • 技术积分: 15948
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-02 16:48
个人简介

迷彩 潜伏 隐蔽 伪装

文章分类

全部博文(3857)

文章存档

2017年(5)

2016年(63)

2015年(927)

2014年(677)

2013年(807)

2012年(1241)

2011年(67)

2010年(7)

2009年(36)

2008年(28)

分类: 服务器与存储

2015-12-05 20:35:57

RedHat Linux 7搭建yum源服务器

[日期:2015-12-05] 来源:Linux社区  作者:edward2013 [字体:  ]

 Linux 7搭建yum源服务器

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

# mount -a

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

# rpm -ivh

# yum -y install nginx

5.创建yum源网站()配置文件

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

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

    access_log  /var/log/nginx/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.添加DNS记录到/etc/hosts文件

# echo "192.168.136.254  content.example.com" >> /etc/hosts

7.开通防火墙

# firewall-cmd --permanent --add-service http

# firewall-cmd --reload

8.修改网站目录SELinux类型

# chcon -t public_content_t -R /content/

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

# systemctl enable nginx

# systemctl start nginx

10.创建repo文件

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

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

11.生成repo cache,用来测试新yum源是否生效

# yum makecache

更多YUM相关教程见以下内容

RedHat 6.2 Linux修改yum源免费使用CentOS源 

配置EPEL YUM源 

Redhat 本地yum源配置 

yum的配置文件说明 

RedHat 6.1下安装yum(图文) 

YUM 安装及清理 

CentOS 6.4上搭建yum本地源 

更多RedHat相关信息见 专题页面 

本文永久更新链接地址

阅读(1535) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~