歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux教程

Linux下輕松實現源碼打包安裝

通常我們在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?
  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!"  
#chmod +x install.sh
Copyright © Linux教程網 All Rights Reserved