Wiki引擎mediawiki

来源:互联网 发布:手机电信网络加速器 编辑:程序博客网 时间:2024/04/30 12:01

作者:【吴业亮】云计算开发工程师
博客:http://blog.csdn.net/wylfengyujiancheng

MediaWiki是一套基于网络的Wiki引擎,维基媒体基金会的所有项目乃至众多wiki网站皆采用了这一软件。MediaWiki软件最初是为自由内容百科全书维基百科所开发的,今日已被一些公司机构部署为内部的知识管理和内容管理系统。Novell甚而还在多个高流量的网站中使用了该软件。MediaWiki采用PHP编程语言写成,并可使用MySQL、MariaDB、PostgreSQL或SQLite之一作为其关系数据库管理系统。MediaWiki在GNU通用公共许可证第2版及其后续版本的条款下分发,其文档则按知识共享-署名-相同方式共享3.0版协议释出,部分文档还被释入了公有领域,这使其成为了自由软件。出于服务维基百科的需求,软件的第一个版本于2002年被部署,后来,维基百科和其他维基项目继续定义了MediaWiki的大部分功能。为了有效地处理大型项目,MediaWiki得到了很好的优化,使其可以承载万亿字节的内容和每秒数十万次的访问请求。因为维基百科是全球最大的网站之一,需要MediaWiki能为开发者实现通过多层次的实现可伸缩性缓存和数据库响应,对开发者来说,这一直是一个让他们很头疼的大问题,而MediaWiki很好的解决了这一问题。MediaWiki有700多个配置设置和超过1800个扩展,可以使各种特性被添加或更改。在维基百科上,超过1000个自动化和半自动化的机器人和其他工具用于协助编辑。它也被一些公司部署为一个内部知识管理系统,一些教育机构也让学生使用MediaWiki来进行小组项目的管理和维护。

这里写图片描述

一、安装http
1、安装软件包

# yum -y install httpd

2、删除欢迎词

# rm -f /etc/httpd/conf.d/welcome.conf

3、修改配置文件/etc/httpd/conf/httpd.conf

86行定义管理员邮箱ServerAdmin root@srv.world95行定义服务器名称ServerName www.srv.world:80# line 151: change151行定义权限AllowOverride All164行添加只能使用目录名称访问的文件名DirectoryIndex index.html index.cgi index.php# 在后面新增# server's response headerServerTokens Prod# keepalive is ONKeepAlive On

4、启动服务并设置开机启动

# systemctl start httpd# systemctl enable httpd

5、设置防火墙

# firewall-cmd --add-service=http --permanentsuccess# firewall-cmd --reloadSuccess

6、写入测试文件

 # vi /var/www/html/index.html <html><body><div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">Test Page</div></body></html>

7、测试
这里写图片描述
二、安装PHP
1、安装软件包

# yum -y install php php-mbstring php-pear

修改配置文件

# vi /etc/php.ini# line 878: 修改时区date.timezone = "Asia/Shanghai"

2、重启http服务

# systemctl restart httpd

3、创建测试文件

# vi /var/www/html/index.php <html><body><div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;"><?php   print Date("Y/m/d");?></div></body></html>

4、测试
这里写图片描述

三、安装数据库
1、安装软件包

# yum -y install mariadb-server

2、修改配置文件/etc/my.cnf

# add follows within [mysqld] section[mysqld]character-set-server=utf8

3、启动服务并设置开机启动

# systemctl start mariadb# systemctl enable mariadb

4、初始化数据库

# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the currentpassword for the root user.  If you've just installed MariaDB, andyou haven't set the root password yet, the password will be blank,so you should just press enter here. Enter current password for root (enter for none):OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDBroot user without the proper authorisation. # set root passwordSet root password? [Y/n] yNew password:Re-enter new password:Password updated successfully!Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyoneto log into MariaDB without having to have a user account created forthem.  This is intended only for testing, and to make the installationgo a bit smoother.  You should remove them before moving into aproduction environment.# remove anonymous usersRemove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'.  Thisensures that someone cannot guess at the root password from the network. # disallow root login remotelyDisallow root login remotely? [Y/n] y ... Success!By default, MariaDB comes with a database named 'test' that anyone canaccess.  This is also intended only for testing, and should be removedbefore moving into a production environment. # remove test databaseRemove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so farwill take effect immediately. # reload privilege tablesReload privilege tables now? [Y/n] y ... Success! Cleaning up... All done!  If you've completed all of the above steps, your MariaDBinstallation should now be secure. Thanks for using MariaDB!

5、连接数据库

# mysql -u root -pEnter password:     # MariaDB root password you setWelcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 3Server version: 5.5.37-MariaDB MariaDB ServerCopyright (c) 2000, 2014, Oracle, Monty Program Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

6、查看用户

MariaDB [(none)]> select user,host,password from mysql.user;+------+-----------+-------------------------------------------+| user | host      | password                                  |+------+-----------+-------------------------------------------+| root | localhost | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx || root | 127.0.0.1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx || root | ::1       | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |+------+-----------+-------------------------------------------+3 rows in set (0.00 sec)

7、显示数据库

MariaDB [(none)]> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema |+--------------------+3 rows in set (0.00 sec)MariaDB [(none)]> exitBye

8、配置防火墙

[root@dlp ~]# firewall-cmd --add-service=mysql --permanentsuccess[root@dlp ~]# firewall-cmd --reloadSuccess

四、创建mediawiki数据库

# mysql -u root -p Enter password:Welcome to the MariaDB monitor.  Commands end with ; or \g.Your MariaDB connection id is 10Server version: 5.5.44-MariaDB MariaDB ServerCopyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.# create "mediawiki" databse (set any password for "password" section)MariaDB [(none)]> create database mediawiki; Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> grant all privileges on mediawiki.* to mediawiki@'localhost' identified by 'password'; Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> exit Bye

五、安装mediawiki
1、下载软件包

# wget https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.4.tar.gz 

2、解压软件包

# tar zxvf mediawiki-1.26.4.tar.gz  

3、拷贝到/var/www/html/mediawiki

# mv mediawiki-1.26.4 /var/www/html/mediawiki 

4、设置权限

# chown -R apache. /var/www/html/mediawiki 

5、重启httpd服务

# systemctl restart httpd

6、配置seLinux

# chcon -R -t httpd_sys_rw_content_t /var/www/html/mediawiki # semanage fcontext -a -t httpd_sys_rw_content_t /var/www/html/mediawiki

六、通过界面配置mediawiki
http://(server’s hostname or IP address)/mediawiki/mw-config/
1、设置语言
这里写图片描述

点击继续
这里写图片描述
2、配置数据库
这里写图片描述

3、创建管理员用户
这里写图片描述
这里写图片描述
4、下载配置文件,并将LocalSettings.php通过ftp工具上传到后台/var/www/html/mediawiki下,注意目录权限
这里写图片描述

5、开始使用

这里写图片描述

参考:
https://zh.wikipedia.org/wiki/MediaWiki

0 0
原创粉丝点击