文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>轻松实现源码打包安装

轻松实现源码打包安装

时间:2010-08-24  来源:bailiangcn

通常我们在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 plainprint?
  1. #!/bin/sh  
  2. #  
  3. # ---------------------------------------------------  
  4. # A python&func install shell  
  5. # ---------------------------------------------------  
  6. #   
  7. #       Writed by Liu  tiansi  
  8. #       Mail:[email protected]  
  9. #       Blog:http://blog.liuts.com  
  10. #       QQ groups:106651547  
  11. # ---------------------------------------------------  
  12.   
  13.   
  14. _pwd=$(pwd)  
  15. cd $_pwd/FuncPack1.0  
  16.   
  17. echo "==================*install python2.5*============================"  
  18. /bin/tar -zxvf Python-2.5.1.tgz  
  19. cd Python-2.5.1  
  20. ./configure && make && make install  
  21. echo "export PATH=\$PATH:/usr/local/bin" >> /etc/profile  
  22. source /etc/profile  
  23. cd ..  
  24.   
  25. echo "=================*install Func/certmaster/pyOpenSSL*================="  
  26.   
  27. /bin/tar -zxvf pyOpenSSL-0.9.tar.gz  
  28. cd pyOpenSSL-0.9  
  29. /usr/local/bin/python setup.py install  
  30. cd ..  
  31.   
  32. /bin/tar -zxvf certmaster-0.25.tar.gz  
  33. cd certmaster-0.25  
  34. /usr/local/bin/python setup.py install  
  35. cd ..  
  36.   
  37. /bin/tar -zxvf func-0.25.tar.gz  
  38. cd func-0.25  
  39. /usr/local/bin/python setup.py install  
  40. cd ..  
  41.   
  42. /bin/ln -s /usr/local/bin/certmaster /usr/bin/certmaster  
  43. /bin/ln -s /usr/local/bin/funcd /usr/bin/funcd  
  44.   
  45. /bin/sed -i 's/'`hostname`'//g' /etc/hosts  
  46.   
  47. /bin/rm -rf /etc/certmaster/certmaster.conf  
  48. /bin/rm -rf /etc/certmaster/minion.conf  
  49. /bin/cp certmaster.conf /etc/certmaster  
  50. /bin/cp minion.conf  /etc/certmaster  
  51.   
  52. /bin/sed -i -e '/^listen_port/{ s/51234/1999/; }' /etc/func/minion.conf  
  53. /bin/sed -i -e "/^minion_name/{ s@=@= `hostname`@; }" /etc/func/minion.conf  
  54.   
  55. /sbin/chkconfig --level 345 certmaster on  
  56. /sbin/service certmaster start  
  57.   
  58. /sbin/chkconfig --level 345 funcd on  
  59. /sbin/service funcd start  
  60.   
  61. echo "Install over!"  
#!/bin/sh # # --------------------------------------------------- # A python&func install shell # --------------------------------------------------- # #       Writed by Liu  tiansi #       Mail:[email protected] #       Blog:http://blog.liuts.com #       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

三、打包
#cd /home
#wget http://megastep.org/makeself/makeself-2.1.5.run
#chmod +x makeself-2.1.5.run
#./makeself-2.1.5.run
#cd makeself-2.1.5
开始打包!
#./makeself.sh  --notemp ../FuncPack1.0/ FuncPack1.0.bin "system start install ..." ./install.sh
运行结果:
引用
Header is 402 lines long

About to compress 11280 KB of data...
Adding files to archive named "FuncPack1.0.bin"...
./
./func-0.25.tar.gz
./Python-2.5.1.tgz
./pyOpenSSL-0.9.tar.gz
./install.sh
./minion.conf
./certmaster.conf
./certmaster-0.25.tar.gz
CRC: 853861468
MD5: 14463177b627f0e85f3591e88fb02b1d

Self-extractible archive "FuncPack1.0.bin" successfully created.


命令说明:
1、--notemp 不生成临时目录,在当前目录下创建一新的目录(推荐)
2、../FuncPack1.0/ 打包的源目录
3、FuncPack1.0.bin 生成自运行解压文件
4、"system start install ..." 安装提示信息
5、./install.sh 解压后所要执行的安装脚本
6、CRC、MD5(防止被篡改)

更多说明见官方http://megastep.org/makeself/

四、运行包
1、将生成的FuncPack1.0.bin文件scp到其它主机
2、运行FuncPack1.0.bin即可
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载