准备工作
安装apache(httpd)
编译安装httpd
tar xzvf httpd-2.2.17.tar.gz -C /data/server
cd /data/server/httpd-2.2.17
./configure --prefix=/data/server/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi
make -j4 && make install
优化路径并启动:
ln -s /data/server/httpd/bin/* /usr/local/bin/
apachectl start
此时启动会提示:
httpd: Could not reliably determine the server's fully qualified domain name, using fe80::963a:9ac6:910d:70f2 for ServerName
解决办法:在末行添加:ServerName localhost:80
验证:
安装MySQL
编译安装mysql
提前安好需要的安装环境
yum -y install cmake nucrses-devel
yum -y install ncurses-devel
编译安装:
tar zxvf mysql-5.5.22.tar.gz -C /data/server
cd /data/server/mysql-5.5.22
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
配置
新建用户:
useradd -M -s /sbin/nologin mysql //不登陆系统不创建目录
chown -R mysql:mysql /data/server/mysql // 设置权限
修改配置:
cp support-files/my-medium.cnf /etc/my.cnf
添加系统服务:
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
格式化数据库:
/data/server/mysql/scripts/mysql_install_db --user=mysql --basedir=/data/server/mysql --datadir=/data/server/mysql/data/
启动数据库:
systemctl start mysql
配置数据库:
[root@bogon mysql-5.5.22]# mysql -uroot -p
mysql> create database wikidb; // 新建库的名字
mysql> grant all on wikidb.* to root; // root获得数据库的所有权限
mysql> grant all on wikidb.* to root@localhost; // 登录root用户的主机获得数据库权限
mysql> grant all on wikidb.* to wikiuser; // wiki用户获得数据库的权限
mysql> Grant all on wikidb.* to wikiuser@localhost; // 登录Wiki用户的主机获得数据库权限
mysql> set password for wikiuser@localhost=password('wikipw') //设置Wiki用户的密码
mysql> exit
安装php
编译安装
tar jzvf php-7.2.26.tar.bz2 -C /data/server
cd /data/server/php-7.2.26
安装环境:
yum -y install bzip2-devel libcurl-devel readline-devel openssl-devel libxml2-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-pea
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 /data/server/php/etc/php-fpm.d/www.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
useradd -M -s /sbin/nologin www
/etc/init.d/php-fpm start
chmod +x /etc/init.d/php-fpm
/etc/init.d/php-fpm start
ln -s /etc/init.d/php-fpm /usr/bin/
/etc/init.d/php-fpm restart
验证LAMP
修改配置
vim /data/server/httpd/conf/httpd.conf
在167行下添加:
167 <IfModule dir_module>
168 DirectoryIndex index.html index.php
在311行添加:
309 AddType application/x-compress .Z
310 AddType application/x-gzip .gz .tgz
311 AddType application/x-httpd-php .php
验证LNMP
创建一个php脚本:
vim /data/server/httpd/htdocs/test.php
写入:
<?php
phpinfo();
?>
保存并退出;
重启Apache:Apachectl graceful
在浏览器输入:IP/test.php
出现此页面证明成功
安装mediaWiki
wget https://releases.wikimedia.org/mediawiki/1.34/mediawiki-1.34.0.tar.gz
tar zxf mediawiki-1.34.0.tar.gz
mv mediawiki-1.34.0 /data/server/httpd/htdocs/wiki
浏览器输入:IP/wiki/mw-config/index.php
开始配置mediaWiki
配置完成:
安装dokuwiki
下载安装dokuwiki:
yum -y install https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
tar xzf dokuwiki-stable.tgz
mv dokuwiki-2018-04-22b /data/server/httpd/htdocs/
修改权限:
chmod -R 777 /data/server/httpd/htdocs/dokuwiki-2018-04-22b/
apachectl graceful
浏览器打开:IP/dokuwiki-2018-04-22b/install.php
配置成功
来源:CSDN
作者:suiyu_eran_
链接:https://blog.csdn.net/suiyu_eran_/article/details/103747310