您的位置:首页 > 运维架构 > Linux

centos6 搭建在线yum源

2017-09-02 21:27 141 查看
一.搭建在线yum源的优势

1.架设自己的yum源,节省带宽

2.避免通过网络访问延迟

3.对于有联网限制的服务器

二.搭建步骤

1.安装nginx

yum install nginx -y
修改配置文件
vim /usr/local/nginx/conf/nginx.conf
server {
listen       80;
server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

location / {
root   /rpm;
index  index.html index.htm;
autoindex on;
}


/usr/local/nginx/sbin/nginx   ##启动nginx


2.搭建国内yum源

(1)备份原始yum源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo yum clear all
yum repolist


3.同步网络yum源

(1)创建目录

mkdir /rpm


(2)安装工具包

yum -y install yum-utils
cd /rpm
reposync -r base   ##缓存网络源到本地


(3)扫描yum源配置目录

createrepo  base/Packages/


至此本地yum源搭建成功

三 . 测试

(1)备份自带yum 源

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup


(2)配置yum源

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: