Posted on 2013-08-20 22:56
H2O 閱讀(263)
評論(0) 編輯 收藏
一個更省資源的掛機方案!
所以選擇了debian,以下步驟僅僅適用于debian 6 32bits系統!
64位的和其他系統自己根據實際情況修改!
提醒一點,因為是編譯安裝,編譯過程會比較慢,這個跟VPS的性能有關,時間最長的我經歷過4個小時以上!所以建議以下所有的過程都在screen里面執行!
1.安裝相關依賴
最先apt-get update apt-get upgrade
apt-get -q -y --force-yes install vnc4server xterm jwm mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 yasm bzip2 libidl-dev zip
2.下載firefox 3.6.28的源碼包,解壓并編譯安裝。
wget http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.6/source/firefox-3.6.source.tar.bz2#這個版本不好 會總是崩潰 補充一個版本
http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/3.6.28/linux-i686/zh-CN/firefox-3.6.28.tar.bz2
bzip2 -d firefox-3.6.28.source.tar.bz2
tar -xvf firefox-3.6.28.source.tar
cd mozilla-*
./configure --enable-application=browser && make && make install
3.下載flash插件并安裝
wget http://fpdownload.macromedia.com/get/flashplayer/pdc/11.2.202.297/install_flash_player_11_linux.i386.tar.gz
tar xvzf install_flash_player_10_linux.tar.gz
mkdir -p ~/.mozilla/plugins/
cp libflashplayer.so ~/.mozilla/plugins/
4.啟動VNC并設置
vncserver
vi ~/.vnc/xstartup
把以下兩行內容添加到末尾
startjwm &
firefox --display=:1
添加權限
chmod +x ~/.vnc/xstartup
5.設置VNC開機啟動
vi /etc/init.d/vncserver
將以下內容填入
### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
PATH="$PATH:/usr/X11R6/bin/"
# The Username:Group that will run VNC
export USER="root"
#${RUNAS}
# The display that VNC will use
DISPLAY="1"
# Color depth (between 8 and 32)
DEPTH="16"
# The Desktop geometry to use.
#GEOMETRY="x"
GEOMETRY="800x600"
#You Can Choice GEOMETRY="1024x768" && GEOMETRY="1280x1024"
# The name that the VNC Desktop will have.
NAME="Vncserver"
OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
. /lib/lsb/init-functions
case "$1" in
start)
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;
stop)
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
;;
restart)
$0 stop
$0 start
;;
esac
exit 0
添加權限
chmod +x /etc/init.d/vncserver
使配置生效
update-rc.d vncserver defaults #debian5可以
但是6的方式不同 6會報錯update-rc.d: using dependency based boot sequencing
#debian6的方式
先安裝 aptitude install insserv
insserv vncserver
6.添加計劃任務,定時重啟vnc或者系統,以防止firefox假死不出分
crontab -e
#每隔一小時重新啟動vncserver
* */1 * * * /etc/init.d/cron restart
配置完后重啟 /etc/init.d/cron restart 即可生效
規則就不多說,根據自己的實際情況編寫。
規則編寫可參考以下兩篇文章
http://www.linuxde.net/2011/12/3758.html
http://hi.baidu.com/aboc/blog/item/3d469358b9f468cd9d82047d.html
7.重啟,安裝插件進行相關設置即可!
reboot
相關設置,請參考
http://sunsea.im/linux-vps-vagex-automatic-money.html
本文參考:http://www.autoinstallscript.com/有修改
不斷折騰,又發現一種方式:
備註:推薦環境 Debian 6.0 x64
1 更新庫
apt-get update
2 安裝vncserver與相關組件
apt-get -q -y --force-yes install vnc4server xterm jwm mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev mesa-common-dev autoconf2.13 yasm bzip2 libidl-dev zip ia32-libs-gtk
3 下載火狐并解壓 wget http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/14.0.1/linux-i686/en-US/firefox-14.0.1.tar.bz2
tar jxvf firefox-14.0.1.tar.bz2
4 下載Flash并解壓到火狐補丁目錄
wget http://fpdownload.macromedia.com/get/flashplayer/pdc/11.2.202.251/install_flash_player_11_linux_i386.tar.gz
tar zxvf install_flash_player_11_linux_i386.tar.gz
mkdir -p ~/.mozilla/plugins/
cp libflashplayer.so ~/.mozilla/plugins/
5 啟動vncserver并設定密碼
vncserver
6 添加啟動配置
vi ~/.vnc/xstartup
按a編輯,并將以下文字添加到最尾端
startjwm &
Ctrl+C退出編輯,并輸入:wq保存退出
7 打開VNCViewer,輸入你的IP:1并輸入密碼登陸
8 在VNC里的命令行輸入./firefox/firefox啟動火狐
9 在網址欄輸入about:config,然后進入修改firefox配置頁面
10 搜索dom.ipc.plugin字段,第一項改為False
11 安裝Vagex擴展
12 開始你的Vagex掛機網賺之旅
又找到2方案
http://code.google.com/p/vagex-debian/
http://code.google.com/p/cnvagex/