CentOS7搭建mediawiki
一、安装环境
1、 安装nginx
yum -y install gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel ncurses-devel bison
tar -zxvf nginx-1.14.2.tar.gz cd nginx-1.14.2
./configure –prefix=/usr/local/nginx make make install 2、 安装cmake
tar -zxvf cmake-2.8.10.2.tar.gz cd cmake-2.8.10.2 ./bootstrap make make install 3、 安装mysql
cp -f libmysqlclient.so.15 /usr/lib64/ chmod 755 /usr/lib64/libmysqlclient.so.15 tar -zxvf mysql-5.5.33.tar.gz mkdir -p /data/mysql cd mysql-5.5.33 cmake
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all
DWITH_MYISAM_STORAGE_ENGINE=1 DWITH_INNOBASE_STORAGE_ENGINE=1 DWITH_MEMORY_STORAGE_ENGINE=1
-DWITH_READLINE=1 -
-----
DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql DMYSQL_USER=mysql make make install
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld 添加mysql用户
useradd -M -s /sbin/nologin mysql 添加mysql组 groupadd mysql
chown -R mysql:mysql /data/mysql mkdir /data/mysql/log touch error.log vim /etc/my.cnf [mysqld]
datadir=/data/mysql
socket=/data/mysql/mysql.sock [mysqld_safe]
log-error=/data/mysql/log/error.log pid-file=/data/mysql/mysql.pid
ln -s /usr/local/mysql/bin/mysql /usr/bin service mysqld start
(初始化mysql
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql datadir=/data/mysql/)
连接数据库,添加一个用户mediawiki,创建一个mediawikidb数据库
-
--mysql >grant all on *.* to \ mysql > flush privileges; mysql >quit
mysql >create database mediawikidb //为mediawiki创建一个数据库 4、 安装php
安装依赖
yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel 解压、编译
bzip2 -d php-7.2.17.tar.bz2 tar xvf php-7.2.17.tar cd php-7.2.17
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-simplexml --enable-xml --disable-rpath --enable-bcmath --enable-soap --enable-zip --with-curl --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-mbstring --enable-sockets --with-gd --with-openssl --with-mhash --enable-opcache --enable-fileinfo make make install 设置配置文件 cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf cd php-fpm.d
cp www.conf.default www.conf
cp php-7.2.17/php.ini-development /usr/local/php/lib/php.ini
vim /usr/local/php/lib/php.ini error_reporting = E_ALL log_errors = on
error_log = /usr/local/php/log/php_errors.log //配置php错误日志
vim /usr/local/php/etc/php-fpm.conf [www]
catch_workers_output = yes
error_log = /usr/local/php/log/php-fpm.log
修改nginx配置文件 location / {
root /www;
index index.html index.htm; }
location ~ \\.php$ {
root /www;
fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME include fastcgi_params; }
修改环境变量 vim /etc/profile 在末尾加入
PATH=$PATH:/usr/local/php/bin
//配置php-fpm错误日志 /www$fastcgi_script_name;
export PATH
source /etc/profile //使环境变量立即生效 ./usr/local/php/sbin/php-fpm //启动php-fpm
二、安装mediawiki
tar -zxvf mediawiki-1.32.0.tar.gz mv mediawiki-1.32.0 /www/mediawiki 浏览器访问:ip/mediawiki/index.php开始安装
点击继续进入下一步,