准备环境
准备LAMP环境
所需安装包:链接:https://pan.baidu.com/s/1GKoz4IWc4KaMLiDZVuK0XA
提取码:erd0
复制这段内容后打开百度网盘手机App,操作更方便哦
安装Apache
cd /usr/local/src //切换到此路径下
rz //上传httpd包
tar -zxvf httpd-2.2.17.tar.gz -C /data/server/ //解压
cd /data/server/httpd-2.2.17/ //切换到此路径
./configure --prefix=/data/server/httpd //配置
发现报错缺少环境,解决办法如下:
yum -y install gcc-c++ //安装所缺环境
./configure --prefix=/data/server/httpd //重新配置
make && make install //编译安装
ln -s /data/server/httpd/bin/* /usr/local/bin/ //优化路径
apachectl start //启动服务
打开浏览器输入ip地址验证是否成功
安装mysql
cd /usr/local/src/
rz
tar -zxvf mysql-5.5.22.tar.gz -C /data/server/ //解压
cd /data/server/mysql-5.5.22/
使用yum安装所需环境
yum -y install cmake
yum -y install ncurses-devel
yum -y install bison
配置
cmake- DCMAKE_INSTALL_PREFIX=/data/server/mysql -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all
编译安装
make && make install
创建用户给予权限
useradd -M -s /sbin/nologin mysql
chown -R mysql:mysql /data/server/mysql //设置数据库目录的权限
chown -R mysql:mysql /data/server/mysql/data/ //设置数据库目录的权限
cp support-files//my-medium.cnf /etc/my.cnf
echo "PATH=$PATH:/data/server/mysql/bin" >> /etc/profile //设置黄金变量
. /etc/profile
cd /data/server/mysql
cp support-files/mysql-server /etc/init.d/mysqld
scripts/mysql_install_db --defaults-file=./my.cnf --user=mysql
chmod a+x /etc/init.d/mysqld
chkconfig --add mysqld
/data/server/mysql/scripts/mysql_install_db --user=mysql --basedir=/data/server/mysql --datadir=/data/server/mysql/data //建立配置文件
systemctl start mysqld //开启服务
mysql -u root -p //登录mysql验证
创建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> exit
Bye
安装PHP
rz
tar -zxvf php-7.2.0.tar.gz -C /data/server/
cd /data/server/php-7.2.0/
安装环境
yum -y install bzip2-devel
yum -y install libcurl-devel
yum -y install libpng
yum -y install libpng-devel
yum -y install readline-devel
配置
./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 && 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
修改配置文件
vim /data/server/httpd/conf/httpd.conf
#LoadModule php7_module modules/libphp7.so #注释掉此行
LoadModule php7_module modules/libphp7.so #添加此行
<IfModule dir_module> #在此行下添加index.php
DirectoryIndex index.php index.html
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php 添加此行
vim /data/server/httpd/htdocs/lxy.php //编辑测试页
<?php
phpinfo();
?> //保存并退出
打开浏览器输入 ip(自己的ip)/lxy.php
显示php测试界面
安装media wiki
cd /usr/local/src
rz //上传media wiki包
tar zxf mediawiki-1.30.0.tar.gz.gz -C /data/server/httpd/htdocs/wiki //解压至此目录下
网页输入IP/wiki/mw-config/index.php
根据提示继续操作进入首页
安装media wiki的最后一步下载的那个.php文件要存放到/data/server/httpd/htdocs/wiki下