天天看點

LAMP

實作LAMP和wordpress

一.LAMP工作原理

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

LAMP

11.編輯httpd的變量

LAMP

13.啟動服務

LAMP

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

增加三行

LAMP

10. cpsupport-files/mysql.server /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig --list

service mysqld start

         11.編輯變量

                   Vim /etc/profile.d/lamp.sh

LAMP

               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                  是否重新加載權限表

LAMP

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.進行編譯

LAMP

4.make  && make  install

5. cpphp.ini-production /etc/php.ini

6.vim/etc/httpd24/httpd.conf

LAMP

7.重新啟動httpd服務

     Apachectl   restart

3.測試PHP和mariadb連結

         1.vim/app/httpd24/htdocs/index.php

LAMP

         2.curlhttp://172.17.252.64

LAMP

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

LAMP

  測試

LAMP

         2. ab -c10 -n 100 http://172.17.252.64/blog    壓力測試

LAMP

繼續閱讀