2014年3月15日 星期六

[VPS脚本]Vagex挂机环境搭建脚本—一键vnc+firfox+flashplayer

yt [VPS脚本]Vagex挂机环境搭建脚本   一键vnc+firfox+flashplayer去 年12月份,Vagex守信的开放了一天注册时间。其实我目测是因为之前注册的人都没有怎么挂机了,从兑换分数就能看出来。开放注册前几天是1刀比 25000,开放注册后几天就涨到了1刀比36000!然后近期呢,我也推荐了不少的特价VPS产品,把这些低价VPS拿来挂Vagex是再合适不过的 了。为了效率的,挂上vagex,很多人在网上寻找各种一键脚本,有的好用,有的不好用,有的安装包链接等已经失效了。今天我就分享下我自己修改整理的一 键脚本,共有CentOS/Debian两个版本,系统最好是使用32位,64位系统请自行寻找对应的64位版本flashplayer插件替换,下面上菜。
2014/01/07更新:脚本部分BUG更新,修改firefox浏览器安装方式,更加的兼容各种系统环境。自动将vagex插件下载到/root目录,只需使用firefox打开安装即可。
CentOS版本:
  1. #!/bin/bash  
  2. yum -y update  
  3. yum -y install vnc4server twm firefox  
  4.   
  5. vncserver && 
  6. pkill -9 vnc  &&
  7. rm -rf /tmp/.X1*  
  8. cd /root && wget http://vagex.com/vagex_add_on-1.6.2.xpi  
  9. wget http://vagex-debian.googlecode.com/files/libflashplayer.so && 
  10. mkdir -p ~/.mozilla/plugins/  &&
  11. mv libflashplayer.so ~/.mozilla/plugins/ && 
  12.   
  13. echo ’VNCSERVERS=“1:root”‘ >> /etc/sysconfig/vncservers && 
  14. echo ’VNCSERVERARGS[1]=“-geometry 800×600″‘ >> /etc/sysconfig/vncservers && 
  15. /etc/init.d/vncserver stop  &&
  16. cat >/root/.vnc/xstartup <<EOF  
  17. #!/bin/sh  
  18. twm &  
  19. temp=$(ps aux | grep [f]irefox-bin | awk ’{print $2}’)  
  20. [ -n "$temp" ] && kill $temp > /dev/null 2>&1  
  21. firefox –display=:1 > /dev/null 2>&1  
  22. EOF  
  23.   
  24. /etc/init.d/vncserver start  
  25.   
  26. chmod +x ~/.vnc/xstartup  
  27. chkconfig vncserver on  
  28. echo “DONE!”  
Debian版本:
  1. #!/bin/bash  
  2.   
  3. PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin  
  4. export PATH  
  5.   
  6. ff_addr=“ftp://ftp.mozilla.org/pub/firefox/releases/3.6.28/linux-i686/en-US/firefox-3.6.28.tar.bz2″  
  7. vncreboot_addr=“http://vagex-debian.googlecode.com/svn/trunk/vncreboot”  
  8. vncserverd_addr=“http://vagex-debian.googlecode.com/svn/trunk/vncserverd”  
  9. flash_addr=“http://vagex-debian.googlecode.com/files/libflashplayer.so”  
  10. vagex_addr=“http://vagex.com/vagex_add_on-1.6.2.xpi”  
  11.   
  12. func_check() {  
  13.     if [ $? != 0 ]; then  
  14.         echo “———–”  
  15.         echo “ERROR! -> $1″  
  16.         echo “———–”  
  17.         exit 1  
  18.     else  
  19.         echo “———–”  
  20.         echo “DONE! -> $1″  
  21.         echo “———–”  
  22.     fi    
  23. }  
  24.   
  25. func_vncpwd() {  
  26.     echo “———–”  
  27.     echo “Plese input the VNC password below!”  
  28.     echo “———–”  
  29. }  
  30.   
  31. func_alldone() {  
  32.     echo “———–”  
  33.     echo “Now you can VNC to complete the rest of the installation manually!”  
  34.     echo “———–”  
  35. }  
  36.   
  37. func_in_flash() {  
  38.     axel -n 10 $flash_addr &&  
  39.     mkdir -p /usr/local/lib/firefox/plugins &&  
  40.     mv libflashplayer.so /usr/local/lib/firefox/plugins/  
  41.     func_check flash-installation     
  42. }  
  43.   
  44. func_in_ff() {  
  45.     aptitude -y install gcc g++ make bzip2 zip &&  
  46.     axel -n 10 $ff_addr  | tar xjf firefox-3.6.28.tar.bz2 && mv firefox/ /usr/local/lib/ &&  
  47.     ln -s /usr/local/lib/firefox/firefox /usr/bin/firefox  
  48.     func_check firefox-installation   
  49. }  
  50.   
  51. func_in_vnc() {  
  52.     aptitude -y install vnc4server &&  
  53.     func_vncpwd  
  54.     vncserver && vncserver -kill :1 &&  
  55.     mv ~/.vnc/xstartup ~/.vnc/xstartupbak &&  
  56.     cat <<- EOF >> xstartup  
  57.         #!/bin/sh  
  58.         jwm &  
  59.         temp=$(ps aux | grep [f]irefox-bin | awk ’{print $2}’)  
  60.         [ -n "$temp" ] && kill $temp > /dev/null 2>&1  
  61.         firefox –display=:1 > /dev/null 2>&1  
  62.     EOF  
  63.     mv xstartup ~/.vnc/ &&   
  64.     chmod a+x ~/.vnc/xstartup &&  
  65.     axel -n 10 $vncserverd_addr &&  
  66.     mv vncserverd /etc/init.d && chmod a+x /etc/init.d/vncserverd &&  
  67.     if [ -f /etc/rc.local ]; then  
  68.         sed -i ’/exit\ 0/d’ /etc/rc.local  
  69.         cat <<- EOF >> /etc/rc.local  
  70.             /etc/init.d/vncserverd start  
  71.             exit 0  
  72.         EOF  
  73.     else  
  74.         update-rc.d vncserverd defaults  
  75.     fi  
  76.     axel -n 10 $vncreboot_addr &&  
  77.     mv vncreboot /etc/cron.daily && chmod a+x /etc/cron.daily/vncreboot  
  78.     func_check vnc-installation   
  79. }  
  80. cd /root && wget $vagex_addr &&  
  81.   
  82. apt-get update &&  
  83.   
  84. apt-get -y –force-yes install aptitude jwm menu axel&&  
  85.   
  86. mkdir -p /tmp/vagex_debian_cache && cd /tmp/vagex_debian_cache &&  
  87. func_in_vnc &&  
  88.   
  89. func_in_ff &&  
  90.   
  91. func_in_flash &&  
  92.   
  93. cd /tmp &&  
  94.   
  95. rm -rf /tmp/vagex_debian_cache &&  
  96.   
  97. /etc/init.d/vncserverd start &&  
  98.   
  99. func_alldone  

打包好的脚本包在文章最后会给出链接的。另外,再推荐个firefox的插件,SmartVideo!这个插件可以调节youtube视频的质量, 这样不仅是节约了流量,对VPS的压力也更小,挂机稳定性更高。新版Vagex插件对于视频出现播放错误的挂机是不计算积分的!插件主页:http://smartvideo.ashishmishra.in
已打包脚本下载链接:请点击这里下载!


原创文章,转载请注明: 转载自Irsi's blog
本文链接地址: http://www.irsiblog.com/tools/vagex-vnc-firfox-flashplayer.html

沒有留言:

張貼留言