[root@localhost ~]# ll
总用量 655760
-rw-------. 1 root root 1040 2月 17 16:57 anaconda-ks.cfg
drwxr-xr-x. 29 501 games 4096 2月 21 11:00 apr-1.7.4
-rw-r--r--. 1 root root 1122147 2月 21 10:57 apr-1.7.4.tar.gz
drwxr-xr-x. 21 501 games 4096 2月 21 11:06 apr-util-1.6.3
-rw-r--r--. 1 root root 556623 2月 21 10:57 apr-util-1.6.3.tar.gz
drwxr-xr-x. 14 504 games 4096 2月 21 11:09 httpd-2.4.58
-rw-r--r--. 1 root root 7485817 2月 21 10:57 httpd-2.4.58.tar.bz2
-rw-r--r--. 1 root root 25960271 1月 31 03:28 latest.zip
-rw-r--r--. 1 root root 186945 2月 21 10:57 libzip-devel-1.7.3-7.el9.x86_64.rpm
-rw-r--r--. 1 root root 452383016 2月 21 19:20 mysql-8.2.0-linux-glibc2.17-x86_64.tar.xz
-rw-r--r--. 1 root root 66534 2月 21 10:57 oniguruma-devel-6.9.6-1.el9.5.x86_64.rpm
drwxr-xr-x. 20 root root 4096 2月 21 17:35 php-8.2.12
-rw-r--r--. 1 root root 19117679 10月 25 06:10 php-8.2.12.tar.gz
drwxr-xr-x. 18 root root 4096 12月 20 20:44 php-8.3.1
-rw-r--r--. 1 root root 164577280 2月 21 10:57 php-8.3.1.tar
drwxr-xr-x. 5 root root 4096 1月 31 03:27 wordpress
[root@localhost ~]# yum install -y libxml2-devel
[root@localhost ~]# tar xf apr-1.7.4.tar.gz
[root@localhost ~]# cd apr-1.7.4
[root@localhost apr-1.7.4]# yum -y install gcc
[root@localhost apr-1.7.4]# ./configure --prefix=/usr/local/apr ; echo $?
[root@localhost apr-1.7.4]# make -j2 ; echo $?
[root@localhost apr-1.7.4]# make install ; echo $?
[root@localhost ~]# tar xf apr-util-1.6.3.tar.gz
[root@localhost apr-util-1.6.3]# yum -y install expat-devel
[root@localhost apr-util-1.6.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr ; echo $?
root@localhost apr-util-1.6.3]# make -j2 && make install ; echo $?
[root@localhost ~]# yum -y install bzip2 pcre-devel openssl-devel
[root@localhost ~]# tar xf httpd-2.4.58.tar.bz2
[root@localhost ~]# cd httpd-2.4.58
[root@localhost httpd-2.4.58]# ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-ssl --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util ; echo $?
[root@localhost httpd-2.4.58]# make -j2 && make install ; echo $?
[root@localhost ~]# yum -y install epel-release
[root@localhost ~]# tar xf php-8.3.1.tar
[root@localhost ~]# yum -y install php-mcrypt \
libmcrypt \
libmcrypt-devel \
autoconf \
freetype \
gd \
libmcrypt \
libpng \
libpng-devel \
libjpeg \
libxml2 \
libxml2-devel \
zlib \
curl \
curl-devel \
re2c \
php-pear ; echo $?
[root@localhost ~]# yum -y install perl perl-devel
[root@localhost ~]# dnf -y groupinstall 'Development Tools'
[root@localhost ~]# yum -y install net-tools wget libxml2-devel sqlite-devel bzip2-devel libcurl-devel libffi-devel libpng-devel libwebp-devel libjpeg-devel oniguruma libzip
[root@localhost ~]# wget https://dl.rockylinux.org/pub/rocky/9/devel/x86_64/os/Packages/o/oniguruma-devel-6.9.6-1.el9.5.x86_64.rpm
wget https://dl.rockylinux.org/pub/rocky/9/devel/x86_64/os/Packages/l/libzip-devel-1.7.3-7.el9.x86_64.rpm
yum -y localinstall oniguruma-devel-6.9.6-1.el9.5.x86_64.rpm
[root@localhost ~]# yum -y localinstall libzip-devel-1.7.3-7.el9.x86_64.rpm
[root@localhost ~]# tar xf php-8.2.12.tar.gz
[root@localhost ~]# cd php-8.2.12
[root@localhost php-8.2.12]# vi /usr/local/apache/bin/apxs
#!/usr/bin/perl -w
[root@localhost php-8.2.12]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
[root@localhost php-8.2.12]# yum -y install freetype-devel readline-devel
./configure --prefix=/usr/local/php8 \
--with-config-file-path=/usr/local/php8/etc \
--with-mysql=/usr/local/mysql/ \
--with-apxs2=/usr/local/apache/bin/apxs \
--enable-fpm \
--enable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-openssl \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--enable-exif \
--enable-ftp \
--enable-gd \
--with-jpeg \
--with-zlib-dir \
--with-freetype \
--with-gettext \
--enable-mbstring \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-readline \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-pcntl \
--enable-opcache \
--enable-posix;echo $?
[root@localhost php-8.2.12]# make -j2 ; echo $?
[root@localhost php-8.2.12]# make -j2 ; echo $?
[root@localhost php-8.2.12]# make install ; echo $?
[root@localhost php-8.2.12]# vim +$ /etc/profile
export PATH=$PATH:/usr/local/php8/bin/
[root@localhost php-8.2.12]# source /etc/profile
[root@localhost php-8.2.12]# find / -type f -name php.ini-development
[root@localhost php-8.2.12]# cp -av ./php.ini-development /usr/local/php8/lib/php.ini
[root@localhost php-8.2.12]# cp -av /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf
[root@localhost php-8.2.12]# cp -av /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf
配置 PHP
mkdir -pv /usr/local/php/tmp && chmod -R 755 /usr/local/php/tmp
[root@localhost php-8.2.12]# vi /usr/local/php8/lib/php.ini
[root@localhost php-8.2.12]# useradd -s /sbin/nologin apache -M
useradd:用户“apache”已存在
[root@localhost php-8.2.12]# vim /usr/local/php8/etc/php-fpm.d/www.conf
[root@localhost php-8.2.12]# grep -ni '^user' /usr/local/php8/etc/php-fpm.d/www.conf
28:user = nobody
[root@localhost php-8.2.12]# sed -i 's@user = nobody@user = apache@' /usr/local/php8/etc/php-fpm.d/www.conf
[root@localhost php-8.2.12]# grep -ni '^user' /usr/local/php8/etc/php-fpm.d/www.conf
28:user = apache
1. 创建脚本文件
vim /usr/lib/systemd/system/php-fpm.service
内容如下
[Unit]
Description=php-fpm
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/usr/local/php831/sbin/php-fpm
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
chmod 700 /usr/lib/systemd/system/php-fpm.service
systemctl daemon-reload
systemctl start php-fpm && systemctl enable php-fpm && systemctl status php-fpm
[root@localhost php-8.2.12]# ps axu | grep php-fpm
[root@localhost php-8.2.12]# systemctl status php-fpm
[root@localhost php-8.2.12]# ps axu | grep php-fpm
[root@localhost php-8.2.12]# ps -efL |grep php-fpm
[root@localhost php-8.2.12]# vim /usr/local/apache/conf/httpd.conf
[root@localhost php-8.2.12]# /usr/local/apache/bin/apachectl -t
Syntax OK
[root@localhost php-8.2.12]# /usr/local/apache/bin/apachectl start
/usr/local/apache/bin/apachectl stop
[root@localhost ~]# tar xf mysql-8.2.0-linux-glibc2.17-x86_64.tar.xz
[root@localhost ~]# cd mysql-8.2.0-linux-glibc2.17-x86_64
[root@localhost ~]# mv mysql-8.2.0-linux-glibc2.17-x86_64 /opt/
[root@localhost ~]# ll /opt/
总用量 0
drwxr-xr-x. 9 root root 129 2月 21 19:21 mysql-8.2.0-linux-glibc2.17-x86_64
[root@localhost ~]# ln -sv /opt/mysql-8.2.0-linux-glibc2.17-x86_64/ /usr/local/mysql
'/usr/local/mysql' -> '/opt/mysql-8.2.0-linux-glibc2.17-x86_64/'
[root@localhost ~]# ll /usr/local/mysql/
总用量 296
drwxr-xr-x. 2 7161 31415 4096 2月 21 19:21 bin
drwxr-xr-x. 2 7161 31415 38 10月 12 21:20 docs
drwxr-xr-x. 3 7161 31415 4096 10月 12 21:20 include
drwxr-xr-x. 6 7161 31415 4096 10月 12 21:20 lib
-rw-r--r--. 1 7161 31415 279351 10月 12 19:40 LICENSE
drwxr-xr-x. 4 7161 31415 30 10月 12 21:20 man
-rw-r--r--. 1 7161 31415 666 10月 12 19:40 README
drwxr-xr-x. 28 7161 31415 4096 10月 12 21:20 share
drwxr-xr-x. 2 7161 31415 77 10月 12 21:20 support-files
[root@localhost ~]# chown -R mysql. /usr/local/mysql/
[root@localhost ~]# cat /data/mysql/mysql3316/conf/my3316.cnf
[client]
port = 3316
socket = /data/mysql/mysql3316/run/mysql3316.sock
default-character-set=utf8mb4
[mysql]
disable-auto-rehash
#允许通过 TAB 键提示
default-character-set = utf8mb4
connect-timeout = 10
[mysqld]
user=mysql
server-id = 3316
port = 3316
socket = /data/mysql/mysql3316/run/mysql3316.sock
pid-file = /data/mysql/mysql3316/run/mysql3316.pid
basedir = /usr/local/mysql
datadir = /data/mysql/mysql3316/data
#bind_address = 10.10.10.11
autocommit = 1
default_authentication_plugin=mysql_native_password
character-set-server=utf8mb4
explicit_defaults_for_timestamp=true
lower_case_table_names=1
back_log=103
max_connections=10000
max_connect_errors=100000
table_open_cache=512
external-locking=FALSE
max_allowed_packet=32M
sort_buffer_size=2M
join_buffer_size=2M
thread_cache_size=51
transaction_isolation=READ-COMMITTED
tmp_table_size=96M
max_heap_table_size=96M
###***logs
long_query_time = 10
slow_query_log = 1
slow_query_log_file=/data/mysql/mysql3316/logs/my3316-slow.log
#log-warnings = 1
log_error_verbosity=3
log-error = /data/mysql/mysql3316/logs/mysql3316-error.log
log_output = FILE
#参数 log_output 指定了慢查询输出的格式,默认为 FILE
#log-queries-not-using-indexes
#log-slow-slave-statements
max_binlog_size = 1G
#max_relay_log_size = 1G
# replication
log-bin=/data/mysql/mysql3316/logs/mysql-bin
#server-id=1
#binlog_format= ROW
#gtid_mode = on
#enforce_gtid_consistency = 1
#log_slave_updates = 1
#master-info-repository=TABLE
#relay-log-info-repository=TABLE
# innodb storage engine parameters
innodb_buffer_pool_size=500M
innodb_data_file_path=ibdata1:100M:autoextend:max:2G #redo
#innodb_data_file_path=ibdata1:100M:autoextend:max:5G #redo
#innodb_data_file_path=ibdata1:100M:autoextend:max:5G #redo
innodb_temp_data_file_path = ibtemp1:100M:autoextend:max:1G
#innodb_temp_data_file_path = ibtemp1:100M:autoextend:max:10G
#innodb_file_io_threads=4
#默认的是 4
innodb_log_buffer_size=16M
innodb_log_file_size=256M #undo
innodb_log_files_in_group=2
innodb_lock_wait_timeout=50
innodb_file_per_table=1
#独立表空间
[root@localhost mysql]# ./bin/mysqld --defaults-file=/data/mysql/mysql3316/conf/my3316.cnf --datadir=/data/mysql/mysql3316/data --user=mysql --initialize-insecure --console ; echo $?
0
[root@localhost mysql]# tail -f /data/mysql/mysql3316/logs/mysql3316-error.log
[root@localhost mysql]# ./bin/mysqld_safe --defaults-file=/data/mysql/mysql3316/conf/my3316.cnf &
[root@localhost mysql]# yum -y install ncurses-compat-libs
[root@localhost mysql]# /usr/local/mysql/bin/mysql -S /data/mysql/mysql3316/run/mysql3316.sock
[root@localhost mysql]# /usr/local/mysql/bin/mysql -S /data/mysql/mysql3316/run/mysql3316.sock
mysql> alter user root@localhost identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> create user 'root'@'%' identified with mysql_native_password by '123456';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> select user,host from mysql.user;
[root@localhost bin]# /usr/local/mysql/bin/mysql -S /data/mysql/mysql3316/run/mysql3316.sock -p123456
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Mysql@123';
Query OK, 0 rows affected (0.04 sec)
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set host='%' where user='root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'user.PRIMARY'
mysql> GRANT ALL ON *.* TO 'root'@'%';
Query OK, 0 rows affected (0.01 sec)
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Mysql@123';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@localhost bin]# cd /usr/local/apache/htdocs/
[root@localhost htdocs]# cat >index.php<<EOF
<?php
phpinfo();
?>
EOF
[root@localhost htdocs]# /usr/local/apache/bin/apachectl restart
[root@localhost ~]# wget -c https://wordpress.org/latest.zip
[root@localhost ~]# ll
总用量 655756
-rw-------. 1 root root 1040 2月 17 16:57 anaconda-ks.cfg
drwxr-xr-x. 29 501 games 4096 2月 21 11:00 apr-1.7.4
-rw-r--r--. 1 root root 1122147 2月 21 10:57 apr-1.7.4.tar.gz
drwxr-xr-x. 21 501 games 4096 2月 21 11:06 apr-util-1.6.3
-rw-r--r--. 1 root root 556623 2月 21 10:57 apr-util-1.6.3.tar.gz
drwxr-xr-x. 14 504 games 4096 2月 21 11:09 httpd-2.4.58
-rw-r--r--. 1 root root 7485817 2月 21 10:57 httpd-2.4.58.tar.bz2
-rw-r--r--. 1 root root 25960271 1月 31 03:28 latest.zip
-rw-r--r--. 1 root root 186945 2月 21 10:57 libzip-devel-1.7.3-7.el9.x86_64.rpm
-rw-r--r--. 1 root root 452383016 2月 21 19:20 mysql-8.2.0-linux-glibc2.17-x86_64.tar.xz
-rw-r--r--. 1 root root 66534 2月 21 10:57 oniguruma-devel-6.9.6-1.el9.5.x86_64.rpm
drwxr-xr-x. 20 root root 4096 2月 21 17:35 php-8.2.12
-rw-r--r--. 1 root root 19117679 10月 25 06:10 php-8.2.12.tar.gz
drwxr-xr-x. 18 root root 4096 12月 20 20:44 php-8.3.1
-rw-r--r--. 1 root root 164577280 2月 21 10:57 php-8.3.1.tar
[root@localhost ~]# unzip latest.zip
[root@localhost htdocs]# cp -av /root/wordpress/* /usr/local/apache/htdocs/
[root@localhost htdocs]# cp -av wp-config-sample.php wp-config.php
'wp-config-sample.php' -> 'wp-config.php'
mysql> create database wordpress1;
Query OK, 1 row affected (0.01 sec)
[root@localhost mysql]# /usr/local/mysql/bin/mysql -S /data/mysql/mysql3316/run/mysql3316.sock -pMysql@123
mysql> create user 'wp1'@'%' identified by 'Aa&%(&123456';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on wordpress1.* to 'wp1'@'%';
Query OK, 0 rows affected (0.00 sec)
[root@localhost htdocs]# vim wp-config.php
[root@localhost htdocs]# systemctl restart php-fpm
[root@localhost htdocs]# chown -R apache. /usr/local/apache/htdocs/