<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Some reminiscences, some memories &#187; 安装</title>
	<atom:link href="http://www.mikespook.com/index.php/tag/%e5%ae%89%e8%a3%85/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mikespook.com</link>
	<description>Just another boring day</description>
	<lastBuildDate>Wed, 08 Feb 2012 09:28:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>在 Ubuntu 9.10 下安装和简单配置 trac 0.12dev</title>
		<link>http://www.mikespook.com/2010/03/%e5%9c%a8-ubuntu-9-10-%e4%b8%8b%e5%ae%89%e8%a3%85%e5%92%8c%e7%ae%80%e5%8d%95%e9%85%8d%e7%bd%ae-trac-0-12dev/</link>
		<comments>http://www.mikespook.com/2010/03/%e5%9c%a8-ubuntu-9-10-%e4%b8%8b%e5%ae%89%e8%a3%85%e5%92%8c%e7%ae%80%e5%8d%95%e9%85%8d%e7%bd%ae-trac-0-12dev/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 02:26:41 +0000</pubDate>
		<dc:creator>mikespook</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[trac]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[安装]]></category>

		<guid isPermaLink="false">http://www.mikespook.com/?p=508</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
昨日（2010-03-14）在金山参加了”CPyUG会课总第38期~暨珠三角技术沙龙第6次“。会中廖杰大仙用平和的语气，激动人心的介绍了 trac 若干功能、以及插件的开发和金山已经在使用的或者准备使用的插件。回来手痒，随尝试安装 0.12dev。

关于 Windows 下的安装，请看赖神的《在 windows 下安装和简单配置 trac 0.12》。

Ubuntu 下没 Windows 下麻烦，不过如果完全按照 Trac 官方的文档，还是会略有折腾，特别记录于此，以备后用。

