记录我的一些生活写照、无聊的牢骚、内心世界的活动 注册 | 登陆

在DDWRT下成功安装discuz [lighttpd +mysql +php +discuz]

在DDWRT下成功安装discuz [lighttpd +mysql +php +discuz]

一.安装环境:
1. DDWRT v24 std
2. 建议内存大于32M,64M是推荐. 128M is better.
   (当然也不是说16M不要安装,只是不是很好,)
3. 记住要建立swap.(这个请参考其他帖,很多了)
4. optware  (在这里建议大家如果是使用ddwrt的最好用optware, oleg optware 在 openwrt 下开发的吧?)
                 (optware 和 oleg optware 环境之间转换请参考 10 楼)
                 (我试过oleg optware的软件 在ddwrt下有问题, 但是同样的软件,采用optware下面的在ddwrt就没有问题)
   (  ddwrt和oleg 软件对比
       http://ipkg.nslu2-linux.org/feeds/optware/ddwrt/cross/stable/
           http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/
   )
5. [lighttpd +mysql +php +discuz]是巨耗资源的东西,建议玩玩就算了.

二.所需软件:
1.lighttpd – 1.4.18-1 -   (为什么采用它? 只是因为我安装apache的时候总是提示有问题,后来找到了这个轻量级的服务器软件,很好的替代了apache. apache总是启动不起来, 可能与 路由器占用了 httpd 程序有关, 因为apache 也是使用改程序.)

2.mysql – 4.1.20-2        (这个不用说了,不用它用谁?)

3.php – 5.2.4-1 -          (要支持php么?不安装怎么行.)

4.php-fcgi – 5.2.4-1 -     (fcgi 意思是fastcgi,  FastCGI is a protocol between web application and web server. Because it offers much better performance than CGI, it is often used to deploy PHP web application on lightweight web servers that do not have a built-in mod_php. )

5.php-mysql - 5.2.4-1 -    (这个软件是连接php和mysql的,一开始我也没有安装,结果安装discuz论坛的时候,提示服务器不支持mysql数据库)

前面的软件都是通过 /opt/bin/ipkg install 方式安装。

(安装过程中若提示suggests installing *** … 的, 是建议安装的软件,也一并安装.)

