目录
安装httpd
[root@localhost ~]# cd /etc/yum.repos.d/ //yum源配置 [root@localhost yum.repos.d]# rm -rf * [root@localhost yum.repos.d]# ls [root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2495 100 2495 0 0 7920 0 --:--:-- --:--:-- --:--:-- 7920 [root@localhost yum.repos.d]# ls CentOS-Base.repo [root@localhost yum.repos.d]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo [root@localhost yum.repos.d]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm Failed to set locale, defaulting to C.UTF-8 ······ Installed: epel-release-8-16.el8.noarch Complete! [root@localhost yum.repos.d]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel* [root@localhost yum.repos.d]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel* [root@localhost yum.repos.d]# ls CentOS-Base.repo epel-testing-modular.repo epel.repo epel-modular.repo epel-testing.repo [root@localhost yum.repos.d]# cd [root@localhost ~]# dnf clean all Failed to set locale, defaulting to C.UTF-8 29 files removed [root@localhost ~]# dnf makecache Failed to set locale, defaulting to C.UTF-8 CentOS-8.5.2111 - Base - mirrors.aliyun.com 4.3 MB/s | 4.6 MB 00:01 CentOS-8.5.2111 - Extras - mirrors.aliyun.com 66 kB/s | 10 kB 00:00 CentOS-8.5.2111 - AppStream - mirrors.aliyun.co 9.0 MB/s | 8.4 MB 00:00 Extra Packages for Enterprise Linux 8 - x86_64 6.5 MB/s | 13 MB 00:01 Extra Packages for Enterprise Linux Modular 8 - 1.4 MB/s | 1.0 MB 00:00 Metadata cache created. [root@localhost ~]# [root@localhost ~]# dnf -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ make wget --allowerasing //安装依赖包 Failed to set locale, defaulting to C.UTF-8 ······ Skipped: gcc-8.5.0-4.el8_5.x86_64 glibc-2.28-164.el8.x86_64 glibc-devel-2.28-164.el8.i686 glibc-devel-2.28-164.el8.x86_64 Complete! //创建apache服务的用户和组 [root@localhost ~]# useradd -r -M -s /sbin/nologin apache //下载和安装apr、httpd以及apr-util [root@localhost ~]# wget https://downloads.apache.org/apr/apr-1.7.0.tar.gz https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz https://downloads.apache.org/httpd/httpd-2.4.54.tar.gz --2022-08-02 20:17:42-- https://downloads.apache.org/apr/apr-1.7.0.tar.gz ······ [root@localhost ~]# ls anaconda-ks.cfg apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.54.tar.gz [root@localhost ~]# tar xf apr-1.7.0.tar.gz [root@localhost ~]# tar xf apr-util-1.6.1.tar.gz [root@localhost ~]# ls anaconda-ks.cfg apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz apr-1.7.0 apr-util-1.6.1 httpd-2.4.54.tar.gz [root@localhost ~]# cd apr-1.7.0 [root@localhost apr-1.7.0]# ls CHANGES apr.dsp configure libapr.mak strings CMakeLists.txt apr.dsw configure.in libapr.rc support LICENSE apr.mak docs locks tables Makefile.in apr.pc.in dso memory test Makefile.win apr.spec emacs-mode misc threadproc NOTICE atomic encoding mmap time NWGNUmakefile build file_io network_io tools README build-outputs.mk helpers passwd user README.cmake build.conf include poll apr-config.in buildconf libapr.dep random apr.dep config.layout libapr.dsp shmem [root@localhost apr-1.7.0]# vim configure # $RM "$cfgfile" //将此行加上注释,或者删除此行 [root@localhost apr-1.7.0]# ./configure --prefix=/usr/local/apr ······ [root@localhost apr-1.7.0]# make ······ [root@localhost apr-1.7.0]# make install ······ [root@localhost apr-1.7.0]# cd ../apr-util-1.6.1 [root@localhost apr-util-1.6.1]# ls CHANGES aprutil.dep configure.in libaprutil.mak CMakeLists.txt aprutil.dsp crypto libaprutil.rc LICENSE aprutil.dsw dbd memcache Makefile.in aprutil.mak dbm misc Makefile.win apu-config.in docs redis NOTICE buckets encoding renames_pending NWGNUmakefile build export_vars.sh.in strmatch README build-outputs.mk hooks test README.FREETDS build.conf include uri README.cmake buildconf ldap xlate apr-util.pc.in config.layout libaprutil.dep xml apr-util.spec configure libaprutil.dsp [root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr ······ [root@localhost apr-util-1.6.1]# make ······ [root@localhost apr-util-1.6.1]# make install ······ [root@localhost apr-util-1.6.1]# cd [root@localhost ~]# ls /usr/local/ apr apr-util bin etc games include lib lib64 libexec sbin share src [root@localhost ~]# tar xf httpd-2.4.54.tar.gz //编译httpd [root@localhost ~]# cd httpd-2.4.54 [root@localhost httpd-2.4.54]# ls ABOUT_APACHE LICENSE VERSIONING docs modules Apache-apr2.dsw Makefile.in acinclude.m4 emacs-style os Apache.dsw Makefile.win ap.d httpd.dep server BuildAll.dsp NOTICE apache_probes.d httpd.dsp srclib BuildBin.dsp NWGNUmakefile build httpd.mak support CHANGES README buildconf httpd.spec test CMakeLists.txt README.CHANGES changes-entries include INSTALL README.cmake config.layout libhttpd.dep InstallBin.dsp README.platforms configure libhttpd.dsp LAYOUT ROADMAP configure.in libhttpd.mak [root@localhost httpd-2.4.54]# ./configure --prefix=/usr/local/apache --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --enable-modules=most --enable-mpms-shared=all ······ configure: summary of build options: Server Version: 2.4.54 Install prefix: /usr/local/apache C compiler: gcc CFLAGS: -g -O2 -pthread CPPFLAGS: -DLINUX -D_REENTRANT -D_GNU_SOURCE LDFLAGS: LIBS: C preprocessor: gcc -E [root@localhost httpd-2.4.54]# make ······ [root@localhost httpd-2.4.54]# make install ······ [root@localhost ~]# echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/httpd.sh //安装后配置 [root@localhost ~]# cat /etc/profile.d/httpd.sh export PATH=/usr/local/apache/bin:$PATH [root@localhost ~]# ls /usr/local/ apache apr-util etc include lib64 sbin src apr bin games lib libexec share [root@localhost ~]# source /etc/profile.d/httpd.sh [root@localhost ~]# which httpd /usr/local/apache/bin/httpd [root@localhost ~]# ls /usr/local/apache/ bin cgi-bin error icons logs manual build conf htdocs include man modules [root@localhost ~]# ln -s /usr/local/apache/include/ /usr/include/apache [root@localhost ~]# vim /etc/man_db.conf 23 MANDATORY_MANPATH /usr/local/apache/man [root@localhost ~]# cd /usr/lib/systemd/system //写service文件方式启动apache [root@localhost system]# cp sshd.service httpd.service [root@localhost system]# vim httpd.service [Unit] Description=web server daemon Documentation=man:httpd(5) After=network.target sshd-keygen.target [Service] Type=forking ExecStart=/usr/local/apache/bin/apachectl start ExecReload=/bin/kill -HUP $MAINPID ExecStop=/usr/local/apache/bin/apachectl stop [Install] WantedBy=multi-user.target [root@localhost system]# cd [root@localhost ~]# systemctl daemon-reload [root@localhost ~]# systemctl status httpd httpd.service - web server daemon Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor pres> Active: inactive (dead) Docs: man:httpd(5) [root@localhost ~]# systemctl start httpd [root@localhost ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 [::]:22 [::]:* LISTEN 0 128 *:80 *:* [root@localhost ~]# systemctl enable httpd Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service /usr/lib/systemd/system/httpd.service. [root@localhost ~]# systemctl status httpd ● httpd.service - web server daemon Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor prese> Active: active (running) since Tue 2022-08-02 20:54:16 CST; 2min 1s ago Docs: man:httpd(5) Main PID: 173478 (httpd) Tasks: 82 (limit: 5748) Memory: 14.7M CGroup: /system.slice/httpd.service ├─173478 /usr/local/apache/bin/httpd -k start ├─173479 /usr/local/apache/bin/httpd -k start ├─173480 /usr/local/apache/bin/httpd -k start └─173481 /usr/local/apache/bin/httpd -k start Aug 02 20:54:16 localhost.localdomain systemd[1]: Starting web server daemon... Aug 02 20:54:16 localhost.localdomain apachectl[173477]: AH00558: httpd: Could > Aug 02 20:54:16 localhost.localdomain systemd[1]: Started web server daemon.
安装MySQL
[root@localhost ~]# dnf -y install ncurses-devel openssl-devel openssl cmake mariadb-devel //安装依赖包 Failed to set locale, defaulting to C.UTF-8 ······ ncurses-devel-6.1-9.20180224.el8.x86_64 Complete! [root@localhost ~]# useradd -r -M -s /sbin/nologin mysql //创建用户和组 [root@localhost ~]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz //下载二进制格式的mysql软件包 [root@localhost ~]# cd /usr/src [root@localhost src]# ls debug kernels mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz [root@localhost src]# tar xf mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz -C /usr/local/ //解压至/usr/local/ [root@localhost src]# cd /usr/local/ [root@localhost local]# ls apache bin include libexec share apr etc lib mysql-5.7.38-linux-glibc2.12-x86_64 src apr-util games lib64 sbin [root@localhost local]# mv mysql-5.7.38-linux-glibc2.12-x86_64 mysql [root@localhost local]# ls apache apr-util etc include lib64 mysql share apr bin games lib libexec sbin src [root@localhost local]# chown -R mysql.mysql mysql //修改属主属组 [root@localhost local]# ll total 0 drwxr-xr-x. 14 root root 164 Aug 2 20:43 apache drwxr-xr-x. 6 root root 58 Aug 2 20:31 apr drwxr-xr-x. 5 root root 43 Aug 2 20:35 apr-util drwxr-xr-x. 2 root root 6 Jun 22 2021 bin drwxr-xr-x. 2 root root 6 Jun 22 2021 etc drwxr-xr-x. 2 root root 6 Jun 22 2021 games drwxr-xr-x. 2 root root 6 Jun 22 2021 include drwxr-xr-x. 2 root root 6 Jun 22 2021 lib drwxr-xr-x. 3 root root 17 Jul 18 09:57 lib64 drwxr-xr-x. 2 root root 6 Jun 22 2021 libexec drwxr-xr-x. 9 mysql mysql 129 Aug 2 21:12 mysql drwxr-xr-x. 2 root root 6 Jun 22 2021 sbin drwxr-xr-x. 5 root root 49 Jul 18 09:57 share drwxr-xr-x. 2 root root 6 Jun 22 2021 src [root@localhost local]# ls mysql/ //添加环境变量 LICENSE README bin docs include lib man share support-files [root@localhost local]# ln -s /usr/local/mysql/include/ /usr/include/mysql [root@localhost local]# echo '/usr/local/mysql/lib' > /etc/ld.so.conf.d/mysql.conf [root@localhost local]# vim /etc/man_db.conf MANDATORY_MANPATH /usr/local/mysql/man [root@localhost local]# cd [root@localhost ~]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh [root@localhost ~]# source /etc/profile.d/mysql.sh [root@localhost ~]# which mysql /usr/local/mysql/bin/mysql [root@localhost ~]# mkdir -p /opt/data //建立数据存放目录 [root@localhost ~]# chown -R mysql.mysql /opt/data [root@localhost ~]# mysqld --initialize --user mysql --datadir /opt/data //初始化数据库 2022-08-02T13:22:55.305739Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2022-08-02T13:22:55.488895Z 0 [Warning] InnoDB: New log files created, LSN=45790 2022-08-02T13:22:55.516278Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. 2022-08-02T13:22:55.572894Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 381ccbb3-1266-11ed-902d-000c29eef386. 2022-08-02T13:22:55.573570Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2022-08-02T13:22:55.777643Z 0 [Warning] A deprecated TLS version TLSv1 is enabled. Please use TLSv1.2 or higher. 2022-08-02T13:22:55.777654Z 0 [Warning] A deprecated TLS version TLSv1.1 is enabled. Please use TLSv1.2 or higher. 2022-08-02T13:22:55.778064Z 0 [Warning] CA certificate ca.pem is self signed. 2022-08-02T13:22:55.852699Z 1 [Note] A temporary password is generated for root@localhost: =<lUYR0pFjOj [root@localhost ~]# echo '=<lUYR0pFjOj' > pass [root@localhost ~]# rpm -qa | grep mariadb //卸载mariadb包,避免冲突 mariadb-connector-c-3.1.11-2.el8_3.x86_64 mariadb-connector-c-config-3.1.11-2.el8_3.noarch mariadb-devel-10.3.28-1.module_el8.3.0+757+d382997d.x86_64 mariadb-connector-c-devel-3.1.11-2.el8_3.x86_64 [root@localhost ~]# dnf -y remove mariadb* ······ [root@localhost ~]# vim /etc/my.cnf //生成配置文件 [mysqld] basedir = /usr/local/mysql datadir = /opt/data socket = /tmp/mysql.sock port = 3306 pid-file = /opt/data/mysql.pid user = mysql skip-name-resolve [root@localhost ~]# cd /usr/local/mysql/ //配置服务启动脚本 [root@localhost mysql]# ls LICENSE README bin docs include lib man share support-files [root@localhost mysql]# cd support-files/ [root@localhost support-files]# ls magic mysql-log-rotate mysql.server mysqld_multi.server [root@localhost support-files]# file mysql.server mysql.server: POSIX shell script, ASCII text executable [root@localhost support-files]# cp mysql.server /etc/init.d/mysqld [root@localhost support-files]# vim /etc/init.d/mysqld 46 basedir=/usr/local/mysql 47 datadir=/opt/data [root@localhost support-files]# chmod +x /etc/init.d/mysqld [root@localhost ~]# service mysqld start //启动mysql并设为开机自启 Starting MySQL.Logging to '/opt/data/localhost.localdomain.err'. SUCCESS! [root@localhost ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 [::]:22 [::]:* LISTEN 0 80 *:3306 *:* LISTEN 0 128 *:80 *:* [root@localhost ~]# chkconfig --add mysqld [root@localhost ~]# chkconfig --list Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'. mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@localhost ~]# dnf install -y ncurses-compat-libs //登录mysql并修改密码 Failed to set locale, defaulting to C.UTF-8 ······ [root@localhost ~]# cat pass U!NTYsetOTSE [root@localhost ~]# mysql -uroot -p'U!NTYsetOTSE' mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.38 Copyright (c) 2000, 2022, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> set password = password('123com'); Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> quit Bye
安装PHP
[root@localhost ~]# wget https://www.php.net/distributions/php-7.4.30.tar.xz //下载php --2022-08-02 21:55:54-- https://www.php.net/distributions/php-7.4.30.tar.xz Resolving www.php.net (www.php.net)... 185.85.0.29, 2a02:cb40:200::1ad Connecting to www.php.net (www.php.net)|185.85.0.29|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 10419136 (9.9M) [application/octet-stream] Saving to: 'php-7.4.30.tar.xz' php-7.4.30.tar.xz 100%[===================>] 9.94M 1.67MB/s in 6.9s 2022-08-02 21:56:02 (1.44 MB/s) - 'php-7.4.30.tar.xz' saved [10419136/10419136] [root@localhost ~]# ls anaconda-ks.cfg apr-util-1.6.1 httpd-2.4.54.tar.gz apr-1.7.0 apr-util-1.6.1.tar.gz pass apr-1.7.0.tar.gz httpd-2.4.54 php-7.4.30.tar.xz [root@localhost ~]# sha256sum php-7.4.30.tar.xz ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d php-7.4.30.tar.xz //安装依赖包 [root@localhost ~]# dnf -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel openldap-devel pcre-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel mhash mhash-devel php-mysqlnd --allowerasing --skip-broken --nobest ······ [root@localhost ~]# tar xf php-7.4.30.tar.xz //编译安装php并安装所需依赖包 [root@localhost ~]# cd php-7.4.30 [root@localhost ~]# dnf -y install libsqlite3x-devel libxml2-devel libzip-devel [root@localhost ~]# dnf -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm [root@localhost php-7.4.30]# ./configure --prefix=/usr/local/php7 \ > --with-config-file-path=/etc \ > --enable-fpm \ > --enable-inline-optimization \ > --disable-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-json \ > --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-posix ······ +--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+ Thank you for using PHP. [root@localhost php-7.4.30]# make ······ Build complete. Don't forget to run 'make test'. [root@localhost php-7.4.30]# make install ······ [root@localhost ~]# cd php-7.4.30 //安装后配置 [root@localhost php-7.4.30]# echo 'export PATH=/usr/local/php7/bin:$PATH' > /etc/profile.d/php7.sh [root@localhost php-7.4.30]# source /etc/profile.d/php7.sh [root@localhost php-7.4.30]# which php /usr/local/php7/bin/php [root@localhost php-7.4.30]# php -v PHP 7.4.30 (cli) (built: Aug 2 2022 22:44:01) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies [root@localhost php-7.4.30]# [root@localhost php-7.4.30]# cp php.ini-production /etc/php.ini //配置php-fpm cp: overwrite '/etc/php.ini'? y [root@localhost php-7.4.30]# cd sapi/ [root@localhost sapi]# ls apache2handler cgi cli embed fpm litespeed phpdbg [root@localhost sapi]# cd fpm/ [root@localhost fpm]# ls CREDITS init.d.php-fpm php-fpm.conf status.html.in LICENSE init.d.php-fpm.in php-fpm.conf.in tests Makefile.frag php-fpm php-fpm.service www.conf config.m4 php-fpm.8 php-fpm.service.in www.conf.in fpm php-fpm.8.in status.html [root@localhost fpm]# file init.d.php-fpm init.d.php-fpm: POSIX shell script, ASCII text executable [root@localhost fpm]# cp init.d.php-fpm /etc/init.d/php-fpm [root@localhost fpm]# chmod +x /etc/init.d/php-fpm [root@localhost ~]# cd /usr/local/php7/ [root@localhost php7]# ls bin etc include lib php sbin var [root@localhost php7]# cd etc/ [root@localhost etc]# ls pear.conf php-fpm.conf.default php-fpm.d [root@localhost etc]# cp php-fpm.conf.default php-fpm.conf [root@localhost etc]# ls pear.conf php-fpm.conf php-fpm.conf.default php-fpm.d [root@localhost etc]# cd php-fpm.d/ [root@localhost php-fpm.d]# ls www.conf.default [root@localhost php-fpm.d]# cp www.conf.default www.conf [root@localhost php-fpm.d]# ls www.conf www.conf.default [root@localhost php-fpm.d]# service php-fpm start //启动php-fpm并设为开机自启 Starting php-fpm done [root@localhost php-fpm.d]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 127.0.0.1:9000 0.0.0.0:* LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 80 *:3306 *:* LISTEN 0 128 *:80 *:* LISTEN 0 128 [::]:22 [::]:* [root@localhost php-fpm.d]# cd [root@localhost ~]# chkconfig --add php-fpm [root@localhost ~]# chkconfig --list Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'. mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off php-fpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@localhost ~]# reboot //重启验证 [root@localhost ~]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 127.0.0.1:9000 0.0.0.0:* LISTEN 0 128 *:80 *:* LISTEN 0 128 [::]:22 [::]:* LISTEN 0 80 *:3306 *:*