本文介绍如何在Gentoo Linux下搭建MediaWiki站点,MediaWiki是类似wikipedia.org使用的一个WIKI百科全书网站。
每一步都是真实操作的记录,理论上Gentoo Linux按此步骤操作可完成安装,原创,转载请注明出处。
其它发行版本Linux配置方式雷同。
以下所有#开头的均为要执行的命令
1、环境说明
# uname -a
Linux df53l 2.6.28-gentoo-r5 #1 SMP Tue Jun 16 18:58:24 CST 2009 i686 Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz GenuineIntel GNU/Linux
# emerge -pv apache
[ebuild R ] www-servers/apache-2.2.11 USE="ssl -debug -doc -ldap (-selinux) -sni -static -suexec -threads" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias
# emerge -vp php
[ebuild R ] dev-lang/php-5.2.9-r2 USE="apache2 berkdb bzip2 cgi cli crypt force-cgi-redirect gd gdbm iconv mysql ncurses nls pcre readline reflection session spl ssl suhosin unicode xml zlib ......
# emerge -vp mediawiki
[ebuild R ] www-apps/mediawiki-1.14.0 USE="imagemagick mysql ocamlopt vhosts -math -postgres" 0 kB
# emerge -vp mysql
[ebuild R ] dev-db/mysql-5.0.70-r1 USE="berkdb perl ssl -big-tables -cluster -debug -embedded -extraengine -latin1 -max-idx-128 -minimal (-selinux) -static" 0 kB
2、安装软件
# echo "dev-lang/php apache2 pcre session spl xml mysql and either gd suhosin cgi for ce-cgi-redirect" >> /etc/portage/package.use
# echo "www-apps/mediawiki imagemagick mysql vhosts" >> /etc/portage/package.use
# echo "www-servers/apache ssl" >> /etc/portage/package.use
# echo "dev-db/mysql berkdb perl ssl" >> /etc/portage/package.use
# emerge -pv www-servers/apache dev-lang/php www-apps/mediawiki dev-db/mysql
3、配置Apache
# webapp-config -I -h mediawiki mediawiki 1.14.0
提示success后,检查 /var/www/mediawiki 目录是否生成。
# vim /etc/apache2/httpd.conf
添加以下内容
#For MediaWiki
Listen 8867
AddHandler php5-cgi .php
Options +Indexes +ExecCGI +FollowSymLinks
DirectoryIndex index.php
AllowOverride Limit
# vim /etc/apache2/vhosts.d/mediawiki-vhost.conf
添加以下内容
NameVirtualHost *:8867
ServerName "myserver.mydomain.com"
DocumentRoot "/var/www/mediawiki/htdocs"
AddHandler php5-cgi .php
DirectoryIndex index.php
AllowOverride All
Order Allow,Deny
Allow from All
# vim /etc/apache2/modules.d/php5-cgi.conf
添加以下内容
#handler for PHP 5 scripts
ScriptAlias /php5-cgi /usr/lib/php5/bin/php-cgi
Action php5-cgi /php5-cgi
AddHandler php5-cgi .php5
4、配置MySQL
# mysql -u root -p
# mysql> create database wikidb;
# mysql> grant create, select, insert, update, delete, alter, lock tables on wikidb.* to 'wikiuser'@'localhost' identified by 'password'; #'password'改为您的密码
# flush privileges;# set password for 'wikiuser'@'localhost'=password('password'); #'password'改为您的密码
# mysql> quit;
5、重启
# /etc/init.d/apache2 restart
# /etc/init.d/mysql restart
6、配置MediaWiki
# chmod a+w /var/www/mediawiki/htdocs/config/
使用浏览器访问 http://10.206.1.116:8867/,点击页面上的“Please set up the wiki first.“
点击后出现 MediaWiki 1.14.0 Installation 页面。
按要求填完所有设置选项后,点击 InstallMedia按钮。
出现
最后照页面提示移动LocalSettings.php文件
# mv /var/www/mediawiki/htdocs/config/LocalSettings.php /var/www/mediawiki/htdocs/
完成!