搭建步骤如下:(root下执行)
1. yum install httpd php pcre php-mysql php-pear php-pecl-apc mysql-server ImageMagick sendmail php-intl wget system-config-firewall-tui
2. service mysqld start
3./usr/bin/mysql_secure_installation
4.登陆mysql,建立用户和密码如下:
insert into mysql.user(Host,User,Password) values("localhost","mediawiki",password("1234"));
5. 建立数据库并赋权:
create database wikidb;
grant index, create, select, insert, update, delete, alter, lock tables on wikidb.* to 'mediawiki'@'localhost' identified by '1234';
exit;
远程访问赋权:
grant all privileges on *.* to 'mediawiki'@'192.168.1.111' identified by '1234';
FLUSH PRIVILEGES;
6.cd /var/www/html
7.wget http://download.wikimedia.org/mediawiki/1.18/mediawiki-1.18.2.tar.gz
8.tar xzpf mediawiki-1.18.2.tar.gz
9.mv mediawiki-1.18.2 wiki
10.chown -R apache:apache wiki
11.vi /etc/httpd/conf/httpd.conf 添加:
<Directory "/var/www/html/wiki/images">
Options -Indexes
# Ignore .htaccess files
AllowOverride None
# Serve HTML as plaintext, don't execute SHTML
AddType text/plain .html .htm .shtml .php
# Don't run arbitrary PHP code.
php_admin_flag engine off
# If you've other scripting languages, disable them too.
</Directory>
11. /etc/httpd/conf/httpd.conf 设置serverName
12.chmod 775 /var/www/html/wiki/images
13. vi /etc/php.ini 设置上传文件大小
post_max_size = 128M
upload_max_filesize = 128M
14. 打开系统的 80和443 端口
15.service httpd restart
16. 登陆 http://IP:端口/wiki
设置:database name:wikidb, database username: mediawiki 等(设置时有前面第4步创建的一致)
并选择PHP object caching
17.下载LocalSettings.php并放到/var/www/html/wiki 目录
18.vi /var/www/html/wiki/LocalSettings.php
$wgEnableUploads = true; # Set this to true
# 添加如下:
$wgFileExtensions = array('png','gif','jpg','jpeg','doc','xls','mpp','pdf','ppt','tiff','bmp','docx', 'xlsx', 'pptx','ps','odt','ods','odp','odg','exe');
$wgFileBlacklist = array_diff( $wgFileBlacklist, array ('exe') );
19.chkconfig httpd on
20.chkconfig mysqld on
21.service sendmail restart
22. chkconfig sendmail on
23. 安装完毕, 开始你的wiki之旅。
问题1:##linux 下apche无法监听端口解决办法
[root@localhost html]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.termwikidev for ServerName
(13)Permission denied: make_sock: could not bind to address [::]:81
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:81
no listening sockets available, shutting down
Unable to open logs
解决办法:
semanage port -l|grep http
semanage port -a -t http_port_t -p tcp 81
问题2:### CentOS 打开端口 如打开3306端口,操作如下:
/sbin/iptables -I INPUT -p tcp --dport 3036 -j ACCEPT
保存我们的操作,命令如下:
/etc/rc.d/init.d/iptables save
查看端口的状态,命令如下:
/etc/init.d/iptables status