安装环境:ubuntu10.04LTS,GCC 4.4.3
一安装sqlite:
下载地址:http://www.sqlite.org/download.html (目前版本为3.7.7.1)
根据官网的介绍,sqlite-amalgamation-xxx.zip是sqlite的源代码,有兴趣研究的兄弟可以自己看看,我们下载sqlite-autoconf-xxx.tar.gz进行源代码的编译安装。
首先解压缩源代码包: tar zxvf sqlite-autoconf-xxx.tar.gz -C /xxx/xxx/xxx 这里是你自己指定的解压路径,如果没有指定就是当前存放源码包的路径。
然后安装的过程还是老三样:
第一步:./configure 这里采用的是默认设置,有具体需要的兄弟要自己查看具体的配置信息 ./configure --help, 如设置默认的安装路径 ./configure --prefix=/xx/xx/xx
第二步:make
第三步:make install
在执行完上面的操作后,打开终端输入 sqlite,如果出现下面的提示信息,表示sqlite正确安装了。
SQLite version 3.7.7.1 2011-06-28 17:39:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
二安装lighttpd:
下载地址http://www.lighttpd.net/(目前版本为1.4.29)
同样解压缩源文件,然后进行安装第一步的configure,需要注意的是我所使用的ubuntu系统缺少了libpcre3-dev,zlib1g-dev,libbz2-dev这三个库,兄弟们在配置的过程如果发现同样的问题一定要记住打上这三个包 sudo apt-get install libpcre3-dev zlib1g-dev libbz2-dev,如果配置成功了就可以make && make install
我采用的是默认的配置lighttpd安装在/usr/local/sbin路径下,后面的相关的路径配置以此为准,兄弟们参照配置时要注意这点
首先创建配置文件夹:
mkdir /etc/lighttpd /etc/sysconfig/
然后拷贝相关的配置文件:
cp -p doc/initscripts/sysconfig.lighttpd /etc/sysconfig/lighttpd
这里说明下1.4.28前后的lighttpd的配置文件结构不同,兄弟注意查看自己的版本调用相关的命令。
# < 1.4.27
install -Dp ./doc/lighttpd.conf /etc/lighttpd/lighttpd.conf
# > 1.4.28
cp -R doc/config/conf.d/ doc/config/*.conf doc/config/vhosts.d/ /etc/lighttpd/
最后最重要的位于/etc/lighttpd下的lighttpd此时是安装源文件提供的模板,我们要仿照模板的格式自己构建一个,下面是我自己的:
/××××××××××××××××××××××lighttpd.conf****************************************/
server.document-root = "/root/www/"
server.port = 2010
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png"
)
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )
/××××××××××××××××××××××lighttpd.conf****************************************/
最后在确认自己的配置文件无误后测试一下:
lighttpd -t -f /etc/lighttpd/lighttpd.conf
如果测试无误的话,启动lighttpd服务:
lighttpd -D -f lighttpd.conf
如果lighttpd成功启动,ps -A | grep lighttpd 会有相关的信息提示
同时你可以在你设定的server.document-root = "/root/www/" 路径下写一个html文件测试一下,拿我的举例127.0.0.1:2010/text.html ,如果浏览器显示正确,表示lighttpd的确成功启动。
三安装php:
下载地址http://www.php.net/downloads.php(目前版本为5.3.6)
安装过程同上面两个软件过程,我贴出自己的configure单:
./configure \
--prefix=/usr/local/php5 \
--enable-fastcgi \
--enable-force-cgi-redirect \
--enable-soap \
--enable-sockets \
--enable-sqlite-utf8 \
要使用fastcgi,--enable-fastcgi --enable-force-cgi-redirect 必不可少
在configure过程中提示xml2的config路径找不到了,后来检查发现没有安装这个库 sudo apt-get install libxml2-dev 就OK了
然后make&&make install
在安装完毕后,需要lighttpd添加对php的支持,需要修改之前的/etc/lighttpd/lighttpd.conf文件
/××××××××××××××××××××××lighttpd.conf****************************************/
server.document-root = "/root/www/"
server.port = 2010
mimetype.assign = (
".html" => "text/html",
".txt" => "text/plain",
".jpg" => "image/jpeg",
".png" => "image/png"
)
static-file.exclude-extensions = ( ".fcgi", ".php", ".rb", "~", ".inc" )
index-file.names = ( "index.html" )
server.modules += ("mod_fastcgi")
fastcgi.server =( ".php" =>
((
"socket" => "/tmp/php.socket",
"bin-path" => "/usr/local/php5/bin/php-cgi",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "16",
"PHP_FCGI_MAX_REQUESTS" => "10000"
),
"min-procs" => 1,
"max-procs" => 1,
"idle-timeout" => 20
))
)
/××××××××××××××××××××××lighttpd.conf****************************************/
同上述的你可以在你设定的server.document-root = "/root/www/" 路径下写一个phpl文件测试一下,拿我的举例127.0.0.1:2010/text.php ,如果浏览器显示正确,表示php正常工作。
/***********text.php*********/
<?
phpinfo();
?>
/***********text.php*********/
以下是参考的网页,谢谢诸位文档的帮助:
http://www.cnblogs.com/czh-liyu/archive/2010/03/23/1692587.html
http://www.pc51.net/server/web/apache/2007-02-25/7081.html
http://www.blogjava.net/chenlb/archive/2008/05/01/197658.html
http://hi.baidu.com/naruto6006/blog/item/df34f95d0159624efbf2c0ea.html
http://info.codepub.com/2008/08/info-21592.html
http://blog.newchao.com/post/752/
http://www.php.net/manual/zh/install.unix.lighttpd-14.php
http://www.legendrefamily.org/blog/2009/02/installing-lighttpd-php-and-sqlite-on-a-usb-drive/