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
安装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
创建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
重启服务,网页验证
apachectl restart
安装 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
完成,然后按照提示输入之前在mysql创建的账号密码注册完成就OK了
提示:安装media wiki的最后一步下载的那个.php文件要存放到/data/server/httpd/htdocs/wiki2中。
下一篇: LeetCode 253. 会议室 II
推荐阅读
-
Linux系统:centos7下搭建ZooKeeper3.4中间件,常用命令总结
-
linux中Centos7的LVM磁盘扩容问题
-
Linux中Centos7搭建Hadoop服务步骤
-
CentOs 7.3中搭建RabbitMQ 3.6单机多实例服务的步骤与使用
-
在CentOS中搭建Hadoop的详细步骤
-
centos7下搭建ZooKeeper3.4中间件常用命令小结
-
在centos7 中docker info报错docker bridge-nf-call-iptables is disabled 的解决方法
-
centos7中安装Android SDK的方法步骤
-
Win10中Vue.js的安装和项目搭建
-
Centos7中添加、删除Swap交换分区的方法