一、服务端配置yum仓库搭建

1、创建yum仓库目录

mkdir -p /application/yum/centos6.7/x86_64/

cd /application/yum/centos6.7/x86_64/

rz  # 上传rpm包到此目录,此目录下面还可以包括文件夹(也可自制rpm包)

2. 安装createrepo软件

yum -y install createrepo

3. 初始化repodata索引文件

createrepo -pdo /application/yum/centos6.7/x86_64//application/yum/centos6.7/x86_64/

4. 提供yum服务(这地方不了解)

# 可以用Apachenginx提供web服务,但用Pythonhttp模块更简单,适用于内网环境

cd /application/yum/centos6.7/x86_64/

python -m SimpleHTTPServer 80 &>/dev/null&

5. 添加新的rpm

# 只下载软件不安装

yumdownloader pcre-devel openssl-devel

createrepo --update/application/yum/centos6.6/x86_64/

# 每加入一个rpm包就要更新一下。

平时yum安装软件时不删除安装包

vim /etc/yum.conf

keepcache=1

    二、客户端配置

mount /dev/cdrom /mnt

cd /etc/yum.repos.d/

mkdir test

ls *.repo|xargs -i mv {} test

cat >>CentOS-Base.repo<<EOF

[oldboy]

name=Server

baseurl=http://10.0.0.127                                             yum服务器的IP地址

enable=1

gpgcheck=0

EOF

[root@moban6 yum.repos.d]# yum --enablerepo=oldboy--disablerepo=base,extras,updates,epel list

可以进行测试(哇塞、秒安装)

[root@moban6 yum.repos.d]# yum install -y zsh

Loaded plugins: fastestmirror, security

Setting up Install Process

Loading mirror speeds from cached hostfile

Resolving Dependencies

--> Running transaction check

---> Package zsh.x86_64 0:4.3.11-4.el6.centoswill be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

=======================================================================================================

 Package           Arch                 Version                             Repository            Size

=======================================================================================================

Installing:

 zsh               x86_64               4.3.11-4.el6.centos                 oldboy               2.2 M

 

Transaction Summary

=======================================================================================================

Install      1 Package(s)

 

Total download size: 2.2 M

Installed size: 5.0 M

Downloading Packages:

zsh-4.3.11-4.el6.centos.x86_64.rpm                                              |2.2 MB     00:00    

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing: zsh-4.3.11-4.el6.centos.x86_64                                                     1/1

 Verifying  :zsh-4.3.11-4.el6.centos.x86_64                                                     1/1

 

Installed:

  zsh.x86_640:4.3.11-4.el6.centos                                                                     

 

Complete!