linux中国网

linux菜菜鸟的日记

源码安装saltstack

这新公司工作机不能连外网,只能各种无语
1.所需软件包
wget -c https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
用本地文件创建本地yum源
1. 创建iso存放目录和挂载目录
mkdir /mnt/iso
mkdir /mnt/cdrom
2. 将iso镜像文件上传到/mnt/iso文件夹下
3. 将/mnt/iso/下的iso文件挂载到/mnt/cdrom目录
mount -o loop /mnt/iso/XXXXX.iso /mnt/cdrom <注:挂载完之后对其操作会提示设备繁忙,此时需要umount解开挂载才行>
查看是否挂载成功: df -h <用来查看系统中所有挂载的,mount也可以>
4.<最关键的一步>如果/etc/yum.repos/下面有其它的*.repo文件,先创建个文件夹,将这些*.repo先转移到文件夹中,自己写一个.repo的文件
mkdir /etc/yum.repos.d/bak ;
mv *.repo /etc/yum.repos.d/bak 然后创建自己的.repo文件
vi myself.repo #注释在线上要去掉
[base]
name=RedHat
baseurl=file:///mnt/cdrom #注:这里的baseurl就是你挂载的目录,在这里是/mnt/cdrom
enabled=1 #注:这里的值enabled一定要为1 gpgckeck的值无所谓
gpgckeck=0
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-6 #注:这个你cd /mnt/cdrom/可以看到这个key,这里仅仅是个例子
yum clean all
##here
yum install gcc* -y
3.安装python START HERE ok
tar xzvf Python-2.7.8.tgz
cd Python-2.7.8
./configure –prefix=/usr/local/python27
make && make install
mv /usr/bin/python /usr/bin/python2.6bak
ln -s /usr/local/python27/bin/python /usr/bin/python
(3) 解决系统python软链接指向python2.7版本后,yum不能正常工作
方法:
$vi /usr/bin/yum
将文本编辑显示的第一行
#!/usr/bin/python修改为#!/usr/bin/python2.4,保存修改即可
安装zlib
yum install zlib-devel -y
wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz
62 cd zlib-1.2.8
63 ./configure –prefix=/usr/local/zlib-1.2.8 -share
64 make -j2 && make install
配置库文件搜索路径
#追加

cat >> /etc/ld.so.conf<<eof
/usr/local/zlib-1.2.8/lib
/usr/local/lib/
EOF

ln -s /usr/local/zlib-1.2.8 /usr/local/zlib

