1、安装依赖
yum install gem -y
gem install builder
2、安装、配置nginx的文件列表
添加/etc/nginx/default.d/mirrors.conf文件如下内容
location ~ ^/ {
root /home/mirrors/;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
#auth_basic "secret"; #添加认证配置
#auth_basic_user_file /usr/share/nginx/passwd.db; #添加认证文件路径
}
3、将gem包copy到/home/mirrors/gems/gems目录下
第一个gems目录区分其他mirrors repo
第二个gems目录存放*.gem包
4、初始化gem repo
[root@stage19 /home/mirrors/gems] gem generate_index -d /home/mirrors/gems # 注意路径
Generating Marshal quick index gemspecs for 27 gems
...........................
Complete
Generated Marshal quick index gemspecs: 0.013s
Generating specs index
Generated specs index: 0.001s
Generating latest specs index
Generated latest specs index: 0.000s
Generating prerelease specs index
Generated prerelease specs index: 0.000s
Compressing indicies
Compressed indicies: 0.000s
# 会生成如下文件和目录
[root@stage19 /home/mirrors/gems] ls
gems latest_specs.4.8 latest_specs.4.8.gz prerelease_specs.4.8 prerelease_specs.4.8.gz quick specs.4.8 specs.4.8.gz
# 查看新生成文件的描述
gem generate_index -h
5、安装私有源的gem包。
gem install cocoapods-ks –source http://IP/gems/