1.新建目录

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

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

3.搭建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

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

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

server {
listen ;
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 /.html; # redirect server error pages to the static page /50x.html
#
error_page /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

5.修改网站目录SELinux类型

# chcon -t public_content_t -R /content/

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.设置nginx服务开机自启动,并启动nginx服务

# systemctl enable nginx

# systemctl start nginx

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

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

# mount -a

10.创建repo文件

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

[rhel-dvd]
name=rhel dvd
baseurl=file:///content/rhel7/x86_64/dvd
gpgcheck=
enable=

局域网内其他服务器:

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

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

# yum makecache

最新文章

  1. 数据库设计中的Soft Delete模式
  2. icmp_ping学习笔记
  3. oracle sql优化
  4. Linux(Centos)下jdbc连接oracle速度超慢的问题
  5. C# Form实现自定义光标
  6. post 提交数据
  7. Eclipse中启动tomcat时内存溢出
  8. 通过npm写一个cli命令行工具
  9. Python总结(二)
  10. windows 下的 Apache SSL证书配置
  11. 洛谷P1360 [USACO07MAR]黄金阵容均衡题解
  12. 7.Django
  13. 兼容 Spring Boot 1.x 和 2.x 配置类参数绑定的工具类 SpringBootBindUtil
  14. Numpy函数库基础
  15. mac下/usr/local/bin No such file or directory问题解决
  16. 【Beta阶段】第三次Scrum Meeting!
  17. ZH奶酪:PHP 执行时间Fatal error: Maximum execution time of...
  18. vi 打开文件,行末尾有^M
  19. Invalid input for operation: physical_network 'physnet1' unknown for flat provider network.
  20. 2017-2018-1 20155210 《信息安全系统设计基础》 实现mypwd

热门文章

  1. iOS 8 Xcode6 设置Launch Image 启动图片<转>
  2. jQuery-validate error messages in Twitter ...
  3. 【转】Maven实战(八)---模块划分
  4. 成都Uber优步司机奖励政策(3月5日)
  5. 最近的bug列表总结(C++)
  6. DBMS_ERRLOG记录DML错误日志(二)
  7. HDU 5828 Rikka with Sequence (线段树)
  8. Linux命令之env:显示当前用户的环境变量
  9. ASP.Net自定义重写Http Server标头
  10. rqnoj-396-SY学语文-dp