2021-05-12 14:32:11
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
相關文章