实现LAMP和wordpress
一.LAMP工作原理
二.实验环境
软件:apr-1.6.2.tar.gz httpd-2.4.27.tar.bz2 php-7.1.10.tar.xz
apr-util-1.6.0.tar.gz mariadb-10.2.8-linux-x86_64.tar.gz wordpress-4.8.1-zh_CN.tar.gz
三.基本步骤
1. 源码编译安装httpd
2. 二进制安装mariaadb
3. 源码编译安装php
4. 测试php和mariadb的链接
5. 配置wordpress
6. 测试
四.实验
1.编译httpd2.4
1.yum groupinstall "development tools"
2.yum install openssl-devel expat-devel pcre-devel
3.tar xvf apr-1.6.2.tar.gz
4.tar xvf apr-util-1.6.0.tar.gz
5.tar xvf httpd-2.4.27.tar.bz2
6.cp -r apr-1.6.2 httpd-2.4.27/srclib/apr
7.cp -r apr-util-1.6.0 httpd-2.4.27/srclib/apr-util
8.cd httpd-2.4.27/
9../configure --prefix=/app/httpd24 --sysconfdir=/etc/httpd24--enable-so --enable-ssl --enable-rewrite --with-zlib --with-pcre--with-included-apr --enable-modules=most --enable-mpms-shared=all--with-mpm=prefork
10.Make && make install
11.编辑httpd的变量
13.启动服务
2.二进制安装mariadb
1. tar xvfmariadb-10.2.8-linux-x86_64.tar.gz -C /usr/local/
2.cd /usr/local
3.ln -smariadb-10.2.8-linux-x86_64/ mysql
4.useradd -r -m-d /app/mysqldb -s /sbin/nologin mysql
5.cd mysql/
6.scripts/mysql_install_db--datadir=/app/mysqldb --user=mysql
7.mkdir/etc/mysql
8.cpsupport-files/my-large.cnf /etc/mysql/my.cnf.
9.vim/etc/mysql/my.sql
增加三行
10. cpsupport-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --list
service mysqld start
11.编辑变量
Vim /etc/profile.d/lamp.sh
12../etc/profile.d/lamp.sh
13.进行数据库初始化
mysql_secure_installation 显示结果如下:
Remove anonymous users 是否删除匿名用户
Disallow root login remotely是否禁止root远程登录(是)
Remove test database andaccess to it 是否删除测试数据库test
Reload privilege tables now 是否重新加载权限表
14.创建mysql用户
mysql -uroot -pcentos
create datebase wpdb;
grant all on wpdb.* to wpuser@'172.17.252.%' identified by 'magedu';
grant all on wpdb.* to wpuser@'127.%' identified by 'magedu';
grant all on wpdb.* to wpuser@'localhost' identified by 'magedu';
3.源码编译安装PHP
1.yum install libxml2-devel bzip2-devel libmcrypt-devel
tar xvf php-7.1.10.tar.xz
2.cd php-7.1.10/
3.进行编译
4.make && make install
5. cpphp.ini-production /etc/php.ini
6.vim/etc/httpd24/httpd.conf
7.重新启动httpd服务
Apachectl restart
3.测试PHP和mariadb链接
1.vim/app/httpd24/htdocs/index.php
2.curl
4.配置wordpress
1.tar xvf wordpress-4.8.1-zh_CN.tar.gz -C/app/httpd24/htdocs
cd /app/httpd24/htdocs
mv wordpress/ blog/
2.cd /app/httpd24/htdocs/blog/
cp wp-config-sample.php wp-config.php
3.vim wp-config.php
测试
2. ab -c10 -n 100 压力测试