6.discuz (请到http://www.discuz.com/论坛下载到你的电脑, 我下载了 6.0 的 简体中文 UTF-8 版本)

三.安装过程:  (安装过程中提示建议安装的软件和库等请自行安装,当然也是 /opt/bin/ipkg install 这样来装.)
1.先安装mysql的,因为它简单。(应该也可以安装其他先吧? 各人喜欢啦.)
#/opt/bin/ipkg install mysql

安装时的提示信息:
Installing mysql (4.1.20-2) to /opt/…
Downloading http://ipkg.nslu2-linux.org/feed … 4.1.20-2_mipsel.ipk
Configuring mysql
Installing all prepared tables
Fill help tables
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/bin/mysqladmin -u root password ‘new-password’
/opt/bin/mysqladmin -u root -h WRT54 password ‘new-password’
See the manual for more instructions.
You can start the MySQL daemon with:
You can test the MySQL daemon with the benchmarks in the ’sql-bench’
directory:                                                                                                                       
cd sql-bench ; perl run-all-tests
Please report any problems with the /opt/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
Starting MySQL.. SUCCESS!
Successfully terminated.

出现这个   ” Starting MySQL.. SUCCESS! “   ,表示数据库已经成功启动了

2.安装php和php-fcgi
# /opt/bin/ipkg install php php-fcgi

安装时的提示信息:
Installing php (5.2.4-1) to /opt/…
Downloading http://ipkg.nslu2-linux.org/feed … _5.2.4-1_mipsel.ipk
Installing php-fcgi (5.2.4-1) to /opt/…
Downloading http://ipkg.nslu2-linux.org/feed … _5.2.4-1_mipsel.ipk
Configuring php
Configuring php-fcgi
Successfully terminated.

3.安装libstdc++           (遗留了这个,现在不写上.)
#/opt/bin/ipkg install libstdc++

4.安装lighttpd
#/opt/bin/ipkg install lighttpd

安装时的提示信息:
Installing lighttpd (1.4.18-1) to /opt/…
Downloading http://ipkg.nslu2-linux.org/feeds/optware/ddwrt/cross/stable/
lighttpd_1.4.18-1_mipsel.ipk
package lighttpd suggests installing libmemcache
package lighttpd suggests installing lua
package lighttpd suggests installing memcached
package lighttpd suggests installing sqlite
Configuring lighttpd
Starting web server: lighttpd
Successfully terminated.

(我的这里会提示
package lighttpd suggests installing libmemcache
package lighttpd suggests installing lua
package lighttpd suggests installing memcached
package lighttpd suggests installing sqlite
)

5.安装php-mysql
#/opt/bin/ipkg install php-mysql

四. 配置
(A) 配置mysql

 

1.启动mysql
#/opt/etc/init.d/S70mysqld start   

2.修改mysql的root密码
#/opt/bin/mysqladmin -u root password 123456
(123456就是root的密码,根据自己需要自行设置即可)

3.连接mysql
#/opt/bin/mysql -u root -p
出现提示时输入刚刚修改的密码,输入刚才设置的密码 123456 .

4.连接上mysql之后,创建数据库discuz (可以自己定义,记住就行了,之后会用到)
mysql>create database discuz;

5.查看当前可用数据库
mysql>show databases;
是不是已经有上面创建的discuz了 ?

6.数据库修改完毕.

(B) 配置 lighttpd.conf
1.备份lighttpd.conf (注意一定要备份,以免修改错了)
#cp /opt/etc/lighttpd/lighttpd.conf /opt/etc/lighttpd/lighttpd.conf.bak

2.修改lighttpd.conf
#vi /opt/etc/lighttpd/lighttpd.conf

需要变更的内容为下面的,其他保持不变.

(1)server.modules中把下面行的”#” 去掉
                               “mod_fastcgi”,

(2)index-file.names中修改为:
index-file.names            = ( “index.php”, “install.php”, “index.html”,                    
                                    ”index.htm”, “default.htm” )
添加了 install.php ,安装完论坛再删除 install.php .

(3)server.port中修改端口,默认为8081,可改可不改,自己喜欢.
server.port                = 8081

(4)fastcgi.server中,把”#”去掉, 并修改bin-path .
fastcgi.server             = ( “.php” =>
                               ( “localhost” =>
                                (
                                   ”socket” => “/tmp/php-fastcgi.socket”,
                                   ”bin-path” => “/opt/bin/php-fcgi”
                                 )
                               )
                            )

3. 修改完毕,启动lighttpd试试.
#/opt/etc/init.d/S80lighttpd start

4. 看看程序lighttpd有没有正常运行
#ps | grep lighttpd
如果正常应该有下面的结果
  549 root        212 S   /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
15033 root        268 S   grep lighttpd

五.测试
1. 进入目录 /opt/share/www/lighttpd
#cd /opt/share/www/lighttpd

2. 建立测试文件,看看支不支持php.
# vi info.php

内容为
<?php phpinfo(); ?>

3.浏览器查看测试网页
用IE打开
http://192.168.1.1:8081/info.php    (192.168.1.1为路由器IP)

六.安装discuz论坛
1.上传Discuz解压目录的upload目录内所有文件(不包括upload目录)
到/opt/share/www/lighttpd/目录下。(使用二进制上传,即bin)

2.修改lighttpd目录内所有文件属性为777
#chmod 777 -R /opt/share/www/lighttpd

3.修改lighttpd目录下的config.inc.php文件
#vi /opt/share/www/lighttpd/config.inc.php
需要修改的地方如下:
    $dbhost = ‘localhost’;          // 数据库服务器
    $dbuser = ‘root’;           // 数据库用户名
    $dbpw = ‘123456′;                // 数据库密码
    $dbname = ‘discuz’;         // 数据库名
    $pconnect = 0;              // 数据库持久连接 0=关闭, 1=打开
    $adminemail = ‘email@email.com’;        // 系统管理员 Email
    $dbreport = 1;              // 论坛出现数据库错误时,是否通过 email
                             发送错误报告给系统管理员

4.浏览器安装discuz论坛
http://192.168.1.1:8081/install.php
根据提示安装。

5.安装完毕测试
http://192.168.1.1:8081/index.php

七. 例子(仅供参考)
http://scutlxb.5d6d.com/index.php

———————–AAAAAAAAAAAAAAA—————-
QUOTE:
原帖由 jacobhere 于 2007-11-13 13:36 发表
ipkg_install_file: ERROR: lighttpd depends on the following uninstalled programs
:
         libopenssl libpcre
ipkg_install_file: You may want to use `ipkg install’ to install these.
ipkg_get …

你是在oelg optware下安装吗?
你是不是安装过oleg ?

我采用的是optware .  前面在oleg optware安装过mldonkey的 朋友需要修改一下.(只是修改ipkg.conf的内容,不影响 mldonkey)

试试这样,先看看这个文件的内容是不是下面的,如果不是,先备份. 然后修改该文件内容为下面的
/opt/etc # cat /opt/etc/ipkg.conf

optware下的ipkg.conf内容为
#Uncomment the following line for native packages feed (if any)
#src/gz native http://ipkg.nslu2-linux.org/feeds/optware/ddwrt/native/stable
src/gz optware http://ipkg.nslu2-linux.org/feeds/optware/ddwrt/cross/stable
dest /opt/ /

oleg optware 下的ipkg.conf的内容为
src/gz optware http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable
dest /opt/ /

备份:
/opt/etc # cp /opt/etc/ipkg.conf /opt/etc/ipkg.conf.bak

修改:
# vi /opt/etc/ipkg.conf

修改完毕后update
#/opt/bin/ipkg update

然后再去安装lighttpd 试试.

« 上一篇 | 下一篇 »

发表评论

评论内容 (必填):