1、安装LAMP
sudo aptitude install apache2
sudo aptitude install mysql-server
sudo aptitude install php5
sudo aptitude install php5-mysql
sudo aptitude install php5-cli
sudo aptitude install libgd2-xpm libgd2-xpm-dev php5-gd
2、配置php、mysql
sudo gedit /etc/php5/apache2/php.ini
upload_max_filesize = 8M
memory_limit = 12M
extension=mysql.so
sudo gedit /etc/mysql/my.cnf
max_allowed_packet = 128M
3、安装MediaWiki
cd /var/www
sudo wget http://download.wikimedia.org/mediawiki/1.12/mediawiki-1.12.0.tar.gz
sudo tar vxfz mediawiki-1.12.0.tar.gz
sudo mv mediawiki-1.12.0 wiki
cd /var/www/wiki
sudo chmod a+w config
4、配置MediaWiki
去配置:http://localhost/wiki
不要加表前缀
sudo mv config/LocalSettings.php .
sudo rm -rf config
5、下载Znwiki和导入程序
http://download.wikimedia.org/zhwiki/20080407/zhwiki-20080407-pages-articles.xml.bz2
http://download.wikimedia.org/tools/mwdumper.jar
6、清空数据库,以便导入
mysql -p wikidb
Password: ******
mysql> delete from page;
mysql> delete from revision;
mysql> delete from text;
7、导入
java -jar /home/(你的用户名)/mwdumper.jar ——format=sql:1.5 /home/(你的用户名)/zhwiki-20080407-pages-articles.xml.bz2 | mysql -u (表管理员) -p (库名)
例:
java -jar /home/antares/mwdumper.jar ——format=sql:1.5 /home/antares/zhwiki-20080407-pages-articles.xml.bz2 | mysql -u root -p wikidb
本文作者: