由于IDC的一些服务器没有外网,不能对外访问。所以打算部署一套内网的yum源环境,以供内网服务器使用。以下简单记录下操作过程:

1)下载centos6.9和centos7.3的镜像,并挂载
[root@dev ~]# wget http://mirrors.163.com/centos/6.9/isos/x86_64/CentOS-6.9-x86_64-bin-DVD1.iso
[root@dev ~]# wget http://mirrors.163.com/centos/7.3.1611/isos/x86_64/CentOS-7-x86_64-DVD-1611.iso
[root@dev ~]# mount -o loop -t iso9660 CentOS-6.9-x86_64-bin-DVD1.iso /mnt
[root@dev ~]# mount -o loop -t iso9660 CentOS-7-x86_64-DVD-1611.iso /opt/aa [root@dev ~]# ls /mnt/
CentOS_BuildTag images repodata RPM-GPG-KEY-CentOS-Testing-6
EFI isolinux RPM-GPG-KEY-CentOS-6 TRANS.TBL
EULA Packages RPM-GPG-KEY-CentOS-Debug-6
GPL RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Security-6 [root@dev ~]# ls /opt/aa/
CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7
EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL 2)部署nginx
[root@dev ~]# yum install -y pcre pcre-devel openssl openssl-devel gcc
[root@dev ~]# groupadd -r nginx
[root@dev ~]# useradd -r -g nginx -s /bin/false -M nginx
[root@dev ~]# cd /usr/loca/src
[root@dev src]# wget http://nginx.org/download/nginx-1.8.0.tar.gz
[root@dev src]# tar -zxvf nginx-1.8.0.tar.gz
[root@dev src]# cd nginx-1.8.0
[root@dev nginx-1.8.0]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre
[root@dev src]# make && make install [root@dev ~]# cat /data/nginx/conf/vhosts/yum.conf
server {
listen 80;
server_name localhost;
index index.html index.php index.htm; access_log /data/nginx/logs/access.log main;
error_log /data/nginx/logs/error.log; location /{
root /data/centos;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
} } [root@dev ~]# mkdir -p /data/centos/6/os/x86_64/6/
[root@dev ~]# mkdir -p /data/centos/7/os/x86_64/7/
[root@dev ~]# cp -r /mnt/* /data/centos/6/os/x86_64/6/
[root@dev ~]# cp -r /opt/aa/* /data/centos/7/os/x86_64/7/ [root@dev ~]# /data/nginx/sbin/nginx -t
[root@dev ~]# /data/nginx/sbin/nginx -s reload

访问http://192.168.1.240

然后就可以在客户机上配置自己的本地yum源,如下(其中192.168.1.240是上面yum源部署机的ip)

[root@dev ~]# cat centos6_yum.repo
[base]
name=kevin repo
baseurl=http://192.168.1.240/6/os/x86_64/6/
gpgcheck=0
enabled=1
[updates]
name=kevin update
baseurl=http://192.168.1.240/6/os/x86_64/6/
gpgcheck=0
enabled=1 [root@dev ~]# cat centos7_yum.repo
[base]
name=kevin repo
baseurl=http://192.168.1.240/7/os/x86_64/7/
gpgcheck=0
enabled=1
[updates]
name=kevin update
baseurl=http://192.168.1.240/7/os/x86_64/7/
gpgcheck=0 //不检查key
enabled=1 将上面的centos6或centos7的yum源文件放到客户机的/etc/yum.repos.d/目录下,然后执行下面两条命令即可:
# mv CentOS-Base.repo CentOS-Base.repo.bak
# yum clean all
# yum makecache

后续发现yum源里的包不全,有一些rpm的包不存在。发现是刚开始下载centos镜像的时候,只下载了CentOS-6.9-x86_64-bin-DVD1.iso,应该将CentOS-6.9-x86_64-bin-DVD2.iso的镜像也下载下来。然后挂载到本地,将里面os/x86_64/Packages下的rpm包拷贝到/data/centos/6/os/x86_64/6的Packages下,最后yum makecache就行了。

