通常我们在Linux/Unix下安装一平台时往往需要十几甚至更多安装包,这些源码包来源于网络、本地硬盘、移动设备。有时碰到网络不畅通或下载地址失效会带来很多麻烦,一个好方法便是将常用的软件包下载到本地硬盘存放。问题是久而久之连自己都不晓得哪些包才是适用的。现用makeself来实现自解压倒安装倒是一个很好的解决方案,下面以制作Func客户端安装包为例。
一、整理软件包
引用
#cd /home
#mkdir FuncPack1.0
将所需的软件包都往FuncPack1.0目录丢:)
#ls FuncPack1.0
-rw-r--r-- 1 root root 50878 Sep 28 2009 certmaster-0.25.tar.gz
-rw-r--r-- 1 root root 249 Oct 8 2009 certmaster.conf
-rw-r--r-- 1 root root 152871 Sep 28 2009 func-0.25.tar.gz
-rw-r--r-- 1 root root 137 Oct 8 2009 minion.conf
-rw-r--r-- 1 root root 197981 Sep 28 2009 pyOpenSSL-0.9.tar.gz
-rw-r--r-- 1 root root 11060830 May 22 2008 Python-2.5.1.tgz
二、编写安装shell
#cd FuncPack1.0
#vi install.sh
view plaincopy to clipboardprint?
#!/bin/sh # # --------------------------------------------------- # A python&func install shell # --------------------------------------------------- # # Writed by Liu tiansi # Mail:liutiansi@gmail.com # Blog: # QQ groups:106651547 # --------------------------------------------------- _pwd=$(pwd) cd $_pwd/FuncPack1.0 echo "==================*install python2.5*============================" /bin/tar -zxvf Python-2.5.1.tgz cd Python-2.5.1 ./configure && make && make install echo "export PATH=\$PATH:/usr/local/bin" >> /etc/profile source /etc/profile cd .. echo "=================*install Func/certmaster/pyOpenSSL*=================" /bin/tar -zxvf pyOpenSSL-0.9.tar.gz cd pyOpenSSL-0.9 /usr/local/bin/python setup.py install cd .. /bin/tar -zxvf certmaster-0.25.tar.gz cd certmaster-0.25 /usr/local/bin/python setup.py install cd .. /bin/tar -zxvf func-0.25.tar.gz cd func-0.25 /usr/local/bin/python setup.py install cd .. /bin/ln -s /usr/local/bin/certmaster /usr/bin/certmaster /bin/ln -s /usr/local/bin/funcd /usr/bin/funcd /bin/sed -i 's/'`hostname`'//g' /etc/hosts /bin/rm -rf /etc/certmaster/certmaster.conf /bin/rm -rf /etc/certmaster/minion.conf /bin/cp certmaster.conf /etc/certmaster /bin/cp minion.conf /etc/certmaster /bin/sed -i -e '/^listen_port/{ s/51234/1999/; }' /etc/func/minion.conf /bin/sed -i -e "/^minion_name/{ s@=@= `hostname`@; }" /etc/func/minion.conf /sbin/chkconfig --level 345 certmaster on /sbin/service certmaster start /sbin/chkconfig --level 345 funcd on /sbin/service funcd start echo "Install over!" #chmod +x install.sh