#20160126pm
源码安装saltstack
192.168.1.100
1.所需软件包
#today 的
yum  groupinstall  "Development Tools"   -y
wget -c https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
[root@ll]# ls -ltr
-rw-r--r--  1 root root    571091 Jan 15 15:03 zlib-1.2.8.tar.gz
-rw-r--r--  1 root root    256862 Jan 15 15:03 setuptools-0.6c11.tar.gz
-rw-r--r--  1 root root    232384 Jan 15 15:03 python-dateutil-1.5.tar.gz
-rw-r--r--  1 root root   4434910 Jan 15 15:03 openssl-1.0.1k.tar.gz
-rw-r--r--  1 root root    248685 Jan 15 15:03 PyYAML-3.11.tar.gz
-rw-r--r--  1 root root    443445 Jan 15 15:03 pycrypto-2.6.tar.gz
-rw-r--r--  1 root root     13416 Jan 15 15:03 MarkupSafe-0.23.tar.gz
-rw-r--r--  1 root root    378470 Jan 15 15:03 Jinja2-2.7.3.tar.gz
-rw-r--r--  1 root root   2153667 Jan 15 15:03 zeromq-4.0.5.tar.gz
-rw-r--r--  1 root root    503012 Jan 15 15:03 yaml-0.1.6.tar.gz
-rw-r--r--  1 root root    995366 Jan 15 15:03 pyzmq-14.4.1.tar.gz
-rw-r--r--  1 root root  14846119 Jan 15 15:03 Python-2.7.8.tgz
-rw-r--r--  1 root root    113908 Jan 15 15:03 msgpack-python-0.4.4.tar.gz
-rw-r--r--  1 root root      3584 Jan 15 15:03 msgpack-pure-0.1.3.tar.gz
-rw-r--r--  1 root root     74795 Jan 15 15:03 M2Crypto-0.22.3.tar.gz
-rw-r--r--  1 root root   5310295 Jan 15 15:03 swig-2.0.11.tar.gz
-rw-r--r--  1 root root   2845127 Jan 15 15:37 salt-2014.1.4.tar.gz
用本地文件创建本地yum源
1. 创建iso存放目录和挂载目录
mkdir /mnt/iso
mkdir /mnt/cdrom
2. 将iso镜像文件上传到/mnt/iso文件夹下
3. 将/mnt/iso/下的iso文件挂载到/mnt/cdrom目录
mount -o loop /mnt/iso/XXXXX.iso /mnt/cdrom   <注:挂载完之后对其操作会提示设备繁忙,此时需要umount解开挂载才行>
查看是否挂载成功:  df -h <用来查看系统中所有挂载的,mount也可以>
4.<最关键的一步>如果/etc/yum.repos/下面有其它的*.repo文件,先创建个文件夹,将这些*.repo先转移到文件夹中,自己写一个.repo的文件
mkdir /etc/yum.repos.d/bak ;
mv *.repo /etc/yum.repos.d/bak     然后创建自己的.repo文件
vi myself.repo #注释在线上要去掉
[base]
name=RedHat
baseurl=file:///mnt/cdrom    #注:这里的baseurl就是你挂载的目录,在这里是/mnt/cdrom
enabled=1                             #注:这里的值enabled一定要为1   gpgckeck的值无所谓
gpgckeck=0
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-6                    #注:这个你cd /mnt/cdrom/可以看到这个key,这里仅仅是个例子
yum clean all
##here
yum install gcc* -y
3.安装python  START HERE
#wget -c https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tar xzvf Python-2.7.8.tgz  && cd Python-2.7.8 && \
./configure --prefix=/usr/local/python27 && \
make -j2  &&  make install
mv /usr/bin/python /usr/bin/python2.6bak
ln -s /usr/local/python27/bin/python /usr/bin/python
(3) 解决系统python软链接指向python2.7版本后,yum不能正常工作
方法:
$vi /usr/bin/yum
将文本编辑显示的第一行
#!/usr/bin/python修改为#!/usr/bin/python2.6,保存修改即可
#安装zlib
yum install zlib-devel -y
#wget http://zlib.net/zlib-1.2.8.tar.gz
tar xvf zlib-1.2.8.tar.gz  && cd zlib-1.2.8
./configure --prefix=/usr/local/zlib-1.2.8 -share  && \
make -j2  && make install
#配置库文件搜索路径
#追加
cat >> /etc/ld.so.conf<<eof
/usr/local/zlib-1.2.8/lib
/usr/local/lib/
EOF
ln -s /usr/local/zlib-1.2.8 /usr/local/zlib
#today 安装setuptools  setuptools 和easy_install介绍和安装方法
#http://f.dataguru.cn/thread-82306-1-1.html
tar xvf setuptools-0.6c11.tar.gz  && cd setuptools-0.6c11
python setup.py build
 python setup.py  install
 #后来的
  wget https://bitbucket.org/pypa/setuptools/get/default.tar.gz#egg=setuptools-dev
  162  tar xvf default.tar.gz
  163  cd pypa-setuptools-cf547c694dc5/
  164  python setup.py build
  165  python setup.py  install
 #安装python-dateutil
 #wget https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.4.2.tar.gz#md5=4ef68e1c485b09e9f034e10473e5add2
