软件:
apr-1.6.5.tar.gz
apr-util-1.6.1.tar.gz
httpd-2.4.39.tar.gz
php-7.3.3.tar.gz
mariadb-10.3.14-linux-x86_64.tar.gz
WordPress5.1.1.tar.gz
phpMyAdmin-4.8.5-all-languages.zip
一、编译安装HTTPD
1.安装包组
yum groupinstall "development tools"
yum installopenssl-devel expat-devel pcre-deve
2.解压包
tar xf httpd-2.4.39.tar.gz -C /tmp/
tar xf apr-1.6.5.tar.gz -C /tmp/
tar xf apr-util-1.6.1.tar.gz -C /tmp/
3.编译安装:
cp -r /tmp/apr-1.6.5/ /tmp/httpd-2.4.39/srclib/apr
cp -r /tmp/apr-util-1.6.1/ /tmp/httpd-2.4.39/srclib/apr-util
cd /tmp/httpd-2.4.39/
./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-rewrite --with-zlib --with-pcre --with-included-apr --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
make -j 4 && make install
4.修改PATH路径
vim /etc/profile.d/httpd.sh
PATH=/usr/local/httpd/bin/:$PATH
source /etc/profile.d/httpd.sh
5.配置启动 apachectl复制/etc/init.d目录下,重命名为httpd
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vim /etc/init.d/httpd
#chkconfig: 2345 70 30
#description: Apache
加到chkconfig列表中
chkconfig --add httpd
chkconfig --list httpd
启动HTTPD服务
service httpd start
二、编译安装mariadb
1.解压包
tar xf /root/mariadb-10.3.14-linux-x86_64.tar.gz -C /usr/local/
2.创建mysql系统用户组
groupadd mysql
useradd -g mysql mysql
3.编译安装:
cd /usr/local/
ln -s mariadb-10.3.14-linux-x86_64/ mysql/
cd mysql/
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
bin/mysqld_safe --user=mysql &
4.安全安装
mysql_secure_installation
5.修改PATH路径
vim /etc/profile.d/mysqld.sh
export PATH=/usr/local/mysql/bin/:$PATH
source /etc/profile.d/mysqld.sh
6.配置启动
cp support-files/mysql.server /etc/init.d/mysqld
chkconfig mysqld on
service mysqld start
三、编译安装PHP7.3
1.安装包
yum install -y libxml2-devel bzip2-devel curl-devel libjpeg-devel libpng-devel freetype-devel
重新安装libzip
yum remove -y libzip
wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -xf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make -j 4 && make install
添加动态链接库路径
vim /etc/ld.so.conf
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
更新配置
ldconfig -v
解决报错(fatal error: zipconf.h)
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
2.解压包
tar xf /root/php-7.3.3.tar.gz -C /tmp/
3.编译安装:
cd /tmp/php-7.3.3/
./configure --prefix=/usr/local/php --with-fpm-user=www --with-fpm-group=www --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --enable-fpm
make -j 4 && make install
4.配置
cp /root/php-7.3.3/php.ini-production /usr/local/php/lib/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
ln -s /usr/local/php/sbin/php-fpm /usr/local/bin/
vim /usr/local/php/etc/php-fpm.d/www.conf
[www]
listen = 127.0.0.1:9080
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 128
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 10000
rlimit_files = 1024
slowlog = log/$pool.log.slow
5.配置启动
cp /root/php-7.3.3/sapi/fpm/php-fpm /usr/lib/systemd/system/
启动
systemctl start php-fpm
查看状态
systemctl status php-fpm
四、编译安装wordpress
1.解压包
tar xf /root/latest.tar.gz -C /usr/local/httpd/htdocs/
2.创建数据库
mysql -uroot -p
CREATE DATABASE wordpress;
grant all privileges on wordpress.* to wordpress@'%'identified by 'password';
3.配置httpd.conf 加载模块
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
php页面请求,交给php引擎解释
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
文件底部添加,php-fpm配置TCP socket
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9080"
</FilesMatch>
配置wordpress
cd /usr/local/httpd/htdocs/wordpress
cp wp-config-sample.php wp-config.php
vim wp-config.php
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wordpress' );
define( 'DB_PASSWORD', 'password' );
define( 'DB_HOST', '127.0.0.1' );
4.浏览器访问WordPress
五、编译安装phpMyAdmin
1.解压包
unzip phpMyAdmin-4.8.5-all-languages.zip -d /usr/local/httpd/htdocs/
2.配置
cd /usr/local/httpd/htdocs/
vim config.inc.php
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['blowfish_secret'] = '12345678901234567890123456789012'
mkdir tmp
chmod 777 tmp
5.浏览器访问phpMyAdmin