<span class="readmore"><a href="http://www.mikespook.com/2010/03/%e5%9c%a8-ubuntu-9-10-%e4%b8%8b%e5%ae%89%e8%a3%85%e5%92%8c%e7%ae%80%e5%8d%95%e9%85%8d%e7%bd%ae-trac-0-12dev/" title="在 Ubuntu 9.10 下安装和简单配置 trac 0.12dev">阅读全文——共1470字</a></span>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
<p>昨日（2010-03-14）在金山参加了”<a href="http://wiki.woodpecker.org.cn/moin/ZPyUG/2010-03-14" target="_blank">CPyUG会课总第38期~暨珠三角技术沙龙第6次</a>“。会中廖杰大仙用平和的语气，激动人心的介绍了 trac 若干功能、以及插件的开发和金山已经在使用的或者准备使用的插件。回来手痒，随尝试安装 0.12dev。</p>
<p>关于 Windows 下的安装，请看赖神的《<a href="http://blog.csdn.net/lanphaday/archive/2010/03/12/5374066.aspx" target="_blank">在 windows 下安装和简单配置 trac 0.12</a>》。</p>
<p>Ubuntu 下没 Windows 下麻烦，不过如果完全按照 Trac 官方的文档，还是会略有折腾，特别记录于此，以备后用。<span id="more-508"></span></p>
<pre lang="bash" line="1">
# 安装 ubuntu 提供的库，能由 apt 管理的包，还是交由 apt 管理
sudo apt-get install subversion
sudo apt-get install python-setuptools
sudo apt-get install sqlite3
sudo apt-get install python-pysqlite2
sudo apt-get install python-pygments
sudo apt-get install python-docutils
</pre>
<pre lang="bash" line="1">
# 下面的包，不是 ubuntu 没有提供 apt 源，就是源里的版本过旧。所以使用 easy_install 安装最新稳定版。
sudo easy_install pytz
sudo easy_install babel
# Genshi 甚至 stable 版本都不行，所以使用 dev，也就是 svn 中的版本。不过安装好后需要手工做一下处理。
sudo easy_install -U "Genshi==dev"
</pre>
<pre lang="bash" line="1">
# 进入 egg 存放目录
cd /usr/local/lib/python2.6/dist-packages/
# 修改刚才通过 easy_install 安装的 Genshi 的 egg 版本，也许是我哪里没搞合适，用 easy_install 安装 svn 的版本，版本号默认总是 0。
# 本来，版本只要大于 1072 即可，不过为了避免弄混，所以还是用版本库中的真实版本号为好。我安装的时候，genshi 的版本号是 1096。
mv Genshi-0.6dev_r0-py2.6.egg Genshi-0.6dev_r1096-py2.6.egg
# 同时需要修改 easy-install.pth 中的 genshi 的 egg 文件名
sudo vim easy-install.pth
</pre>
<p>在 easy-install.pth 中找到 ./Genshi-0.6dev_r0-py2.6.egg，将这个文件名修改为对应的正确的版本号的文件名。</p>
<pre lang="bash" line="1">
# 然后安装 Trac 的 svn 主线版本。当前，也就是现在的里程碑 0.12dev
sudo easy_install http://svn.edgewall.org/repos/trac/trunk
</pre>
<p>至此，trac 0.12dev 版本安装完毕。<br />
0.12dev 跟之前的版本有些变化的是，在用 trac-admin 创建 trac 环境的时候，不会再询问代码仓库的路径。也就是说，可以在 trac 中完全屏蔽代码管理的功能。</p>
<p>详细的内容可以看 <a href="http://trac.edgewall.org/wiki/0.12/TracRepositoryAdmin" target="_blank">http://trac.edgewall.org/wiki/0.12/TracRepositoryAdmin</a></p>
<p>另外，必装插件 <a href="http://trac-hacks.org/wiki/AccountManagerPlugin" target="_blank">http://trac-hacks.org/wiki/AccountManagerPlugin</a>。</p>
<p>好吧，如同往日一样，我总是最后才爆点猛料出来：Ubuntu 下的打包好的安装文件——舒放任务通道 <a href="http://py.kingsoft.net/ktrac/wiki/KtracInstall" target="_blank">http://py.kingsoft.net/ktrac/wiki/KtracInstall</a>。</p>
<p>特别感谢 KingSoft、感谢Z.Q.大妈、感谢廖杰……oh，md，我错了，先要感谢祖国-_-!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikespook.com/2010/03/%e5%9c%a8-ubuntu-9-10-%e4%b8%8b%e5%ae%89%e8%a3%85%e5%92%8c%e7%ae%80%e5%8d%95%e9%85%8d%e7%bd%ae-trac-0-12dev/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>在 Ubuntu 9.10 Server 上安装 Nginx 0.8.34</title>
		<link>http://www.mikespook.com/2010/03/%e5%9c%a8-ubuntu-9-10-server-%e4%b8%8a%e5%ae%89%e8%a3%85-nginx-0-8-34/</link>
		<comments>http://www.mikespook.com/2010/03/%e5%9c%a8-ubuntu-9-10-server-%e4%b8%8a%e5%ae%89%e8%a3%85-nginx-0-8-34/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 07:16:55 +0000</pubDate>
		<dc:creator>mikespook</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[安装]]></category>
		<category><![CDATA[编译]]></category>

		<guid isPermaLink="false">http://www.mikespook.com/?p=483</guid>
		<description><![CDATA[<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
Nginx 在 3 月 3 日放出了 0.8.34 这个开发版。张宴也随即更新了《Nginx 0.8.x + PHP 5.2.13（FastCGI）搭建胜过Apache十倍的Web服务器》到第六版。不过，他写的记录是针对 CentOS、Redhat 等 rpm 包管理的服务器。由于习惯了 debian 系列的服务器，特别是用惯了 ubuntu 服务器，在这里特别做一下 Ubuntu 9.10 下的安装笔记。其他基于 deb 包管理的发行版也类似。

首先，为了编译 Nginx，应在新装好的 Ubuntu server 环境下安装如下软件包：

<span class="readmore"><a href="http://www.mikespook.com/2010/03/%e5%9c%a8-ubuntu-9-10-server-%e4%b8%8a%e5%ae%89%e8%a3%85-nginx-0-8-34/" title="在 Ubuntu 9.10 Server 上安装 Nginx 0.8.34">阅读全文——共3398字</a></span>]]></description>
			<content:encoded><![CDATA[<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
<p>Nginx 在 3 月 3 日放出了 0.8.34 这个开发版。张宴也随即更新了《<a href="http://blog.s135.com/nginx_php_v6/">Nginx 0.8.x + PHP 5.2.13（FastCGI）搭建胜过Apache十倍的Web服务器</a>》到第六版。不过，他写的记录是针对 CentOS、Redhat 等 rpm 包管理的服务器。由于习惯了 debian 系列的服务器，特别是用惯了 ubuntu 服务器，在这里特别做一下 Ubuntu 9.10 下的安装笔记。其他基于 deb 包管理的发行版也类似。<span id="more-483"></span></p>
<p>首先，为了编译 Nginx，应在新装好的 Ubuntu server 环境下安装如下软件包：</p>
<pre lang="bash">sudo apt-get install build-essential libpcre3-dev libssl-dev libxslt-dev libgd2-xpm-dev libgeoip-dev zlib1g-dev</pre>
<p>然后下载 0.8.34 版本的 Nginx：</p>
<pre lang="bash">wget http://www.nginx.org/download/nginx-0.8.34.tar.gz</pre>
<p>解压：</p>
<pre lang="bash">tar xvzf nginx-0.8.34.tar.gz</pre>
<p>下载 upstream fair 模块。upstream fair 是比内建的负载均衡更加智能的负载均衡模块。它采用的不是内建负载均衡使用的轮换的均衡算法，而是可以根据页面大小、加载时间长短智能的进行负载均衡。</p>
<pre lang="bash">wget http://github.com/gnosek/nginx-upstream-fair/tarball/master</pre>
<p>解压：</p>
<pre lang="bash">tar xvzf gnosek-nginx-upstream-fair-2131c73.tar.gz</pre>
<p>然后进入 nginx 源码目录执行 configure 配置编译选项。下面是我所使用的配置：</p>
<pre lang="bash">./configure --conf-path=/etc/nginx/nginx.conf \--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--with-debug \
--with-http_stub_status_module \
--with-http_flv_module \
--with-http_ssl_module \
--with-http_dav_module \
--with-http_gzip_static_module \
--with-mail \
--with-mail_ssl_module \
--with-ipv6 \
--with-http_realip_module \
--with-http_geoip_module \
--with-http_xslt_module \
--with-http_image_filter_module \
--with-sha1=/usr/include/openssl \
--with-md5=/usr/include/openssl \
--add-module=/home/mikespook/gnosek-nginx-upstream-fair-2131c73</pre>
<p>这个配置来自于 Jeff Waugh 的 PPA 中的 nginx 0.8.34 编译选项。配置、lock、pid 等文件的位置都是按照 ubuntu 系统惯例设置的。需要注意的是 &#8211;add-module 指向的是 upstream fair 的解压缩目录的绝对路径。这样就可以将 upstream fair 编译进 nginx。</p>
<p>然后编译并安装：</p>
<pre lang="bash">make &amp;&amp; make install</pre>
<p>nginx 就安装成功了。目录 /var/lib/nginx 需要手工建立，否则启动 nginx 会报错：</p>
<pre lang="bash">[emerg]: mkdir() "/var/lib/nginx/body" failed (2: No such file or directory)</pre>
<p>建立shell 脚本 /etc/init.d/nginx（<a href="http://www.mikespook.com/wp-content/uploads/2010/03/nginx.tar.gz">nginx</a>）：</p>
<pre lang="bash">#! /bin/sh

### BEGIN INIT INFO
# Provides:          nginx
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the nginx web server
# Description:       starts nginx using start-stop-daemon
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/nginx/sbin/nginx
NAME=nginx
DESC=nginx

test -x $DAEMON || exit 0

# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
        . /etc/default/nginx
fi

set -e

case "$1" in
  start)
        echo -n "Starting $DESC: "
        start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
                --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME."
        ;;
  stop)
        echo -n "Stopping $DESC: "
        start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
                --exec $DAEMON
        echo "$NAME."
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC: "
        start-stop-daemon --stop --quiet --pidfile \
                /var/run/$NAME.pid --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet --pidfile \
                /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
        echo "$NAME."
        ;;
  reload)
      echo -n "Reloading $DESC configuration: "
      start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \
          --exec $DAEMON
      echo "$NAME."
      ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" &gt;&amp;2
        exit 1
        ;;
esac

exit 0</pre>
<p>并执行命令：</p>
<pre lang="bash">sudo update-rc.d -f nginx defaults</pre>
<p>更新 rc 后，即可使用：</p>
<pre lang="bash">sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx restart</pre>
<p>控制 nginx 启动。<br />
其他配置不再累述，张宴的 blog 里写得非常清晰。只补充一下 upstream fair 的使用，只要在 nginx 配置文件的 upstream 段加入 fair 开关即可：</p>
<pre lang="bash">upstream backend {
    server server1;
    server server2;
    fair;
}</pre>
<p>当然，ubuntu 还可以用上面提到的 Jeff 的 ppa 源进行安装：</p>
<pre lang="bash">echo "deb http://ppa.launchpad.net/jdub/devel/ubuntu hardy main" &gt;&gt; /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E9EEF4A1
apt-get update
apt-get install nginx</pre>
<p>简单快捷。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikespook.com/2010/03/%e5%9c%a8-ubuntu-9-10-server-%e4%b8%8a%e5%ae%89%e8%a3%85-nginx-0-8-34/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

