歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux下輕松實現源碼打包安裝

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

日期:2017/2/28 16:18:27   编辑: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. _pwd=$(pwd)
  13. cd $_pwd/FuncPack1.0
  14. echo "==================*install python2.5*============================"
  15. /bin/tar -zxvf Python-2.5.1.tgz
  16. cd Python-2.5.1
  17. ./configure && make && make install
  18. echo "export PATH=\$PATH:/usr/local/bin" >> /etc/profile
  19. source /etc/profile
  20. cd ..
  21. echo "=================*install Func/certmaster/pyOpenSSL*================="
  22. /bin/tar -zxvf pyOpenSSL-0.9.tar.gz
  23. cd pyOpenSSL-0.9
  24. /usr/local/bin/python setup.py install
  25. cd ..
  26. /bin/tar -zxvf certmaster-0.25.tar.gz
  27. cd certmaster-0.25
  28. /usr/local/bin/python setup.py install
  29. cd ..
  30. /bin/tar -zxvf func-0.25.tar.gz
  31. cd func-0.25
  32. /usr/local/bin/python setup.py install
  33. cd ..
  34. /bin/ln -s /usr/local/bin/certmaster /usr/bin/certmaster
  35. /bin/ln -s /usr/local/bin/funcd /usr/bin/funcd
  36. /bin/sed -i 's/'`hostname`'//g' /etc/hosts
  37. /bin/rm -rf /etc/certmaster/certmaster.conf
  38. /bin/rm -rf /etc/certmaster/minion.conf
  39. /bin/cp certmaster.conf /etc/certmaster
  40. /bin/cp minion.conf /etc/certmaster
  41. /bin/sed -i -e '/^listen_port/{ s/51234/1999/; }' /etc/func/minion.conf
  42. /bin/sed -i -e "/^minion_name/{ s@=@= `hostname`@; }" /etc/func/minion.conf
  43. /sbin/chkconfig --level 345 certmaster on
  44. /sbin/service certmaster start
  45. /sbin/chkconfig --level 345 funcd on
  46. /sbin/service funcd start
  47. echo "Install over!"
#chmod +x install.sh
Copyright © Linux教程網 All Rights Reserved