准备环境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 root@localhost;
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 wikiuser@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> set password for wikiuser@localhost=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-mb
复制配置文件
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 #在此行下添加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创建的账号密码注册完成
来源:CSDN
作者:蔡yong空你给我gong
链接:https://blog.csdn.net/nigeiwogong/article/details/103756655