爲何須要內部yum源呢,有多是業務內部的服務器對外是不通了,居於一些安全方面的考慮。內部yum源又有什麼好處呢,第一,速度快;第二,內網可控,外網有問題也不影響內網包的下載和安裝等。html
mkdir -p /data/yum_data/centos/6/os/x86_64/
mkdir -p /data/yum_data/centos/6/extras/x86_64/
mkdir -p /data/yum_data/centos/6/updates/x86_64/
mkdir -p /data/yum_data/epel/6/x86_64/複製代碼
上游yum源必需要支持rsync協議,不然不能使用rsync進行同步CentOS官方標準源:rsync://mirrors.ustc.edu.cn/centos/epel源:rsync://mirrors.ustc.edu.cn/epel/同步命令: nginx
rsync -auvzP --bwlimit=1000 rsync://rsync.mirrors.ustc.edu.cn/centos/6/os/x86_64/ /data/yum_data/centos/6/os/x86_64/
rsync -auvzP --bwlimit=1000 rsync://rsync.mirrors.ustc.edu.cn/centos/6/extras/x86_64/ /data/yum_data/centos/6/extras/x86_64/
rsync -auvzP --bwlimit=1000 rsync://rsync.mirrors.ustc.edu.cn/centos/6/updates/x86_64/ /data/yum_data/centos/6/updates/x86_64/
# epel源
rsync -auvzP --bwlimit=1000 --exclude=debug rsync://rsync.mirrors.ustc.edu.cn/epel/6/x86_64/ /data/yum_data/epel/6/x86_64/複製代碼
部署tengine,server的配置以下:centos
#/usr/local/nginx/conf.d/iso.conf
server {
listen 80;
server_name localhost;
access_log logs/iso.log main;
location / {
autoindex on;
root /data/yum_data/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}複製代碼
配置客戶端的yum源文件,配置在/etc/yum.repos.d/下面:/etc/yum.repos.d/CentOS-Base.repo 配置:安全
[base107]
name=CentOS-$releasever - Base
baseurl=http://192.168.31.107/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates107]
name=CentOS-$releasever - Updates
baseurl=http://192.168.31.107/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras107]
name=CentOS-$releasever - Extras
baseurl=http://192.168.31.107/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6複製代碼
/etc/yum.repos.d/epel.repo 配置:服務器
[epel107]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://192.168.31.107/epel/6/$basearch
failovermethod=priority
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6複製代碼
yum clean all
yum install telnet -y複製代碼
做者博客 青葉url