感谢支持
我们一直在努力

RHEL6下获取安装包(RPM)而不安装的方法

有时候我们只能在某个机器上网获得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
# http://ftp.linux.ncsu.edu/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#
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 http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
  # 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.

RPM包创建入门  http://www.linuxidc.com/Linux/2015-02/113559.htm

如何在Linux中创建RPM包?  http://www.linuxidc.com/Linux/2012-05/60278.htm

制作自己的rpm包 http://www.linuxidc.com/Linux/2013-06/86435.htm

Linux 下rpm安装后的目录结构和一些配置 http://www.linuxidc.com/Linux/2013-06/85761.htm

rpm与yum的综合性介绍与示例演示 http://www.linuxidc.com/Linux/2013-05/84480.htm

Redhat Linux—rpm 命令详解 http://www.linuxidc.com/Linux/2013-03/81971.htm

使用FPM轻松制作RPM包 http://www.linuxidc.com/linux/2014-06/103019.htm

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-04/116400.htm

赞(0) 打赏
转载请注明出处:服务器评测 » RHEL6下获取安装包(RPM)而不安装的方法
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