有时候我们只能在某个机器上网获得RPM安装包,如何将RPM包在不能上网的内网机器安装,就需要能将安装包下载到本地而不安装,然后再把这些包复制到内网机器,进行安装。另外一个方法是建立镜像服务器,没有测试!下面开始实验,以安装saltstack(salt-master和salt-minion)为例。
1) 首先在能上外网的机器上设置好yum源。我的RHEL6.4已经设置了几个yum源,如下:
[rhel6_4-default]
name = "Red Hat Enterprise Linux Server release 6.4 (Santiago)"
baseurl = ftp://192.168.122.100/pub/rhel64
enabled = 1
gpgcheck = 1
gpgkey = ftp://192.168.122.100/pub/rhel64/RPM-GPG-KEY-RedHat-release
[cloudera-cdh5]
# Packages for Cloudera's Distribution for Hadoop, Version 5, on RedHat or CentOS 6 x86_64
name = Cloudera's Distribution for Hadoop, Version 5
enabled = 1
gpgcheck = 1
baseurl = ftp://192.168.122.100/pub/cloudera/cdh/5/
gpgkey = ftp://192.168.122.100/pub/cloudera/cdh/RPM-GPG-KEY-cloudera
[cloudera-gplextras5]
# Packages for Cloudera's GPLExtras, Version 5, on RedHat or CentOS 6 x86_64
name = Cloudera's GPLExtras, Version 5
enabled = 1
gpgcheck = 1
baseurl = ftp://192.168.122.100/pub/cloudera/gplextras/5/
gpgkey = ftp://192.168.122.100/pub/cloudera/gplextras/RPM-GPG-KEY-cloudera
[epel-6]
name=Extra Packages for Enterprise Linux 6
#
#
baseurl=http://ftp.linux.ncsu.edu/pub/epel/6/x86_64
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=http://ftp.linux.ncsu.edu/pub/epel/RPM-GPG-KEY-EPEL-6
为获取saltstack安装包,需要增加下面的yum源:
****安装rpmforge
****这步很重要,在redhat 6和centos 6的epel源上没有Python-jinja2.
# wget --no-check-certificate
# rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
好了,需要的源准备齐全。开始安装插件yum-plugin-downloadonly.noarch 0:1.1.30-14.el6:
# yum install yum-downloadonly
安装完毕之后,这台机器就可以下载但是不安装saltstack的RPM包了。
# mkdir /root/Downloads/salt-minion
# mkdir /root/Downloads/salt-master
# mkdir /root/Downloads/salt-ssh
# mkdir /root/Downloads/salt-api
# yum install -y --downloadonly --downloaddir=/root/Downloads/salt-minion salt-minion
# yum install -y --downloadonly --downloaddir=/root/Downloads/salt-master salt-master
# yum install -y --downloadonly --downloaddir=/root/Downloads/salt-ssh salt-ssh #### minion上不需要安装任何salt,直接在master通过ssh.
# yum install -y --downloadonly --downloaddir=/root/Downloads/salt-api salt-api #### rest api of salt
2) 把/root/Downloads/salt-minion下面的rpm复制到其他机器上,然后安装:
# scp -r /root/Downloads/salt-minion root@anotherIP:~/
# ssh root@anotherIP
# cd ~/salt-minion
# rpm -ivh *.rpm
###########################################
#### service salt-minion start
#### service salt-master start
#### service salt-api start
同样的可以安装salt-master.