FreeBSD5.4Release下安装wiki的方法
今天利用早上一段时间,完成了mediawiki服务的安装,使用的版本为mediawiki-1.5.2,安装步骤:
1、下载以下所需软件
php-4.3.9.tar.gz
apache_1.3.33.tar.gz
mysql-4.0.21.tar.gz
mediawiki-1.5.2.tar.gz
将下载的软件通过ftp拷贝到服务器上(/home/funpower)
2、安装apache和php
# cd /home/funpower
# tar zxvf apache_1.3.33.tar.gz
# tar zxvf php-4.3.9.tar.gz
# cd apache_1.3.33
# ./configure --prefix=/usr/local/apache
# cd php-4.3.9
# ./configure --with-apache=../apache_1.3.33 --with-mysql --disable-debug --enable-track-vars
# cp php.ini-dist /usr/local/lib
# cd /usr/local/lib
# mv php.ini-dist php.ini
# cd apache_1.3.33
# ./configure --prefix=/usr/local/apache --activate-module=src/modules/php4/libphp4.a
# make
# make install
配置/usr/local/apache/conf/httpd.conf
加入:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
并修改以下几项:
Servername itnew.3322.org
DirectoryIndex index.php
将apache加入到启动项:
# ee /etc/rc.local
加入如下一行:
/usr/local/apache/bin/apachectl start
重启服务器,在/usr/local/apache/htdocs下新建一个test.php,内容为,然后输入http://yourdomain.com/test.php,如果能看到php-4.3.9的信息,则apache和php安装成功。
3、安装mysql
# cd /home/funpower
# pw groupadd mysql
# pw adduser mysql -g mysql -s /nonexitent
# tar zxvf mysql-4.0.21.tar.gz
# ./configure --prefix=/usr/local/mysql
# make
# make install
至此,mysql安装完成,下面开始具体的配置。
运行脚本
# cd scripts
# ./mysql_install_db
更改文件和目录权限
# chown -R root /usr/local/mysql
# chown -R mysql /usr/local/mysql/var
# chgrp -R mysql /usr/local/mysql
复制配置文件至/etc
# cp ../support-files/my-medium.cnf /etc/my.cnf
添加启动脚本,使mysql随系统一起启动
# echo "/usr/local/mysql/bin/mysqld_safe --user=mysql &" >> /etc/rc.local
启动mysql
# cd /usr/local/mysql/bin
# ./mysqld_safe --user=mysql &
更改mysql的root密码
# cd /usr/local/mysql/bin
# ./mysqladmin -u root password '123456'
拷贝mysql的libmysqlclient.so.10
# cp /usr/local/mysql/lib/mysql/* /usr/lib
# cp /usr/local/mysql/include/mysql/* /usr/include
添加wiki使用的数据库及数据库用户名
# cd /usr/local/mysql/bin
# ./mysql -u root -p
mysql> create database wikidb;
mysql> grant all on wikidb.* to wikidb@localhost identified by '654321';
mysql> flush privileges;
mysql> exit
4、安装mediawiki
# cd /home/funpower
# tar zxvf mediawiki-1.5.2.tar.gz
# mkdir /usr/local/apache/htdocs/wiki
# cd mediawiki-1.5.2
# cp –R * /usr/local/apache/htdocs/wiki
在IE浏览器中输入http://127.0.0.1/wiki/,填写一些wiki安装基本参数,填写的数据库及数据库用户名就是刚才创建的数据库。填写完后点击“安装”按扭,完成安装。
完成最后几步:
# cd /usr/local/apache/htdocs/wiki/config
# cp cp LocalSettings.php ../
# cd ../
# mv config config.bak
访问http://127.0.0.1/wiki/,出现首页,安装成功!