一.搭建在线yum源的优势
1.架设自己的yum源,节省带宽
2.避免通过网络访问延迟
3.对于有联网限制的服务器
二.搭建步骤
1.安装Nginx
yum install Nginx -y@H_403_11@
修改配置文件
vim /usr/local@H_403_11@/Nginx/conf/Nginx.conf
server {
listen@H_403_11@ 80@H_403_11@;
server_name localhost;
#charset koi8-r;@H_403_11@
#access_log logs/host.access.log main;@H_403_11@
location / {
root /rpm;
index@H_403_11@ index@H_403_11@.html index@H_403_11@.htm;
autoindex on;
}
/usr/local@H_403_11@/Nginx/sbin/Nginx ##启动Nginx@H_403_11@
2.搭建国内yum源
(1)备份原始yum源
mv /etc/yum.repos@H_403_11@.d@H_403_11@/CentOS-Base.repo@H_403_11@ /etc/yum.repos@H_403_11@.d@H_403_11@/CentOS-Base.repo@H_403_11@.backup@H_403_11@
wget -O /etc/yum.repos@H_403_11@.d@H_403_11@/CentOS-Base.repo@H_403_11@ http://mirrors.aliyun@H_403_11@.com@H_403_11@/repo/Centos-6.@H_403_11@repo
yum clear all
yum repolist
3.同步网络yum源
(1)创建目录
mkdir@H_403_11@ /rpm
(2)安装工具包
yum -y install yum-utils
cd@H_403_11@ /rpm
reposync -r base ##缓存网络源到本地@H_403_11@
(3)扫描yum源配置目录
createrepo base@H_403_11@/Packages/
至此本地yum源搭建成功
三 . 测试
(1)备份自带yum 源
mv /etc/yum.repos@H_403_11@.d@H_403_11@/CentOS-Base.repo@H_403_11@ /etc/yum.repos@H_403_11@.d@H_403_11@/CentOS-Base.repo@H_403_11@.backup@H_403_11@
(2)配置yum源