[原创]apache+postgresql+php+phpPgAdmin+FUDfo..
时间:2005-03-21 来源:u0u0
软件
httpd-2.0.53.tar.gz2
postgresql-7.4.7.tar.gz2 (FUDforum_2-6-11不支持postgresql-8.x)
php-4.3.10.tar.bz2
phpPgAdmin-3.5.2.tar.bz2
FUDforum_2-6-11.tar.bz2 (如果用zlib版本的,则在编译php是要加上zlib支持)
1。安装postgresql
源码安装想要readline和zlib库,hiweed上把他们都省了,只好自己装。
从他们的主页上down下来,都不大,然后
#./configure
#make
#make love(哈哈!偶在一个论坛中看到某人的签名是这样^_^)
很快安装好了。
结下来是安装pgsql。
把最新的postgresql-8.0.1.tar.gz2 down下来。
#tar jxvf postgresql-8.0.1.tar.gz2
#cd postgresql-8.0.1
#./configure
但是还是提示找不到readline,ldconfig后还是不行。干脆不用他了,反正影响不大。
#./configure --without-readline
#make
#make install
添加一个用于启动pgsql的用户,却只有这个用户能访问数据库。
#adduser postgres
#mkdir /usr/local/pgsql/data
#chown postgres /usr/local/pgsql/data
#su - postgres
$/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
下面的两步官方文档上没有,不创建logfile文件,启动postmaster会提示出错。
$cd /usr/local/pgsql/data
$touch logfile
启动postmaster
$/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
没有提示错误就说明启动成功了,看一下有没有postmaster进程。
$ps -eF |grep postmaster
看到了吧!
创建一个叫test的数据库
$/usr/local/pgsql/bin/createdb test
进入数据库,我试过了,只能用系统用户postgres进入数据库,root都不行。
$/usr/local/pgsql/bin/psql test
出现数据库命令提示符。
要退出用“q” 没有那个引号。
debian下把postmaster添加到init.d中
#vi /etc/init.d/postgresql
su - postgres -c "/usr/local/pgsql/bin/pg_ctl start -l /usr/local/pgsql/data/logfile -D /usr/local/pgsql/data"
:wq
#update-rc.d postgresql defaults 3
2.动态安装apache2.x
动态安装方便以后升级。
#tar zvxf httpd-2.0.53.tar.gz
#cd httpd-2.0.53
#./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most
#make
#make install
修改httpd.conf,寻找Add Type application/x-tar .tgz 在下面添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
3.安装php4.x
#tar jxvf php-4.3.10.tar.bz2
#cd php-4.3.10
#./configure --prefix=/usr/local/php --with-pgsql=/usr/local/pgsql --with-apxs2=/usr/local/apache2/bin/apxs
#make
#make install
启动一下apache
/usr/local/apache2/bin/apachectl start (为了方便开机启动,把它也加到/etc/init.d/postgresql中吧!)
4。安装phpPgAdmin
#tar jxvf phpPgAdmin-3.5.2.tar.bz2
#mv phpPgAdmin /usr/local/apache2/htdocs
#cd /usr/local/apache2/htdocs/phpPgAdmin/conf
#cp config.inc.php-dist config.inc.php
修改config.inc.php中的相应参数.
#vi config.inc.php
// Display name for the server on the login screen
$conf['servers'][0]['desc'] = 'PostgreSQL';
// Hostname or IP address for server. Use '' for UNIX domain socket.
$conf['servers'][0]['host'] = '127.0.0.1';//这里原来留空,改为127.0.0.1
// Database port on server (5432 is the PostgreSQL default)
$conf['servers'][0]['port'] = 5432;
// Change the default database only if you cannot connect to template1
$conf['servers'][0]['defaultdb'] = 'test';
$conf['extra_login_security'] = false;//原来是ture,改为false。 (ture时postgres不能登录数据库)
//其他参数不动,保存退出。
修改/usr/local/pgsql/data/postgresql.conf (重要)
#tcpip_socket = false
改为
tcpip_socket = true
重新启动一下postmaster。
在浏览器中输入http://localhost/phpPgAdmin/index.php
用postgres登录,密码不用输。进入后第一件事修改超级用户postgres的密码,以便进行下面的步骤。
#vi /usr/local/pgsql/data/pg_hba.conf
local all all md5----这里改为md5
# IPv4-style local connections:
host all all 127.0.0.1 255.255.255.255 md5----这里改为md5
# IPv6-style local connections:
#host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust------这行注解掉
重新启动一下postmaster,在浏览器中输入http://localhost/phpPgAdmin/index.php
这此要密码才能登录了。(还可以该apache,让phpPgAdmin目录只能本机访问)
现在创建一个数据库用户bbs(自定),他有创建权限,但不是超级用户,退出。用bbs登录phpPgAdmin,创建一个数据库forum(自定)
5。安装FUDforum_2-6-11(不支持postgresql8.x,居然被识别为3.4.x,费了我好多时间)
#tar jxvf #tar FUDforum_2-6-11.tar.gz2
#mv FUDforum2 /usr/local/apache2/htdocs
#mkdir /usr/local/apache2/FUDforum
#chmod 777 /usr/local/apache2/FUDforum
#chmod 777 -R /usr/local/apache2/htdocs/FUDforum2
在浏览器中输入http://localhost/FUDforum2/install.php
第一个界面默认吧!
第二个界面比较关键,还记得前面数据库中创建的用户bbs和数据库forum吗?填上吧!ip用172.24.6.32(偶内网的ip)
只要第二步通过了,后面的都没有难度。
完了,在浏览器中输入http://localhost/FUDforum2/index.php
漂亮的论坛出来了:)
![]() |
||
|