![[VPS脚本]Vagex挂机环境搭建脚本 一键vnc+firfox+flashplayer yt [VPS脚本]Vagex挂机环境搭建脚本 一键vnc+firfox+flashplayer](http://irsiblog.u.qiniudn.com/wp-content/uploads/2014/01/yt.png)
2014/01/07更新:脚本部分BUG更新,修改firefox浏览器安装方式,更加的兼容各种系统环境。自动将vagex插件下载到/root目录,只需使用firefox打开安装即可。
CentOS版本:
- #!/bin/bash
- yum -y update
- yum -y install vnc4server twm firefox
- vncserver &&
- pkill -9 vnc &&
- rm -rf /tmp/.X1*
- cd /root && wget http://vagex.com/vagex_add_on-1.6.2.xpi
- wget http://vagex-debian.googlecode.com/files/libflashplayer.so &&
- mkdir -p ~/.mozilla/plugins/ &&
- mv libflashplayer.so ~/.mozilla/plugins/ &&
- echo ’VNCSERVERS=“1:root”‘ >> /etc/sysconfig/vncservers &&
- echo ’VNCSERVERARGS[1]=“-geometry 800×600″‘ >> /etc/sysconfig/vncservers &&
- /etc/init.d/vncserver stop &&
- cat >/root/.vnc/xstartup <<EOF
- #!/bin/sh
- twm &
- temp=$(ps aux | grep [f]irefox-bin | awk ’{print $2}’)
- [ -n "$temp" ] && kill $temp > /dev/null 2>&1
- firefox –display=:1 > /dev/null 2>&1
- EOF
- /etc/init.d/vncserver start
- chmod +x ~/.vnc/xstartup
- chkconfig vncserver on
- echo “DONE!”
- #!/bin/bash
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- export PATH
- ff_addr=“ftp://ftp.mozilla.org/pub/firefox/releases/3.6.28/linux-i686/en-US/firefox-3.6.28.tar.bz2″
- vncreboot_addr=“http://vagex-debian.googlecode.com/svn/trunk/vncreboot”
- vncserverd_addr=“http://vagex-debian.googlecode.com/svn/trunk/vncserverd”
- flash_addr=“http://vagex-debian.googlecode.com/files/libflashplayer.so”
- vagex_addr=“http://vagex.com/vagex_add_on-1.6.2.xpi”
- func_check() {
- if [ $? != 0 ]; then
- echo “———–”
- echo “ERROR! -> $1″
- echo “———–”
- exit 1
- else
- echo “———–”
- echo “DONE! -> $1″
- echo “———–”
- fi
- }
- func_vncpwd() {
- echo “———–”
- echo “Plese input the VNC password below!”
- echo “———–”
- }
- func_alldone() {
- echo “———–”
- echo “Now you can VNC to complete the rest of the installation manually!”
- echo “———–”
- }
- func_in_flash() {
- axel -n 10 $flash_addr &&
- mkdir -p /usr/local/lib/firefox/plugins &&
- mv libflashplayer.so /usr/local/lib/firefox/plugins/
- func_check flash-installation
- }
- func_in_ff() {
- aptitude -y install gcc g++ make bzip2 zip &&
- axel -n 10 $ff_addr | tar xjf firefox-3.6.28.tar.bz2 && mv firefox/ /usr/local/lib/ &&
- ln -s /usr/local/lib/firefox/firefox /usr/bin/firefox
- func_check firefox-installation
- }
- func_in_vnc() {
- aptitude -y install vnc4server &&
- func_vncpwd
- vncserver && vncserver -kill :1 &&
- mv ~/.vnc/xstartup ~/.vnc/xstartupbak &&
- cat <<- EOF >> xstartup
- #!/bin/sh
- jwm &
- temp=$(ps aux | grep [f]irefox-bin | awk ’{print $2}’)
- [ -n "$temp" ] && kill $temp > /dev/null 2>&1
- firefox –display=:1 > /dev/null 2>&1
- EOF
- mv xstartup ~/.vnc/ &&
- chmod a+x ~/.vnc/xstartup &&
- axel -n 10 $vncserverd_addr &&
- mv vncserverd /etc/init.d && chmod a+x /etc/init.d/vncserverd &&
- if [ -f /etc/rc.local ]; then
- sed -i ’/exit\ 0/d’ /etc/rc.local
- cat <<- EOF >> /etc/rc.local
- /etc/init.d/vncserverd start
- exit 0
- EOF
- else
- update-rc.d vncserverd defaults
- fi
- axel -n 10 $vncreboot_addr &&
- mv vncreboot /etc/cron.daily && chmod a+x /etc/cron.daily/vncreboot
- func_check vnc-installation
- }
- cd /root && wget $vagex_addr &&
- apt-get update &&
- apt-get -y –force-yes install aptitude jwm menu axel&&
- mkdir -p /tmp/vagex_debian_cache && cd /tmp/vagex_debian_cache &&
- func_in_vnc &&
- func_in_ff &&
- func_in_flash &&
- cd /tmp &&
- rm -rf /tmp/vagex_debian_cache &&
- /etc/init.d/vncserverd start &&
- func_alldone
已打包脚本下载链接:请点击这里下载!
沒有留言:
張貼留言