欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Centos7中mediawiki的搭建

程序员文章站 2022-06-03 09:57:41
...

准备环境LAMP

准备源码包libmcrypt-2.5.8.tar.gz, httpd-2.2.17.tar.gz, mediawiki-1.30.0.tar.gz ,mysql-5.5.22.tar.gz

安装Apache
tar zxf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/data/server/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
make && make install

关闭防火墙,做路径优化,

systemctl stop firewalld
ln -s /data/server/httpd/bin/* /usr/local/bin/

启动apache,ip网页验证

apachectl start

Centos7中mediawiki的搭建

安装mysql

yum安装依赖环境

yum -y install ncurses-devel
yum -y install cmake

创建运行用户

groupadd mysql
useradd -s /sbin/nologin -M -g mysql mysql

编译安装mysql

tar zxf mysql-5.5.22.tar.gz
cd mysql-5.522
cmake -DCMAKE_INSTALL_PREFIX=/data/server/mysql -DSYSCONFDIR=/etc/ -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all
make -j4 && make install

设置数据库目录的权限并建立配置文件

chown -R mysql:mysql /data/server/mysql/
cp support-files/my-medium.cnf /etc/my.cnf
/data/server/mysql/scripts/mysql_install_db --user=mysql --basedir=/data/server/mysql --datadir=/data/server/mysql/data/   #初始化数据库

添加系统服务

cp support-files/mysql.server /etc/init.d/mysqld
chmod a+x /etc/init.d/mysqld
chkconfig --add mysqld

设置环境变量

echo "PATH=$PATH:/data/server/mysql/bin" /etc/profile
. /etc/profile

开启服务

systemctl start mysqld

登录mysql数据库验证

mysql -u root -p

Centos7中mediawiki的搭建
创建wiki数据库以及用户和权限

mysql> create database wikidb;
Query OK, 1 row affected (0.03 sec)

mysql> grant all on wikidb.* to root;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on wikidb.* to aaa@qq.com;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on wikidb.* to wikiuser;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on wikidb.* to aaa@qq.com;
Query OK, 0 rows affected (0.00 sec)

mysql> set password for aaa@qq.com=password('123');
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye

安装PHP

yum安装依赖环境

yum -y install bzip2-devel libcurl-devel readline-devel openssl-devel libxml2-devel
tar zxf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make && make install

编译安装php

cd /usr/local/src/php-7.2.0/
./configure --prefix=/data/server/php --enable-fpm --with-apxs2=/data/server/httpd/bin/apxs --with-config-file-path=/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache=no  --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear
make -j4 && make install

复制配置文件

cp php.ini-development /data/server/php/etc/php.ini
cp /data/server/php/etc/php-fpm.conf.default /data/server/php/etc/php-fpm.conf
cp /data/server/php/etc/php-fpm.d/www.conf.default www.conf

创建运行用户

groupadd www
useradd -s /sbin/nologin -M -g www www

添加系统服务并启动

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
/etc/init.d/php-fpm start

修改apache的配置文件

vim /data/server/httpd/conf/httpd.conf
53 #LoadModule php7_module        modules/libphp7.so   #注释掉此行
54 LoadModule php7_module  modules/libphp7.so   #添加此行

167 <IfModule dir_module>  #在此行下添加index.php
168     DirectoryIndex index.php index.html

309     AddType application/x-compress .Z
310     AddType application/x-gzip .gz .tgz
311     AddType application/x-httpd-php .php      添加此行

编辑一个lnmp环境测试页面

vim /data/server/httpd/htdocs/cui.php

Centos7中mediawiki的搭建
重启服务,网页验证

apachectl restart

Centos7中mediawiki的搭建

安装 Media wiki

tar zxf mediawiki-1.30.0.tar.gz.gz
mv mediawiki-1.30.0 /data/server/httpd/htdocs/wiki2

网页输入IP/wiki2/mw-config/index.php
Centos7中mediawiki的搭建
完成,然后按照提示输入之前在mysql创建的账号密码注册完成就OK了
Centos7中mediawiki的搭建
提示:安装media wiki的最后一步下载的那个.php文件要存放到/data/server/httpd/htdocs/wiki2中。

相关标签: lamp