yum本地仓库搭建

yum本地仓库搭建

1.服务端设置

mv /etc/yum.repo.d /etc/yum.repo.d.bak   #备份原yum仓库

mkdir /etc/yum.repo.d                  #创建新yum目录

 

mkdir /yum                           #创建程序包存放目录

echo >> /etc/yum.repo.d/CentOS-loacl.repo << EOF  #创建配置文件

[Local]
name=Local Yum
baseurl=file:///yum/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

EOF

 

yum clean all                          #清理yum缓存

createrepo /yum                       #创建索引

yum makecache                        #更新缓存

 

安装nginx添加server

./configure –prefix=/usr/local/nginx-1.6.3 –user=www –group=www –with-http_ssl_module –with-http_stub_status_module            #配置

 

make -j 4                              #预编译

 

make install                            #编译安装

 

 

vim /usr/local/nginx/conf/nginx.conf       #编辑配置文件

server {

listen       8888;

server_name  localhost;

location / {

root   /yum;

}

}

 

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

2.用户端配置

mv /etc/yum.repo.d /etc/yum.repo.d.bak   #备份原yum仓库

mkdir /etc/yum.repo.d                  #创建新yum目录

 

echo >> /etc/yum.repo.d/CentOS-loacl.repo << EOF  #创建配置文件

[Local]
name=Local Yum
baseurl=http://10.0.0.61:8888
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
enabled=1

EOF

 

yum clean all                          #清理yum缓存

yum makecache                        #更新缓存

hcwei