安裝和使用花生殼(linux) 一、安裝說明(以CentOS 5為例) 1、安裝必要的開發包 [root@localhost ~]# yum install gcc gcc-c++ autoconf automake 2、下載phddns-2.0.2.16556.tar.gz到某一個目錄 www.2cto.com [root@localhost ~]# wget http://download.oray.com/peanuthull/phddns-2.0.2.16556.tar.gz 3、解壓所有檔案 [root@localhost ~]# tar zxvf phddns-2.0.2.16556.tar.gz 4、進入目錄並編譯
[root@localhost ~]# cd phddns-2.0.2.16556[root@localhost phddns-2.0.2.16556]# aclocal[root@localhost phddns-2.0.2.16556]# autoconf[root@localhost phddns-2.0.2.16556]# automake[root@localhost phddns-2.0.2.16556]# ./configure[root@localhost phddns-2.0.2.16556]# make[root@localhost phddns-2.0.2.16556]# cd src[root@localhost src]# ls -l phddns-rwxr-xr-x 1 root root 80968 Aug 2 11:18 phddns 5、執行編譯好的程式並配置(預設使用/etc/phlinux.conf,如果不存在這個檔案則自動進入互動配置) [root@localhost src]# ./phddns輸入伺服器位址,如無特殊情況可使用預設值Enter server address(press ENTER use phlinux3.oray.net): www.2cto.com 輸入您的Oray帳號名稱Enter your Oray account: 對應的Oray帳號密碼Password: 選擇幫定的網卡,如無特殊,預設即可Network interface(s):eth0:192.168.141.18lo:127.0.0.1Choose one(default eth0): 選擇日誌儲存到哪個檔案Log to use(default /var/log/phddns.log): 儲存設定檔,選擇yes則直接儲存到/etc/phlinux.conf,輸入other可以指定檔案Save to configuration file (/etc/phlinux.conf)?(yes/no/other): 接下來程式將已互動模式開始運行192.168.141.18NIC bind successOnStatusChanged okConnectingOnStatusChanged okDomainListedOnDomainRegistered skyvense22.gicp.netOnStatusChanged okDomainsRegisteredUserType: 0看到上面這些就表示登入成功,這個時候可以按ctrl+c先退出程式 6、將phddns拷貝到你希望的位置[root@localhost src]# cp phddns /usr/bin/ 7、以後台模式啟動花生殼並檢查運行情況 www.2cto.com [root@localhost ~]# /usr/bin/phddns -c /etc/phlinux.conf -dphlinux started as daemon![root@localhost ~]# tail /var/log/phddns.log2011/08/02 11:28:58.256| ExecuteUpdate OK, BeginKeepAlive!2011/08/02 11:29:59.354| SendKeepAlive() 82082011/08/02 11:30:00.355| RecvKeepaliveResponse() Data comes, OPCODE:82722011/08/02 11:30:00.356| Keepalive response received, client ip: 116.231.123.962011/08/02 11:31:00.447| SendKeepAlive() 82082011/08/02 11:31:01.450| RecvKeepaliveResponse() Data comes, OPCODE:82722011/08/02 11:31:01.450| Keepalive response received, client ip: 116.231.123.96 8、退出花生殼 查看進程ID[root@localhost ~]# ps -A | grep phddns13731 ? 00:00:00 phlinux讓後台進程退出[root@localhost ~]# kill -9 13731 9、將花生殼加到系統啟動時運行[root@localhost ~]# vi /etc/rc.local在檔案的末尾加上一行:/usr/bin/phddns -c /etc/phlinux.conf -d 二、花生殼Linux版本命令列參數說明 [root@localhost ~]# /usr/bin/phlinux -hPeanuthull Linux-core 2.0 by oray.com, copyright 2011Peanuthull Linux-core Help--first-run-f, run for the first time用於初次開機時配置參數 www.2cto.com --interact-i, run as interactive modeprogram will request for necessary parameters.this mode will automatically enabled at first running,or your configuration file has been lost.啟動互動模式 --daemon-d, run as a daemonprogram will quit after put itself to background,and continue running even you logout,you can use kill -9 <PID> to terminate.後台模式 --config-c, run with configuration fileprogram will run with the file指定使用哪一個設定檔 --user-u, run as the userprogram will run as the user以指定使用者啟動後台進程 --help-h, print this screen.Please visit http://www.oray.com for detail. 三、常見問題 如何手動修改登陸的使用者名稱及密碼? 您可以直接編輯/etc/phlinux.conf檔案,對登陸使用者名稱及密碼進行修改。花生殼日誌儲存路徑/var/log/phddns.log www.2cto.com 為什麼花生殼無法登陸? 花生殼使用的通訊連接埠是TCP:6060和UDP:6060(方向:OUT),請確認防火牆沒有把這幾個通訊連接埠封掉。 如何查看花生殼當前運行狀態? 查看日誌:[root@localhost ~]# tail /var/log/phddns.log2011/08/02 11:28:58.256| ExecuteUpdate OK, BeginKeepAlive!2011/08/02 11:29:59.354| SendKeepAlive() 82082011/08/02 11:30:00.355| RecvKeepaliveResponse() Data comes, OPCODE:82722011/08/02 11:30:00.356| Keepalive response received, client ip: 116.231.123.962011/08/02 11:31:00.447| SendKeepAlive() 82082011/08/02 11:31:01.450| RecvKeepaliveResponse() Data comes, OPCODE:82722011/08/02 11:31:01.450| Keepalive response received, client ip: 116.231.123.96 如何在其他平台(非X86)編譯運行? 交叉編譯mips cpu版本方法:1、安裝交叉工具並配置環境........ www.2cto.com 2、配置參數./configure --host=i386-linux --target=mipsel-linux --build=mipsel-linux CXX=mipsel-linux-gcc CC=mipsel-linux-gcc LD=mipsel-linux-ld3、make4、最後靜態連結下mipsel-linux-gcc -g -O2 -o phlinux -s main.o phupdate.o PHGlobal.o PHSocket.o md5.o log.o generate.o coder.o blowfish.o bitstream.o base64.o ConvertUTF.o CCmdParser.o PhClient.o PhUpdater.o /opt/openwrt/mipsel-linux/lib/librt.a /opt/openwrt/mipsel-linux/lib/libstdc++.a //opt/openwrt/mipsel-linux/lib/libc.a5、壓縮下(好放到路由器的小空間)upx -o phlinux2 phlinux 本文來自於Oray網