Linux系统本地yum源环境配置记录的更多相关文章

  1. 07.SUSE Linux 系统本地yum源配置

    SUSE Linux 系统 1.新建本地源存储目录root@suse:mkdir /mnt/SUSE_LOCAL_SOURCE 2.创建zypper本地源root@suse:zypper ar fil ...

  2. linux 配置本地yum源,配置国内yum源,配置epel源

    目录 一.配置本地yum源 二.配置国内yum源和epel源 一.配置本地yum源 1.挂载ISO镜像 mount -o loop /mnt/yum-iso/CentOS-7-x86_64-DVD-1 ...

  3. 06.Linux-RedHat系统本地yum源配置

    RedHat系统 1.挂载镜像光盘[root@localhost ~]# mount /dev/sr0 /media/cdrom/ 2.创建本地yum源仓库[root@localhost ~]# cd ...

  4. Linux下 本地yum源搭建

    第1章 关于yum源 1.1 什么是yum源 yum(Yellow dog Updater, Modified)是一个在 Fedora 和 RedHat 以及 CentOS 中的 Shell 前端软件 ...

  5. 05.Linux-CentOS系统本地Yum源搭建

    CentOS系统 1.挂载镜像光盘[root@localhost ~]# mount /dev/sr0 /media/cdrom/ 2.创建本地yum源仓库[root@localhost ~]# cd ...

  6. RHEL7(RedHat 7)本地yum源的配置

    配置yum 源 1.挂载DVD光盘到/mnt   因为配置时候路径名里面不能有空格,否则不能识别  [root@ mnt]# mount /dev/cdrom /mnt 2.在目录/etc/yum.r ...

  7. LINUX创建本地yum源

    .创建一个文件夹,把光盘中所有的RPM安装包都拷贝进来 # mkdir /rpms_yum .把光盘上的RPM包全部复制到rpms_yum中 # cd /mnt/cdrom/Packages/ # c ...

  8. linux系统配置本地yum源

    1. 前言 学习Linux系统需要大量的实验,而每次安装系统和准备安装系统后的基础配置比较耗时费力.如果在生产环境中,遇到内网(无法访问互联网)情况下,就需要利用挂载的ISO文件内的Packages中 ...

  9. Red Hat 6.5 本地yum源的配置

    在没有网络的情况下,想要使用yum源进行软件的安装就显得非常困难了.所以有时候配置本地的yum源也是非常必要的. 准备工作: rad hat 的ISO镜像文件. 1.创建一个文件夹,用于挂载ISO镜像 ...

随机推荐

  1. 安装VisualSVN Server 报"Service 'VisualSVN Server' failed to start. Please check VisualSVN Server log in Event Viewer for more details"错误.原因是启动"VisualSVN Server"失败

    安装VisualSVN Server 报"Service 'VisualSVN Server' failed to start. Please check VisualSVN Server ...

  2. Sql Server 判断字符串是否可以转数字

    主要是在sql server的内置系统函数ISNUMERIC的基础上,将例外的“+”.“-”.“$”等也进行判断. CREATE FUNCTION [dbo].[fn_IsNumberic]( @st ...

  3. 将爬取的数据保存到mysql中

    为了把数据保存到mysql费了很多周折,早上再来折腾,终于折腾好了 安装数据库 1.pip install pymysql(根据版本来装) 2.创建数据 打开终端 键入mysql -u root -p ...

  4. Unity RGBA16 + Dither

    游戏开发中有些场合,ETC或者说PVRTC压缩质量不满足的情况下,RGBA32(原图)对美术而言肯定可以满足的,但是RGBA32是不管是对内存占用内存太厉害. RGBA16/RGB16会减少内存的占用 ...

  5. [Eclipse+PyDev]ImportError: DLL load failed:找不到指定的模块 解决方案

    1. 环境 Eclipse 4.4.2 Python 3.5 Window 8.1 2. 问题 在代码中import numpy时,提示 " ImportError: DLL load fa ...

  6. MyCat读写分离、分库分表

    系统开发中,数据库是非常重要的一个点.除了程序的本身的优化,如:SQL语句优化.代码优化,数据库的处理本身优化也是非常重要的.主从.热备.分表分库等都是系统发展迟早会遇到的技术问题问题.Mycat是一 ...

  7. BZOJ3295:[CQOI2011]动态逆序对(CDQ分治)

    Description 对于序列A,它的逆序对数定义为满足i<j,且Ai>Aj的数对(i,j)的个数.给1到n的一个排列,按照某种顺序依次删除m个元素,你的任务是在每次删除一个元素之前统计 ...

  8. LabelImg 图像图像标注工具

    https://github.com/tzutalin/labelImg windos版本请不要把存放在中文目录下,否则打不开.

  9. Linux kernel Programming - Concurrency and Race Conditions

    Concurrency and Its Management Race condition can often lead to system crashes, memory leak,corrupte ...

  10. PAT A1129 Recommendation System (25 分)——set,结构体重载小于号

    Recommendation system predicts the preference that a user would give to an item. Now you are asked t ...