yum install openssl-devel
./config -fPIC
./config shared zlib-dynamic --prefix=/usr/local/openssl-1.0.1q --with-zlib-lib=/usr/local/zlib-1.2.8/lib --with-zlib-include=/usr/local/zlib-1.2.8/include -enable-shared --prefix=/usr/local/openssl-1.0.1q
make -j2 && make install
http://www.yallonking.com/?p=1428
http://linuxshow.blog.51cto.com/1572053/1389746
http://www.cnblogs.com/zhutianpeng/p/3883819.html
Salt中ZeroMQ那点事¶
http://www.saltstack.cn/projects/cssug-kb/wiki/Salt-zeromq-01
##**** 20160124  ssh   root@192.168.1.110
3.安装python
#wget -c https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tar xzvf Python-2.7.8.tgz  && cd Python-2.7.8 && \
./configure --prefix=/usr/local/ && \
make --jobs=`grep processor /proc/cpuinfo | wc -l` &&  make install
#直接 ./configure --prefix=/usr/local/ 所以下面的不用
#mv /usr/bin/python /usr/bin/python2.6bak
#ln -s /usr/local/python27/bin/python /usr/bin/python
(3) 解决系统python软链接指向python2.7版本后,yum不能正常工作
方法:
$vi /usr/bin/yum
将文本编辑显示的第一行
#!/usr/bin/python修改为#!/usr/bin/python2.6,保存修改即可
## 将python头文件拷贝到标准目录,以避免编译saltstack时,找不到所需的头文件
cd /usr/local/include/python2.7
cp -a ./* /usr/local/include/
## 备份旧版本的python,并符号链接新版本的python
 cd /usr/bin
 mv python python2.6.6 # on centos6.7
 ln -s /usr/local/bin/python # why
 #2) pyyaml install
 #http://pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz
 jobs=`grep processor /proc/cpuinfo | wc -l`
cpunu=`grep processor /proc/cpuinfo | wc -l`
 tar xvf yaml-0.1.6.tar.gz  && cd yaml-0.1.6
./configure --prefix=/usr/local  && \
 make -j$cpunu  && make install
tar xvf PyYAML-3.11.tar.gz  &&  cd PyYAML-3.11
python setup.py  install
#安装zlib
yum install zlib-devel -y
#wget http://zlib.net/zlib-1.2.8.tar.gz
tar xvf zlib-1.2.8.tar.gz  && cd zlib-1.2.8
./configure --prefix=/usr/local/ -share  && \
make -j2  && make install
#配置库文件搜索路径
#追加
cat >> /etc/ld.so.conf<<eof
/usr/local/zlib-1.2.8/lib
/usr/local/lib/
EOF
ln -s /usr/local/zlib-1.2.8 /usr/local/zlib
#Compression requires the (missing) zlib module"
#RuntimeError: Compression requires the (missing) zlib module
#http://blog.csdn.net/zhuying_linux/article/details/8167430
yum install zlib-devel -y # 和安装zlib  然后重新编译python27就好了 为什么要两次呢 这个怎么能好看的解决一下呢  setuptools 这个要记得删除再重装
cpunu=`grep processor /proc/cpuinfo | wc -l`
tar xzvf Python-2.7.8.tgz  && cd Python-2.7.8 && \
./configure --prefix=/usr/local/ && \
make -j$cpunu &&  make install
#3) setuptools install
tar xvf setuptools-7.0.tar.gz
cd setuptools-7.0
python setup.py  install
#4)markupsafe
#https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.9.3.tar.gz
tar xvf MarkupSafe-0.9.3.tar.gz  && cd MarkupSafe-0.9.3
python setup.py  install
#5)jinja2模块安装
wget https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.8.tar.gz#md5=edb51693fe22c53cee5403775c71a99e
tar xvf  Jinja2-2.8.tar.gz
cd Jinja2-2.8
python setup.py  install
(6)、pyzmq模块安装
#http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar xvf autoconf-2.69.tar.gz
  201  cd autoconf-2.69
  202  ./configure --prefix=/usr
  203  make -j2
  204  make install
#http://pkgs.org/centos-6/centos-x86_64/uuid-1.6.1-10.el6.x86_64.rpm.html
#http://mirror.centos.org/centos/6/os/x86_64/Packages/uuid-1.6.1-10.el6.x86_64.rpm
## 其他依赖库安装 没有的只能自己rpm
yum -y install libuuid.x86_64 libuuid-devel.x86_64
yum -y install uuid.x86_64 uuid-devel.x86_64 # here
yum -y install uuid-c++.x86_64 uuid-c++-devel.x86_64 #这样写不对吧
 wget http://mirrors.aliyun.com/centos/6.7/os/x86_64/Packages/libuuid-devel-2.17.2-12.18.el6.x86_64.rpm
 http://mirrors.aliyun.com/centos/6.7/os/x86_64/Packages/uuid-c%2b%2b-1.6.1-10.el6.x86_64.rpm
 rpm -ivh uuid-devel-1.6.1-10.el6.x86_64.rpm
 rpm -ivh uuid-devel-1.6.1-10.el6.x86_64.rpm
 rpm -ivh uuid-c++-1.6.1-10.el6.x86_64.rpm
rpm -ivh uuid-c++-devel-1.6.1-10.el6.x86_64.rpm
yum install pcre-devel -y
https://github.com/jedisct1/libsodium/archive/1.0.1.tar.gz
tar xvf libsodium-1.0.1.tar.gz
  261  cd libsodium-1.0.1
  262  ./autogen.sh
  263  autoconf -V
  264  ./configure --prefix=/usr/local
  make -j2  &&  make install
checking for sodium... no
configure: error: Package requirements (libsodium) were not met:
No package 'libsodium' found
https://kerpanic.wordpress.com/2015/07/09/zero-mq-installation-package-requirements-libsodium-were-not-met/
https://github.com/zeromq/libzmq/issues/1556
 tar xvf zeromq-4.1.4.tar.gz
 cd zeromq-4.1.4
./autogen.sh
./configure  --prefix=/usr/local/  --without-libsodium
make -j2  &&  make install
 yum install python-devel openssl-devel
 tar xvf pyzmq-15.2.0.tar.gz
  283  cd pyzmq-15.2.0
  284  python setup.py  configure --zmq=/usr/local
  285  python setup.py  install
(7)、M2Crypto模块安装
yum -y install swig.x86_64
 tar xvf openssl-1.0.1g.tar.gz
  290  cd openssl-1.0.1g
# ./config shared --prefix=/usr/local
  ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
  292  make -j2 && make install
wget https://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-0.22.5.tar.gz
swig error : Unrecognized option -builtin
Use 'swig -help' for available options.
error: command 'swig' failed with exit status 1
https://teddysun.com/440.html
 tar xvf swig-3.0.7.tar.gz
 cd swig-3.0.7
 ./configure --prefix=/usr
 make -j2 && make  install
tar xvf M2Crypto-0.22.5.tar.gz  && \
 cd M2Crypto-0.22.5 && \   cp  /usr/include/openssl/opensslconf-x86_64.h .
 python setup.py  install
SWIG/_m2crypto.i
/usr/include/openssl/opensslconf.h:29: Error: Unable to find 'opensslconf-x86_64.h'
error: command 'swig' failed with exit status 1
(8)、msgpack模块安装
https://pypi.python.org/packages/source/m/msgpack-python/msgpack-python-0.4.6.tar.gz
tar xvf msgpack-python-0.4.6.tar.gz
cd msgpack-python-0.4.6
 python setup.py install
(9)、msgpack-pure模块安装 #要看清楚呀 一开始搞成msgpack-python老是报错 说没权限 在自己的kali 丢人
https://pypi.python.org/packages/source/m/msgpack-pure/msgpack-pure-0.1.3.tar.gz
tar xvzf msgpack-pure-0.1.3.tar.gz && \
 cd msgpack-pure-0.1.3  &&
 python setup.py  install
 (10)、pycrypto模块安装
https://pypi.python.org/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz
tar xvzf pycrypto-2.6.1.tar.gz  && cd pycrypto-2.6.1 && \
python setup.py install
(11)、requests模块安装
https://pypi.python.org/packages/source/r/requests/requests-2.9.1.tar.gz
tar xvzf requests-2.9.1.tar.gz && \
cd requests-2.9.1 &&  python setup.py install
(12)、其他模块安装 这些我暂时没有安装 20160124pm
https://pypi.python.org/packages/source/l/libnacl/libnacl-1.3.5.tar.gz
https://pypi.python.org/packages/source/i/ioflo/ioflo-1.0.2.tar.gz
https://pypi.python.org/packages/source/s/six/six-1.8.0.tar.gz
https://pypi.python.org/packages/source/r/raet/raet-0.4.2.tar.gz
https://pypi.python.org/packages/source/M/Mako/Mako-1.0.0.tar.gz
注意:
以上模块为REAT通信模式所依赖的模块,作为可选项,非必要。
https://github.com/saltstack/salt/releases/download/v2015.5.9/salt-2015.5.9.tar.gz
tar xvf salt-2015.5.9.tar.gz  &&  cd salt-2015.5.9 && \
python setup.py install
salt --versions-report
启动salt err
    import _ssl             # if we can't import it, let the error propagate
ImportError: No module named _ssl
解决 办法
 vim Python-2.7.8/Modules/Setup
213 # Socket module helper for socket(2)
214 _socket socketmodule.c timemodule.c
215
216 # Socket module helper for SSL support; you must comment out the other
217 # socket line above, and possibly edit the SSL variable:
218 #SSL=/usr/local/ssl
219 _ssl _ssl.c \
220         -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
221         -L$(SSL)/lib -lssl -lcrypto
222
 vi /etc/salt/master
#user: root
user: evan
#这个有用么
chown -R evan  /etc/salt /var/cache/salt /var/log/salt /var/run/salt

redhat 6.4源碼編譯saltstack自動化安裝腳本
http://www.xlgps.com/article/405767.html
salt源码安装good
http://www.yallonking.com/?p=1428
http://linuxshow.blog.51cto.com/1572053/1389746
http://www.cnblogs.com/zhutianpeng/p/3883819.html

评论已关闭。