照著這裡做的話不會遇到太大問題。
首先看哪個好心人有做對應版本的 package ,這裡找到 jtaylor。
然後就裝吧:
apt-get install python-software-properties add-apt-repository ppa:jtaylor/jtaylor apt-get update apt-get install valgrind
打完收工。
cd /usr/ports/www/p5-FCGI && make install clean cd /usr/ports/www/p5-FCGI-ProcManager && make install clean cd /usr/ports/www/spawn-fcgi && make install clean或是用 pkg :
pkg install p5-FCGI p5-FCGI-ProcManager spawn-fcgi2) 編輯 smokeping 的 fastcgi wrapper,vim /usr/local/smokeping/htdocs/smokeping.fcgi 檔案如下:
# -*-perl-*-
use FCGI;
use FCGI::ProcManager;
use lib qw(/usr/local/smokeping/lib);
use Smokeping 2.004002 ;
use CGI::Fast;
my $cfg = "/usr/local/etc/smokeping/config";
my $proc_manager = FCGI::ProcManager->new( {n_processes => 5} );
my $request = FCGI::Request();
$proc_manager->pm_manage();
while (my $q = new CGI::Fast) {
Smokeping::cgi($cfg,$q);
}
while($request->Accept() >= 0) {
my $q = new CGI::Fast;
$proc_manager->pm_pre_dispatch();
Smokeping::cgi($cfg,$q);
$proc_manager->pm_post_dispatch();
exit(0);
}
#!/bin/sh /usr/local/bin/spawn-fcgi -a 127.0.0.1 -p 你要的PORT\ -P /var/run/smokeping-fastcgi.pid -u www \ -f /usr/local/smokeping/htdocs/smokeping.fcgi
location /smokeping/smokeping.cgi {
error_log /PATH_TO/smoke-error.log info;
access_log /PATH_TO/smoke-access.log combined;
fastcgi_pass 127.0.0.1:你要的PORT;
fastcgi_param SCRIPT_FILENAME /usr/local/smokeping/htdocs$fastcgi_script_name;
include fastcgi_params;
}
location /smokeping/ {
error_log /PATH_TO/smoke-error.log info;
access_log /PATH_TO/smoke-access.log combined;
alias /usr/local/smokeping/htdocs/;
}
然後記得跑
/usr/local/smokeping/htdocs/spawn-smoke之後再把 nginx 跑起來就沒問題了。
spawn_fcgi_enable="YES" spawn_fcgi_app="/usr/local/smokeping/htdocs/smokeping.fcgi" spawn_fcgi_bindaddr="127.0.0.1" spawn_fcgi_bindport="PORT"Update: slave 設定
smokeping_enable="YES" smokeping_flags="--master-url=http://MASTER.cgi --slave-name=SLAVENAME --cache-dir=/var/run/smokeping --shared-secret=SECRET"
# Define these smokeping_* variables in one of these files: # /etc/rc.conf # /etc/rc.conf.local # /etc/rc.conf.d/smokeping # # DO NOT CHANGE THESE DEFAULT VALUES HERE # # smokeping_flags="" smokeping_enable=${smokeping_enable-"NO"} smokeping_pidfile=${smokeping_pidfile-"/usr/local/var/smokeping/smokeping.pid"} smokeping_fcgi_pidfile=${smokeping_fcgi_pidfile-"/var/run/smokeping-fastcgi.pid"} smokeping_logfile=${smokeping_logfile-"/var/log/smokeping.log"} smokeping_user=${smokeping_user-"smokeping"} smokeping_group=${smokeping_group-"smokeping"} . /etc/rc.subr name="smokeping" rcvar="smokeping_enable" load_rc_config $name command="/usr/local/bin/smokeping" command_args="--logfile=${smokeping_logfile}" pidfile="${smokeping_pidfile}" fcgi_pidfile="${smokeping_fcgi_pidfile}" extra_commands="reload" reload_cmd="smokeping_reloadcmd" start_precmd="smokeping_startprecmd" stop_cmd="smokeping_stopcmd" status_cmd="smokeping_statuscmd" spawn_smokeping_fcgi="/usr/local/smokeping/htdocs/spawn-smoke" smokeping_reloadcmd() { $command --reload } smokeping_statuscmd() { if [ ! -e $pidfile ]; then echo "pidfile does not exist. $name is not running?"; exit 1; fi if pgrep -F $pidfile >/dev/null; then echo "$name is running."; else echo "$name is not running."; exit 1; fi } smokeping_stopcmd() { if pgrep -F $pidfile >/dev/null; then kill $sig_stop `cat $pidfile`; wait_for_pids `cat $pidfile`; kill $sig_stop `cat $fcgi_pidfile`; wait_for_pids `cat $fcgi_pidfile`; rm -rf $fcgi_pidfile; else echo "$name is not running."; exit 1; fi } smokeping_startprecmd() { if [ ! -e $smokeping_logfile ]; then install -o smokeping -g smokeping /dev/null $smokeping_logfile || echo "ERROR: Could not initialize logfile at $smokeping_logfile."; fi if [ ! -e $fcgi_pidfile ]; then $spawn_smokeping_fcgi; echo "starting smokeping fastcgi"; fi }
ufw limit proto tcp from any to 1.2.3.4 port 1234,2234
# Don't delete these required lines, otherwise there will be errors *filter :ufw-before-input - [0:0] :ufw-before-output - [0:0] :ufw-before-forward - [0:0] :ufw-not-local - [0:0] # End required lines之後加上
# Limit IP connection(s) # Limit to 10 concurrent connections on port 80 per IP #-A ufw-before-input -p tcp --syn --dport 80 -m connlimit --connlimit-above 300 -j DROP # Limit to 20 connections on port 80 per 2 seconds per IP #-A ufw-before-input -p tcp --dport 80 -i eth1 -m state --state NEW -m recent --set #-A ufw-before-input -p tcp --dport 80 -i eth1 -m state --state NEW -m recent --update --seconds 1 --hitcount 20 -j DROP更機車的設定可以參考這裡
1.) 首先,你會需要 jdk。 2.) 然後安裝 Eclipse CDT。 3.) 在 Eclipse 裡面安裝 ADT(選 Help->Install New Software, Work with 填入 https://dl-ssl.google.com/android/eclipse/ 然後選 Developer Tools 跟 NDK Plugin)。 4.) 重新啟動 Eclipse 後會要你安裝 android sdk。 5.) 安裝 NDK。 6.) 下載需要的 cocos2d-x。 7.) 安裝 TortoiseSVN。然後來測試是否能夠編譯 C++ Project:
1.) 開啟 Eclipse,選 File->New->Project ,選 Android Project from Existing Code
2.) 選一個 Cocos2ds-X 的 Sample 匯入成 Project (這裡是 TestCpp)
3.) 會看到 Cocos2dxActivity cannot be resolved to a type 有三個錯誤,暫時解法是把 Cocos2d-X 目錄
中的
cocos2dx/platform/android/java 也 import 成一個 project。
4.) 在 TestCpp Project 上面按右鍵,選 Properties,找裡面的 Builders。
5.) 按 New 新增一個 Builder,然後路徑選 NDK 裡面的 ndk-build.cmd。
6.) 把 tab 切到 environment,新增 NDK_MODULE_PATH 變數,後面給兩個值
C:\android\cocos2d-2.0-x-2.0.4;C:\android\cocos2d-2.0-x-2.0.4\cocos2dx\platform\third_party\android\prebuilt
中間用分號隔開
7.) 建立完成後把 NDKBuilder 推到最上面
8.) Project -> Build Project 就會開始編譯。
E:\OneX\Android\Tools1.26>fastboot getvar all (bootloader) version: 0.5a (bootloader) version-bootloader: 1.12.0000 (bootloader) version-baseband: 1.1204.104.14 (bootloader) version-cpld: None (bootloader) version-microp: None (bootloader) version-main: 2.17.709.2 (bootloader) serialno: HT258W1A0919 (bootloader) imei: 353043057600408 (bootloader) product: endeavoru (bootloader) platform: HBOOT-T30S (bootloader) modelid: PJ4610000 (bootloader) cidnum: HTC__621 (bootloader) battery-status: good (bootloader) battery-voltage: 3848mV (bootloader) devpower: 59 (bootloader) partition-layout: None (bootloader) security: on (bootloader) build-mode: SHIP (bootloader) boot-mode: FASTBOOT (bootloader) commitno-bootloader: None (bootloader) hbootpreupdate: 2 (bootloader) gencheckpt: 0 all: Done! finished. total time: 0.827s
# 把 /etc/fstab 加上 noatime 跟 data=writeback tune2fs -o journal_data_writeback /dev/sdaX UUID=9ee7afff-654d-123c-b936-fe96354bec0c / ext4 errors=remount-ro,noatime,data=writeback 0 1 # /etc/sysctl.conf 加上延長 writeback 時間 vm.dirty_writeback_centisecs = 360000
<link href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"></script>
<script type="text/javascript" language="javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/lang-css.js"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded',function() {
prettyPrint();
});
</script>
然後進到 自訂->進階-> Add CSS,加入這段:pre.code {
display: block; /* fixes a strange ie margin bug */
font-family: Courier New;
font-size: 10pt;
overflow:auto;
background: #f0f0f0 url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAASwCAYAAAAt7rCDAAAABHNCSVQICAgIfAhkiAAAAQJJREFUeJzt0kEKhDAMBdA4zFmbM+W0upqFOhXrDILwsimFR5pfMrXW5jhZr7PwRlxVX8//jNHrGhExjXzdu9c5IiIz+7iqVmB7Hwp4OMa2nhhwN/PRGEMBh3Zjt6KfpzPztxW9MSAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzAMwzB8HS+J9kUTvzEDMwAAAABJRU5ErkJggg==) left top repeat-y;
border: 1px solid #ccc;
padding: 10px 10px 10px 21px;
max-height:200px;
line-height: 1.2em;
}
之後只要用 <pre class="code prettyprint">要顯示的 code</pre> 就可以顯示了。apt-get install openssh-server apt-get install vim apt-get install screen
vim /etc/network/interfaces
iface lo inet loopback auto lo auto eth1 iface eth1 inet dhcp 改成 iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1
deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse但不幸遇到 tw.archive.ubuntu.com 掛掉的問題的話,就到 官方mirror列表找自己的地區然後是Up to date的,這裡我是選國網自由軟體實驗室的mirror,然後把 /etc/apt/source.list 改成
# # deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ dists/precise/main/binary-i386/ # deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ dists/precise/restricted/binary-i386/ # deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ precise main restricted #deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ dists/precise/main/binary-i386/ #deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ dists/precise/restricted/binary-i386/ #deb cdrom:[Ubuntu-Server 12.04.1 LTS _Precise Pangolin_ - Release amd64 (20120817.3)]/ precise main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://free.nchc.org.tw/ubuntu/ precise main restricted deb-src http://free.nchc.org.tw/ubuntu/ precise main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://free.nchc.org.tw/ubuntu/ precise-updates main restricted deb-src http://free.nchc.org.tw/ubuntu/ precise-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://free.nchc.org.tw/ubuntu/ precise universe deb-src http://free.nchc.org.tw/ubuntu/ precise universe deb http://free.nchc.org.tw/ubuntu/ precise-updates universe deb-src http://free.nchc.org.tw/ubuntu/ precise-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://free.nchc.org.tw/ubuntu/ precise multiverse deb-src http://free.nchc.org.tw/ubuntu/ precise multiverse deb http://free.nchc.org.tw/ubuntu/ precise-updates multiverse deb-src http://free.nchc.org.tw/ubuntu/ precise-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://free.nchc.org.tw/ubuntu/ precise-backports main restricted universe multiverse deb-src http://free.nchc.org.tw/ubuntu/ precise-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu precise-security main restricted deb-src http://security.ubuntu.com/ubuntu precise-security main restricted deb http://security.ubuntu.com/ubuntu precise-security universe deb-src http://security.ubuntu.com/ubuntu precise-security universe deb http://security.ubuntu.com/ubuntu precise-security multiverse deb-src http://security.ubuntu.com/ubuntu precise-security multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu precise partner # deb-src http://archive.canonical.com/ubuntu precise partner ## Uncomment the following two lines to add software from Ubuntu's ## 'extras' repository. ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. # deb http://extras.ubuntu.com/ubuntu precise main # deb-src http://extras.ubuntu.com/ubuntu precise main如果覺得太麻煩,網路上有自動產生器可以用。
apt-get install lighttpd
apt-get install mysql-server
apt-get install php5-fpm
apt-get install phpmyadmin
vim /etc/php5/fpm/pool.d/www.conf * 找到以下將 listen 換成 php5-fpm.sock * ; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on ; a specific port; ; 'port' - to listen on a TCP socket to all addresses on a ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. ;listen = 127.0.0.1:9000 listen = /tmp/php5-fpm.sock
vim /etc/lighttpd/conf-enabled/15-fastcgi-php.conf
* 將 lighttpd 的 fastcgi module 改成跑 fpm sock *
fastcgi.server += ( ".php" =>
((
"socket" => "/tmp/php5-fpm.sock",
"broken-scriptfilename" => "enable"
))
)
Failed opening required 'MDB2.php': 解法 apt-get install php-mdb2
Failed opening required 'DB/DataObject.php': 解法 pear install DB_DataObject pear install MDB2_Driver_mysqli
[plugin] modifier 'geoip_country_code_by_name' is not implemented: 解法 apt-get install php5-geoip
apt-get install gcc
apt-get install g++
apt-get install gdb
apt-get install make
apt-get install subversion
apt-get install protobuf-compiler libprotobuf-dev
apt-get install libboost-all-dev
apt-get install libpoco-dev
apt-get install libmysqlclient-dev
apt-get install cmake
apt-get install samba pdbedit -a USERNAME
vim /etc/security/limits.conf * soft core -1 * soft data 33554432 * soft fsize -1 * soft memlock -1 * soft nofile 40960 * soft rss -1 * soft stack 524288 * soft cpu -1 * soft as -1 * soft locks -1 root hard core 100000
echo "%e.core.%s.%t"> /proc/sys/kernel/core_pattern 永久寫入 vim /etc/sysctl.conf kernel.core_pattern=%e.core.%s.%t
apt-get install pv
mysqldump -u username -p --add-drop-table --create-options --routines --default-character-set=utf8 DATABASE_NAME | pv | bzip2 -cq9 | pv > BACKUPFILENAME.sql.bz2
pv BACKUPFILENAME.sql.bz2 | bunzip2 > BACKUPFILENAME.sql pv BACKUPFILENAME.sql | mysql -u username -p DATABASE_NAME
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n
或是
sudo sed -ne '/^Package: (.*)/{s//1/;h;};/^Installed-Size: (.*)/{s//1/;G;s/n/ /;p;}' /var/lib/dpkg/status | sort -rn
/sbin/mdmfs -M -S -o async -s 512m md0 /tmp/portsobj
/bin/chmod 777 /tmp/portsobj
WRKDIRPREFIX=/tmp/portsobj
#!/bin/sh
case "$1" in
create)
/sbin/mdmfs -M -S -o async -s 512m md0 /tmp/portsobj
/bin/chmod 777 /tmp/portsobj
echo "512M ramdisk created on md0 and mounted on /tmp/portsobj"
exit 0
;;
destory)
/sbin/umount /tmp/portsobj
/sbin/mdconfig -d -u 0
echo "ramdisk umounted from /tmp/portsobj and destory from md0"
;;
*)
echo "Usage: `basename $0` {create|destory}" >&2
exit 64
;;
esac
ext_if_fttb="tun0"
nat on $ext_if_fttb inet from $internal_net to {!$internal_net,!$sparq_net} -> ($ext_if_fttb)
gw_if_fttb="(tun0:peer)"
* CNAME blog
<VirtualHost *:80>
ServerAdmin admin@domain.tld
DocumentRoot /path/to/mu-wordpress
ServerName blog.domain.tld
ServerAlias *.domain.tld
ErrorLog /path/to/logs/httpd-error.log
CustomLog /path/to/logs/httpd-access.log combined
<Directory />
AllowOverride None
Order Deny,Allow
Deny from all
</Directory>
<Directory “/path/to/mu-wordpress”>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
# RedirectMatch 301 (*) http://xxx.domain.tld$1
LogLevel debug
</VirtualHost>
Index: app/includes/info.php
===================================================================
— app/includes/info.php (revision 192)
+++ app/includes/info.php (working copy)
@@ -115,16 +115,17 @@
$posts_per = 1;
}
- if (strpos($wp_version, ‘2.1′) === false) {
+ if (strpos($wp_version, ‘2.1′) === false && strpos($wp_version, ‘mu’) ===false) {
$search = ‘/FROM\s+?(.*)\s+?GROUP BY/siU’; // Wordpress 2.0.x
} else {
$search = ‘/FROM\s+?(.*)\s+?ORDER BY/siU’; // Wordpress 2.1
}
May 9 04:19:11 soul named[960]: could not listen on UDP socket: permission denied
May 9 04:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored
May 9 05:19:11 soul named[960]: could not listen on UDP socket: permission denied
May 9 05:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored
May 9 06:19:11 soul named[960]: could not listen on UDP socket: permission denied
May 9 06:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored
May 9 07:19:11 soul named[960]: could not listen on UDP socket: permission denied
May 9 07:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored
May 9 08:19:11 soul named[960]: could not listen on UDP socket: permission denied
May 9 08:19:11 soul named[960]: creating IPv4 interface tun0 failed; interface ignored
May 9 09:19:11 soul named[960]: could not listen on UDP socket: permission denied
詢問了 google 大神之後發現大概是 這麼一回事 ,所以就乖乖的照著 mac_portacl(4) 去把 kernel configuration 的 options MAC 加進去,然後到 /boot/loader.conf 加入 mac_portacl_load=”YES” 接著照著 handbook 的 example 依樣畫葫蘆塞進 sysctl security.mac.portacl.rules=uid:53:udp:53,uid:53:tcp:53 然後重新啟動囉。