centos7配置web服务器

centos7配置web服务器

准备

环境:
  • ​ VMware Workstation Pro
  • ​ Linux/CentOS-7-x86_64-DVD-2009.iso

​ 安装省略(有手就行)

配置静态ip

前期

安装成功后登录账号密码,先ping一下百度看看是否能上网

ping www.baidu.com

如下图表示:无法上网

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-J4EWXBaW-1636434439191)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014152251840.png)]

不急,康康网卡信息

ifconfig

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-W2KRg3O0-1636434439193)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014152700371.png)]

漂亮,没有这个命令。现在没网也安装不了

天无绝人之路

直接去到/etc/sysconfig/network-scripts下,centos7网卡位置

cd /etc/sysconfig/network-scripts
ls

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-wvDmOmmP-1636434439193)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014153828408.png)]

如上图:第一个 ifcfg-ens33 就是虚拟网卡,用vi去打开它

vi ifcfg-ens33

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-V6NfxCs4-1636434439195)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014154153624.png)]

发现最后一行ONBOOT=no 表示网卡开机启动关闭了,把他改成yes

同时注意下BOOTPROTO=dhcp表示自动获取ip

按 i 进行修改 :只改ONBOOT=yes
改好后按Esc退出insert模式
继续shift+:进入命令模式 
wq保存退出

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-d2cVRmDL-1636434439196)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014154922131.png)]

然后重启

reboot

保存修改,并重启后在ping,如下图:表示能上网

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-CT2MwWMB-1636434439197)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014151628371.png)]

注意:ping通后 Ctrl+c停止</

接下来安装个ifconfig试试网

先看看ifconfig在那个包中

yum search ifconfig

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-8Bp1xZyM-1636434439198)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014160446554.png)]

可以看到在net-tools.x86_64这个包中,接下来安装这个包

yum install net-tools.x86_64

中间会按几次y确认继续安装

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-rfIV4T7h-1636434439200)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014160807762.png)]

安装好了,可以试试查看下网卡信息

ifconfig

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-22HxfUmE-1636434439200)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014161127465.png)]

可以看到ens33网卡,第二行的ip network,其中这个ip192.168.64.138是动态的每次开机都不一样,接下来我们把它变成静态的

配置

配置静态ip得先知道自己电脑的ip ,网关,子网掩码

win+r
输入cmd回车
输入ipconfig回车

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-frrhdFBi-1636434439202)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014162109747.png)]

可以看到:

IPv4=192.168.31.172

子网掩码=255.255.255.0

网关=192.168.31.1

记住等下得用

把上网模式改为桥接

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Cu550LbW-1636434439203)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014164028941.png)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Af6srPUJ-1636434439204)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014164001711.png)]

进入到ens33编辑

cd /etc/sysconfig/network-scripts
vi ifcfg-ens33

改前

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=b181f626-d21a-4ace-815e-44c6d054ab9c
DEVICE=ens33
ONBOOT=yes

改后

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static //改为静态
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=b181f626-d21a-4ace-815e-44c6d054ab9c
DEVICE=ens33
ONBOOT=yes

添加的
IPADDR=192.168.31.200
//IPv4 192.168.31和自己电脑相同后面自己设记住1~254
NETMASK=255.255.255.0//掩码和自己电脑相同
GATEWAY=192.168.31.1//网关和自己电脑相同
DNS1=192.168.31.1//dns和自己电脑相同

然后保存退出重启输入ifconfig查看

ifconfig

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3fKH8C46-1636434439205)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014164325540.png)]

可以看到已经变成我们自己设的了

然后ping 192.168.31.200

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-6bRT7Lsf-1636434439207)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014164513039.png)]

可以ping通

接着ping www.baidu.com

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-8PfEpvbj-1636434439207)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211014164642942.png)]

也可以通,至此配置静态ip完成

如果还是ping不通,试试加上下面步骤

添加网关地址

 vi /etc/sysconfig/network 

修改成如下内容:
NETWORKING=yes
HOSTNAME=xxxx #名字随便了
GATEWAY=192.168.1.1 #默认网关和宿主机相同

添加DNS

vi /etc/resolv.conf 

修改成如下内容:
# Generated by NetworkManager
nameserver 192.168.0.1 #DNS,跟宿主一样

再次重启后ping

安装LAMP(编译安装)

Linux+Apache2.4.46+Mysql+Php7.3

准备(已有跳过)
  • ​ wget工具
  • ​ bzip2工具

安装wget

yum -y install wget

安装bzip2

yum search bzip2  //查询安装包
yum -y install bzip2.x86_64 
安装编译环境
yum install gcc make autoconf gcc-c++ glibc glibc-devel pcre pcre-devel expat-devel
升级openssl

因为httpd2.4.46需要openssl v1.1.1版本。centos7yum仓库的版本太老不支持

查看现有版本

openssl version

[root@localhost ~]# openssl version
OpenSSL 1.0.2k-fips  26 Jan 2017

查看rpm包安装的openssl,如果不是rpm包的则查不到

[root@localhost ~]# rpm -qa | grep -i openssl
openssl-libs-1.0.2k-19.el7.x86_64
xmlsec1-openssl-1.2.20-7.el7_4.x86_64
openssl-1.0.2k-19.el7.x86_64

查询openssl的安装地址

[root@localhost ~]# whereis openssl
openssl: /usr/bin/openssl /usr/lib64/openssl /usr/share/man/man1/openssl.1ssl.gz

我的是在/usr/lib64/路径下面的,不能乱删,否则可能远程就连接不上了,所以我们还是直接升级

下载openssl

wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1h.tar.gz

可能会报错

ERROR: cannot verify www.openssl.org's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
  Issued certificate has expired.
To connect to www.openssl.org insecurely, use `--no-check-certificate'.

那就按他的来

wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1h.tar.gz --no-check-certificate

下载完cd到~下ls就会看到压缩包

cd ~
ls

[root@localhost ~]# ls
anaconda-ks.cfg  openssl-1.1.1h.tar.gz

解压

tar xvf openssl-1.1.1h.tar.gz
完成后
[root@localhost ~]# ls
anaconda-ks.cfg  openssl-1.1.1h  openssl-1.1.1h.tar.gz

编译安装到指定目录/app/openssl下

先cd到openssl-1.1.1h目录,然后指定./config --prefix=安装目录,再编译安装

[root@localhost ~]# cd openssl-1.1.1h
[root@localhost openssl-1.1.1h]# ./config --prefix=/app/openssl
Operating system: x86_64-whatever-linux2
Configuring OpenSSL version 1.1.1h (0x1010108fL) for linux-x86_64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************

[root@localhost openssl-1.1.1h]# make && make install //编译&安装

配置环境

[root@localhost openssl-1.1.1h]# echo "/app/openssl/lib/" >> /etc/ld.so.conf
[root@localhost openssl-1.1.1h]# ldconfig -v
ldconfig: Can't stat /libx32: No such file or directory
ldconfig: Path `/usr/lib' given more than once
ldconfig: Path `/usr/lib64' given more than once
ldconfig: Can't stat /usr/libx32: No such file or directory
/usr/lib64//bind9-export:
        libisccfg-export.so.160 -> libisccfg-export.so.160.2.1
        libisc-export.so.169 -> libisc-export.so.169.0.3
        libirs-export.so.160 -> libirs-export.so.160.0.5
        libdns-export.so.1102 -> libdns-export.so.1102.1.2
/usr/lib64/mysql:
        libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
/app/openssl/lib:
        libssl.so.1.1 -> libssl.so.1.1
        libcrypto.so.1.1 -> libcrypto.so.1.1
/lib:
/lib64:
        libmpfr.so.4 -> libmpfr.so.4.1.1
        libsysfs.so.2 -> libsysfs.so.2.0.1
        libhandle.so.1 -> libhandle.so.1.0.3
        libbtrfs.so.0 -> libbtrfs.so.0.1
        libparted.so.2 -> libparted.so.2.0.0
        libparted-fs-resize.so.0 -> libparted-fs-resize.so.0.0.0
        libvmtools.so.0 -> libvmtools.so.0.0.0
        libvgauth.so.0 -> libvgauth.so.0.0.0
        libhgfs.so.0 -> libhgfs.so.0.0.0
        libguestlib.so.0 -> libguestlib.so.0.0.0
        libDeployPkg.so.0 -> libDeployPkg.so.0.0.0
        libply.so.2 -> libply.so.2.1.0
        libply-splash-core.so.2 -> libply-splash-core.so.2.1.0
        libply-boot-client.so.2 -> libply-boot-client.so.2.1.0
        libdbus-glib-1.so.2 -> libdbus-glib-1.so.2.2.2
        libteamdctl.so.0 -> libteamdctl.so.0.1.5
        libebtc.so -> libebtc.so
        libdrm_radeon.so.1 -> libdrm_radeon.so.1.0.1
        libdrm_nouveau.so.2 -> libdrm_nouveau.so.2.0.0
        libdevmapper-event-lvm2.so.2.02 -> libdevmapper-event-lvm2.so.2.02
        libmpc.so.3 -> libmpc.so.3.0.0
        libjson-c.so.2 -> libjson-c.so.2.0.1
        libpciaccess.so.0 -> libpciaccess.so.0.11.1
        liblvm2app.so.2.2 -> liblvm2app.so.2.2
        libnuma.so.1 -> libnuma.so.1.0.0
        liblvm2cmd.so.2.02 -> liblvm2cmd.so.2.02
        libgpgme.so.11 -> libgpgme.so.11.8.1
        libgpgme-pthread.so.11 -> libgpgme-pthread.so.11.8.1
        libnm.so.0 -> libnm.so.0.1.0
        librpmsign.so.1 -> librpmsign.so.1.2.2
        libcryptsetup.so.12 -> libcryptsetup.so.12.3.0
        librpmbuild.so.3 -> librpmbuild.so.3.2.2
        libomapi.so.0 -> libomapi.so.0.0.0
        libpth.so.20 -> libpth.so.20.0.27
        libdhcpctl.so.0 -> libdhcpctl.so.0.0.0
        libdevmapper-event.so.1.02 -> libdevmapper-event.so.1.02
        libestr.so.0 -> libestr.so.0.0.0
        libdevmapper.so.1.02 -> libdevmapper.so.1.02
        libpipeline.so.1 -> libpipeline.so.1.2.3
        libpolkit-gobject-1.so.0 -> libpolkit-gobject-1.so.0.0.0
        libqrencode.so.3 -> libqrencode.so.3.4.1
        libpolkit-agent-1.so.0 -> libpolkit-agent-1.so.0.0.0
        libmspack.so.0 -> libmspack.so.0.1.0
        libdaemon.so.0 -> libdaemon.so.0.5.0
        libdbus-1.so.3 -> libdbus-1.so.3.14.14
        libprocps.so.4 -> libprocps.so.4.0.0
        libfastjson.so.4 -> libfastjson.so.4.0.0
        libulockmgr.so.1 -> libulockmgr.so.1.0.1
        libudev.so.1 -> libudev.so.1.6.2
        libfuse.so.2 -> libfuse.so.2.9.2
        libsystemd.so.0 -> libsystemd.so.0.6.0
        libasound.so.2 -> libasound.so.2.0.0
        libsystemd-login.so.0 -> libsystemd-login.so.0.9.3
        libopcodes-2.27-44.base.el7.so -> libopcodes-2.27-44.base.el7.so
        libdrm_intel.so.1 -> libdrm_intel.so.1.0.0
        libbfd-2.27-44.base.el7.so -> libbfd-2.27-44.base.el7.so
        libsmartcols.so.1 -> libsmartcols.so.1.1.0
        libuser.so.1 -> libuser.so.1.5.0
        libsystemd-journal.so.0 -> libsystemd-journal.so.0.11.5
        libslapi-2.4.so.2 -> libslapi-2.4.so.2.10.7
        libsgutils2.so.2 -> libsgutils2.so.2.0.0
        libldap_r-2.4.so.2 -> libldap_r-2.4.so.2.10.7
        libsystemd-id128.so.0 -> libsystemd-id128.so.0.0.28
        libldap-2.4.so.2 -> libldap-2.4.so.2.10.7
        libkms.so.1 -> libkms.so.1.0.0
        libjson.so.0 -> libjson.so.0.1.0
        liblber-2.4.so.2 -> liblber-2.4.so.2.10.7
        libsystemd-daemon.so.0 -> libsystemd-daemon.so.0.0.12
        libnss_myhostname.so.2 -> libnss_myhostname.so.2
        librpmio.so.3 -> librpmio.so.3.2.2
        libnss_mymachines.so.2 -> libnss_mymachines.so.2
        librpm.so.3 -> librpm.so.3.2.2
        libdw.so.1 -> libdw-0.176.so
        libcurl.so.4 -> libcurl.so.4.3.0
        libnsssysinit.so -> libnsssysinit.so
        libasm.so.1 -> libasm-0.176.so
        libssl3.so -> libssl3.so
        libdrm.so.2 -> libdrm.so.2.4.0
        libsmime3.so -> libsmime3.so
        libcryptsetup.so.4 -> libcryptsetup.so.4.7.0
        libnss3.so -> libnss3.so
        libdrm_amdgpu.so.1 -> libdrm_amdgpu.so.1.0.0
        libssl.so.10 -> libssl.so.1.0.2k
        libcrypto.so.10 -> libcrypto.so.1.0.2k
        libxmlsec1-openssl.so.1 -> libxmlsec1-openssl.so.1.2.20
        libnsspem.so -> libnsspem.so
        libmount.so.1 -> libmount.so.1.1.0
        libkrb5support.so.0 -> libkrb5support.so.0.1
        libutempter.so.0 -> libutempter.so.1.1.6
        libkrb5.so.3 -> libkrb5.so.3.3
        libgirepository-1.0.so.1 -> libgirepository-1.0.so.1.0.0
        libkrad.so.0 -> libkrad.so.0.0
        libkdb5.so.8 -> libkdb5.so.8.0
        libk5crypto.so.3 -> libk5crypto.so.3.1
        libgettextpo.so.0 -> libgettextpo.so.0.5.4
        libgettextsrc-0.19.8.1.so -> libgettextsrc-0.19.8.1.so
        libgssrpc.so.4 -> libgssrpc.so.4.2
        libgssapi_krb5.so.2 -> libgssapi_krb5.so.2.2
        libasprintf.so.0 -> libasprintf.so.0.0.0
        p11-kit-trust.so -> libnssckbi.so
        libgettextlib-0.19.8.1.so -> libgettextlib-0.19.8.1.so
        libtasn1.so.6 -> libtasn1.so.6.5.3
        libsemanage.so.1 -> libsemanage.so.1
        libsasl2.so.3 -> libsasl2.so.3.0.0
        libcrack.so.2 -> libcrack.so.2.9.0
        libustr-1.0.so.1 -> libustr-1.0.so.1.0.4
        libpamc.so.0 -> libpamc.so.0.82.1
        libverto.so.1 -> libverto.so.1.0.0
        libpam_misc.so.0 -> libpam_misc.so.0.82.0
        libndp.so.0 -> libndp.so.0.0.0
        libfipscheck.so.1 -> libfipscheck.so.1.2.1
        libpython2.7.so.1.0 -> libpython2.7.so.1.0
        libcpupower.so.0 -> libcpupower.so.0.0.0
        libpam.so.0 -> libpam.so.0.83.1
        libsnappy.so.1 -> libsnappy.so.1.1.4
        libpwquality.so.1 -> libpwquality.so.1.0.2
        libgmpxx.so.4 -> libgmpxx.so.4.4.0
        libgmp.so.10 -> libgmp.so.10.2.0
        libmozjs-17.0.so -> libmozjs-17.0.so
        libcroco-0.6.so.3 -> libcroco-0.6.so.3.0.1
        libedit.so.0 -> libedit.so.0.0.42
        libblkid.so.1 -> libblkid.so.1.1.0
        libfreetype.so.6 -> libfreetype.so.6.14.0
        libgthread-2.0.so.0 -> libgthread-2.0.so.0.5600.1
        libpng15.so.15 -> libpng15.so.15.13.0
        libgobject-2.0.so.0 -> libgobject-2.0.so.0.5600.1
        libss.so.2 -> libss.so.2.0
        libssh2.so.1 -> libssh2.so.1.0.1
        libgmodule-2.0.so.0 -> libgmodule-2.0.so.0.5600.1
        libipset.so.13 -> libipset.so.13.1.0
        libglib-2.0.so.0 -> libglib-2.0.so.0.5600.1
        libteam.so.5 -> libteam.so.5.6.0
        libgio-2.0.so.0 -> libgio-2.0.so.0.5600.1
        libnl-cli-3.so.200 -> libnl-cli-3.so.200.23.0
        libassuan.so.0 -> libassuan.so.0.4.0
        libxmlsec1.so.1 -> libxmlsec1.so.1.2.20
        libip4tc.so.0 -> libip4tc.so.0.1.0
        libpci.so.3 -> libpci.so.3.5.1
        libaio.so.1.0.0 -> libaio.so.1.0.0
        libaio.so.1 -> libaio.so.1.0.1
        libxtables.so.10 -> libxtables.so.10.0.0
        libnewt.so.0.52 -> libnewt.so.0.52.15
        libltdl.so.7 -> libltdl.so.7.3.0
        libslang.so.2 -> libslang.so.2.2.4
        libmnl.so.0 -> libmnl.so.0.1.0
        libmagic.so.1 -> libmagic.so.1.0.0
        libkeyutils.so.1 -> libkeyutils.so.1.5
        libxslt.so.1 -> libxslt.so.1.1.28
        liblz4.so.1 -> liblz4.so.1.8.3
        libexslt.so.0 -> libexslt.so.0.8.17
        libgdbm_compat.so.4 -> libgdbm_compat.so.4.0.0
        libnetfilter_conntrack.so.3 -> libnetfilter_conntrack.so.3.6.0
        libnl-xfrm-3.so.200 -> libnl-xfrm-3.so.200.23.0
        libnl-route-3.so.200 -> libnl-route-3.so.200.23.0
        libp11-kit.so.0 -> libp11-kit.so.0.3.0
        libnl-nf-3.so.200 -> libnl-nf-3.so.200.23.0
        libgdbm.so.4 -> libgdbm.so.4.0.0
        libsoftokn3.so -> libsoftokn3.so
        libnl-idiag-3.so.200 -> libnl-idiag-3.so.200.23.0
        libnl-genl-3.so.200 -> libnl-genl-3.so.200.23.0
        liblzo2.so.2 -> liblzo2.so.2.0.0
        libnl-3.so.200 -> libnl-3.so.200.23.0
        liblua-5.1.so -> liblua-5.1.so
        libwrap.so.0 -> libwrap.so.0.7.6
        libsqlite3.so.0 -> libsqlite3.so.0.8.6
        libnfnetlink.so.0 -> libnfnetlink.so.0.2.0
        libexpat.so.1 -> libexpat.so.1.6.0
        libjansson.so.4 -> libjansson.so.4.10.0
        libffi.so.6 -> libffi.so.6.0.1
        libiptc.so.0 -> libiptc.so.0.0.0
        libidn.so.11 -> libidn.so.11.6.11
        libauparse.so.0 -> libauparse.so.0.0.0
        libunistring.so.0 -> libunistring.so.0.1.2
        libaudit.so.1 -> libaudit.so.1.0.0
        libgomp.so.1 -> libgomp.so.1.0.0
        libcap-ng.so.0 -> libcap-ng.so.0.0.0
        libkmod.so.2 -> libkmod.so.2.2.10
        libcap.so.2 -> libcap.so.2.22
        libip6tc.so.0 -> libip6tc.so.0.1.0
        libext2fs.so.2 -> libext2fs.so.2.4
        libgcrypt.so.11 -> libgcrypt.so.11.8.2
        libe2p.so.2 -> libe2p.so.2.3
        libnssdbm3.so -> libnssdbm3.so
        libhistory.so.6 -> libhistory.so.6.2
        libreadline.so.6 -> libreadline.so.6.2
        libgpg-error.so.0 -> libgpg-error.so.0.10.0
        libstdc++.so.6 -> libstdc++.so.6.0.19
        libnssutil3.so -> libnssutil3.so
        libplds4.so -> libplds4.so
        libdb-5.3.so -> libdb-5.3.so
        libplc4.so -> libplc4.so
        libnspr4.so -> libnspr4.so
        libpopt.so.0 -> libpopt.so.0.0.0
        libpcprofile.so -> libpcprofile.so
        libselinux.so.1 -> libselinux.so.1
        libthread_db.so.1 -> libthread_db-1.0.so
        librt.so.1 -> librt-2.17.so
        libz.so.1 -> libz.so.1.2.7
        libpcreposix.so.0 -> libpcreposix.so.0.0.1
        libresolv.so.2 -> libresolv-2.17.so
        libpcrecpp.so.0 -> libpcrecpp.so.0.0.0
        libpthread.so.0 -> libpthread-2.17.so
        libpcre32.so.0 -> libpcre32.so.0.0.0
        libnss_nisplus.so.2 -> libnss_nisplus-2.17.so
        libnss_nis.so.2 -> libnss_nis-2.17.so
        libpcre16.so.0 -> libpcre16.so.0.2.0
        libnss_hesiod.so.2 -> libnss_hesiod-2.17.so
        libformw.so.5 -> libformw.so.5.9
        libpcre.so.1 -> libpcre.so.1.2.0
        libnss_files.so.2 -> libnss_files-2.17.so
        libsepol.so.1 -> libsepol.so.1
        libnss_dns.so.2 -> libnss_dns-2.17.so
        libtic.so.5 -> libtic.so.5.9
        libnss_db.so.2 -> libnss_db-2.17.so
        libtinfo.so.5 -> libtinfo.so.5.9
        libnss_compat.so.2 -> libnss_compat-2.17.so
        libmemusage.so -> libmemusage.so
        libbz2.so.1 -> libbz2.so.1.0.6
        libnsl.so.1 -> libnsl-2.17.so
        libpanelw.so.5 -> libpanelw.so.5.9
        libm.so.6 -> libm-2.17.so
        libuuid.so.1 -> libuuid.so.1.3.0
        libdl.so.2 -> libdl-2.17.so
        libpanel.so.5 -> libpanel.so.5.9
        libcrypt.so.1 -> libcrypt-2.17.so
        libncursesw.so.5 -> libncursesw.so.5.9
        libcidn.so.1 -> libcidn-2.17.so
        libncurses.so.5 -> libncurses.so.5.9
        libc.so.6 -> libc-2.17.so
        libcom_err.so.2 -> libcom_err.so.2.1
        libanl.so.1 -> libanl-2.17.so
        libncurses++w.so.5 -> libncurses++w.so.5.9
        libSegFault.so -> libSegFault.so
        libacl.so.1 -> libacl.so.1.1.0
        libform.so.5 -> libform.so.5.9
        libBrokenLocale.so.1 -> libBrokenLocale-2.17.so
        libattr.so.1 -> libattr.so.1.1.0
        libelf.so.1 -> libelf-0.176.so
        ld-linux-x86-64.so.2 -> ld-2.17.so
        liblzma.so.5 -> liblzma.so.5.2.2
        libfreeblpriv3.so -> libfreeblpriv3.so
        libncurses++.so.5 -> libncurses++.so.5.9
        libfreebl3.so -> libfreebl3.so
        libmenuw.so.5 -> libmenuw.so.5.9
        libmenu.so.5 -> libmenu.so.5.9
        libgcc_s.so.1 -> libgcc_s-4.8.5-20150702.so.1
        libxml2.so.2 -> libxml2.so.2.9.1
        libutil.so.1 -> libutil-2.17.so
/lib/sse2: (hwcap: 0x0000000004000000)
/lib64/sse2: (hwcap: 0x0000000004000000)
/lib64/tls: (hwcap: 0x8000000000000000)

[root@localhost openssl-1.1.1h]# echo 'export PATH=/app/openssl/bin:$PATH' > /etc/profile.d/openssl.sh
[root@localhost openssl-1.1.1h]# . /etc/profile.d/openssl.sh
[root@localhost openssl-1.1.1h]# openssl version
OpenSSL 1.1.1h  22 Sep 2020
升级apr包

这也是最新版httpd的要求不然编译的时候会报错。

下载apr包,解压,配置安装目录,编译&安装

wget https://mirror.dsrg.utoronto.ca/apache//apr/apr-1.7.0.tar.bz2 --no-check-certificate //下载

tar xvf apr-1.7.0.tar.bz2 //解压

cd apr-1.7.0 
./configure --prefix=/usr/local/apr //配置安装目录

make && make install //编译&安装
升级apr-util

下载apr-util包,解压,配置安装目录,编译&安装

wget https://mirror.dsrg.utoronto.ca/apache//apr/apr-util-1.6.1.tar.bz2 --no-check-certificate //下载

tar xvf apr-util-1.6.1.tar.bz2 //解压

cd apr-1.7.0
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
//配置安装目录,关联apr

make && make install //编译&安装
安装httpd

上面的环境升级完后才可进行这一步,不然会报错的。

下载httpd包,解压,配置安装目录,编译&安装

wget https://mirror.its.dal.ca/apache//httpd/httpd-2.4.46.tar.bz2 --no-check-certificate //下载

tar xvf  httpd-2.4.46.tar.bz2 //解压

cd httpd-2.4.46
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util 
//配置安装目录,关联apr apr-util 

make && make install //编译&安装
配置httpd

将httpd服务添加到系统服务

cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

vi /etc/init.d/httpd

#在#!/bin/sh下添加以下两行(注意,"#"不能省略):
 # chkconfig: 2345 10 90 //
 # description: Apache is a World Wide Web Server
 #保存退出

将httpd加入到SERVICE管理器

chkconfig --add httpd
systemctl daemon-reload

编辑httpd主配置文件

vi /usr/local/apache2/conf/httpd.conf
#修改如下内容
ServerName localhost:80
#保存退出

创建软连接

ln -s /usr/local/apache2/bin/* /usr/bin
#检查语法错误
httpd -t

启动httpd服务

systemctl start httpd

验证

#浏览器访问服务器IP,http://192.168.31.200

注意如果访问超时,先关闭防火墙

防火墙开/关

firewall-cmd --state  #查看防火墙
systemctl status firewalld #查看防火墙
systemctl stop firewalld #临时关闭防火墙
systemctl start firewalld #临时打开防火墙
systemctl disable firewalld #开机禁止启动防火墙
systemctl enable firewalld #开机启动防火墙

成功就能看到

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-yNNarPRu-1636434439209)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211015125943332.png)]

安装Mysql
源码编译安装(整了半天就卡在boost,然后采取二进制安装)
#下载
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-8.0.17.tar.gz --no-check-certificate 
#
tar xf mysql-boost-8.0.17.tar.gz 
#
cd mysql-8.0.17
#
groupadd mysql
#
useradd -g mysql  mysql -M  -s /sbin/nologin
#
yum install cmake ncurses-devel  autoconf
#configure.cmake编译的(他的功能相当于./configure)
cmake 
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql 
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock 
-DMYSQL_USER=mysql 
-DDEFAULT_CHARSET=utf8 
-DDEFAULT_COLLATION=utf8_general_ci 
-DWITH_MYISAM_STORAGE_ENGINE=1 
-DWITH_INNOBASE_STORAGE_ENGINE=1 
-DWITH_DEBUG=0 
-DWITH_READLINE=1 
-DWITH_EMBEDDED_SERVER=1 
-DENABLED_LOCAL_INFILE=1 
-DFORCE_INSOURCE_BUILD=1
#
make && make isntall

如果在cmake这步报错,就是yum安装的版本低了

-- Please install cmake3 (yum install cmake3)
CMake Error at CMakeLists.txt:73 (CMAKE_MINIMUM_REQUIRED):
  CMake 3.5.1 or higher is required.  You are running version 2.8.12.2

解决:删掉装更新的

移除旧版本:
	yum remove cmake
下载新版本:
	wget https://cmake.org/files/v3.6/cmake-3.6.0-Linux-x86_64.tar.gz
解压:(注意:这个压缩包不是源码包,解压后直接用。)
	tar -zxvf cmake-3.6.0-Linux-x86_64.tar.gz
增加环境变量,使其成为全局变量:
	vi /etc/profile
在文件末尾处增加以下代码(注意:写自己刚安装cmake的bin的路径)
	export PATH=$PATH:/usr/local/cmake-3.6.0-Linux-x86_64/bin
使修改的文件生效
	source /etc/profile
查看环境变量:
	echo $PATH
检查cmake版本:
	cmake --version

再次执行camke:报如下错误

CMake Error at CMakeLists.txt:340 (MESSAGE):
  Please do not build in-source.  Out-of source builds are highly
  recommended: you can have multiple builds for the same source, and there is
  an easy way to do cleanup, simply remove the build directory (note that
  'make clean' or 'make distclean' does *not* work)

  You *can* force in-source build by invoking cmake with
  -DFORCE_INSOURCE_BUILD=1


-- Configuring incomplete, errors occurred!
See also "/root/mysql-8.0.17/CMakeFiles/CMakeOutput.log".

他建议我们加一条-DFORCE_INSOURCE_BUILD=1,那就加

cmake 
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql 
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock 
-DMYSQL_USER=mysql 
-DDEFAULT_CHARSET=utf8 
-DDEFAULT_COLLATION=utf8_general_ci 
-DWITH_MYISAM_STORAGE_ENGINE=1 
-DWITH_INNOBASE_STORAGE_ENGINE=1 
-DWITH_DEBUG=0 
-DWITH_READLINE=1 
-DWITH_EMBEDDED_SERVER=1 
-DENABLED_LOCAL_INFILE=1  
-DFORCE_INSOURCE_BUILD=1  

又报如下错误

-- Running cmake version 3.6.0
-- Could NOT find Git (missing:  GIT_EXECUTABLE)
-- MySQL 8.0.17
-- Source directory /root/mysql-8.0.17
-- Binary directory /root/mysql-8.0.17
CMake Warning at CMakeLists.txt:338 (MESSAGE):
  This is an in-source build


-- CMAKE_GENERATOR: Unix Makefiles
CMake Error at cmake/os/Linux.cmake:59 (MESSAGE):
  GCC 5.3 or newer is required (-dumpversion says 4.8.5)
Call Stack (most recent call first):
  CMakeLists.txt:424 (INCLUDE)


-- Configuring incomplete, errors occurred!
See also "/root/mysql-8.0.17/CMakeFiles/CMakeOutput.log".

解决CMake Error at cmake/os/Linux.cmake:59 (MESSAGE):
GCC 5.3 or newer is required (-dumpversion says 4.8.5)

gcc --version
自带的是这个:
	gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
报错让装5.3以上,那就
安装devtoolset-8(使用高版本gcc (GCC) 8.3.1 20190311
	yum install centos-release-scl -y
	yum install devtoolset-8 -y
启用devtoolset-8
	scl enable devtoolset-8 -- bash
	source /opt/rh/devtoolset-8/enable
再次康康版本:
	[root@localhost ~]# gcc --version
	gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
	Copyright (C) 2018 Free Software Foundation, Inc.
	This is free software; see the source for copying      conditions.  There is NO
	warranty; not even for MERCHANTABILITY or FITNESS FOR A 	PARTICULAR PURPOSE.

再继续cmake,有报如下错误

CMake Error at cmake/boost.cmake:76 (MESSAGE):
  You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>
 
  This CMake script will look for boost in <directory>.  If it is not there,
  it will download and unpack it (in that directory) for you.
 
  If you are inside a firewall, you may need to use an http proxy:
 
  export http_proxy=http://example.com:80
 
Call Stack (most recent call first):
  cmake/boost.cmake:228 (COULD_NOT_FIND_BOOST)
  CMakeLists.txt:435 (INCLUDE)

说没有boots那就装呗

下载地址:
	https://www.boost.org/users/download/
网上教程我试了试没出来:
	https://www.cnblogs.com/smallredness/p/9245127.html
最后实现方法:
	解压
	tar xvf  boost_1_77_0.tar.bz2 
	cd但解压后目录
	cd boost_1_77_0
	然后一系列安装
	./bootstrap.sh --prefix=/usr/local/boost
	./b2 install
	cd tools/build
	./bootstrap.sh
	./b2 install --prefix=/usr/local/boost

再次cmake

cmake 
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql 
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock 
-DMYSQL_USER=mysql 
-DDEFAULT_CHARSET=utf8 
-DDEFAULT_COLLATION=utf8_general_ci 
-DWITH_MYISAM_STORAGE_ENGINE=1 
-DWITH_INNOBASE_STORAGE_ENGINE=1 
-DWITH_DEBUG=0 
-DWITH_READLINE=1 
-DWITH_EMBEDDED_SERVER=1 
-DENABLED_LOCAL_INFILE=1  
-DFORCE_INSOURCE_BUILD=1  
-DDOWNLOAD_BOOST=1 
-DWITH_BOOST=/usr/local/boost

还是搞不出来,于是换二进制安装

MySQL二进制安装

网上教程:CentOS7下MySQL8的二进制基本安装配置 - 尘埃看世界 - 博客园 (cnblogs.com)

官网下载
https://dev.mysql.com/downloads/mysql/
传到/usr/local下
解压
	tar xvf mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz
改目录名
	mv mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz mysql-8.0.26
#创建mysql用户组,
	groupadd mysql
#指定mysql用户属于mysql组
	useradd -g mysql mysql
#修改用户mysql的密码(自己设定),回车后输入密码
	passwd mysql
#给予安装目录mysql权限
	chown -R mysql:mysql /usr/local/mysql-8.0.26
#创建和设置配置文件my.cnf
	touch /etc/my.cnf
	vi /etc/my.cnf

在配置文件my.cnf添加如下配置(注意注意:别打错单词了,我就试过差点怀疑人生)

[mysql]

# 设置mysql客户端默认字符集

default-character-set=utf8

[mysqld]

skip-name-resolve

#设置3306端口

port = 3306

# 设置mysql的安装目录
basedir=/usr/local/mysql-8.0.26
# 设置mysql数据库的数据的存放目录
datadir=/usr/local/mysql-8.0.26/data
# 允许最大连接数
max_connections=200
# 服务端使用的字符集默认为8比特编码的latin1字符集
character-set-server=utf8
# 创建新表时将使用的默认存储引擎
"/etc/my.cnf" 26L, 548C
#赋my.cnf文件mysql权限
	chown mysql:mysql /etc/my.cnf
#mysql初始化配置
#切换到mysql用户权限
	su mysql
#初始化生成data目录(切记不要手动创建data目录)(补充:mysql用户下初始化不成功(没有生成密码),用root用户来操作,最后记得把生成data目录赋予mysql用户)
	/usr/local/mysql/bin/mysqld --initialize

初始化完成后,仔细看提示,会自动生成mysql数据库登陆密码,记好

#此时在mysql目录下会生成data目录,但权限只有750,要追加到755
	chmod 755 /usr/local/mysql-8.0.26/data
  (或者 chmod o+r+x /usr/local/mysql-8.0.26/data)

软连接与开机启动项设置

#创建软连接(实现可直接命令行执行mysql)
	ln -s /usr/local/mysql-8.0.26/bin/mysql /usr/bin
#mysqld配置,拷贝启动文件到/etc/init.d/目录下并重命令为mysqld
	cp /usr/local/mysql-8.0.26/support-files/mysql.server /etc/init.d/mysqld
#检查自启动项列表中有没有mysqld
	chkconfig --list mysqld
#如果没有就添加mysqld
	chkconfig mysqld on
#启动测试
	service mysqld start

登录mysql修改密码

#登录mysql,前面最新的密码就派上用场了
	mysql -u root -p
	set password='Aa123456';
Navicat for MySQL连接虚拟机上的MySQL

创建任意用户,用于远程访问

create user 'root'@'%'  identified  with mysql _native_password by '123456';

查看用户

use mysql;
select user,host from user;

给与授权

grant all privileges on *.* to 'root'@'%' with grant option;    

通过相关问题查阅,发现是由于navicat版本的问题造成连接失败。mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password,所以输入命令修改加密规则:

查看加密规则

select user,host,plugin from user where user='root';

+----------+------+-----------------------+
| user     | host | plugin                |
+----------+------+-----------------------+
| root     | %    | caching_sha2_password |
+----------+------+-----------------------+
1 row in set (0.00 sec)

修改加密规则

ALTER USER 'root'@'%' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '1234567';

刷新权限,使修改生效

FLUSH PRIVILEGES; 

查看表中相关信息,确认修改是否真正生效

select user,host,plugin from user where user='root';

+----------+------+-----------------------+
| user     | host | plugin                |
+----------+------+-----------------------+
| root     | %    | mysql_native_password |
+----------+------+-----------------------+
1 row in set (0.00 sec)

通过navicat连接测试(我的用户是naviccat)

********************
*General Information
********************
连接名: centoc
主机名或 IP 地址: 192.168.31.200
端口: 3306
用户名: naviccat
保存密码: True
********************
*Advanced Information
********************
设置位置: C:\Users\lying\Documents\Navicat\MySQL\servers\centoc
编码: 65001 (UTF-8)
保持连接间隔 (秒): N/A
使用 MySQL 字符集: True
使用压缩: False
自动连接: False
使用高级连接: False
********************
*Other Information
********************
服务器版本: 8.0.26
通讯协定: 10
信息: 192.168.31.200 via TCP/IP
安装php4

下载安装编译工具

yum groupinstall 'Development Tools'

安装依赖包

yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel

下载并解压php7.4

wget http://php.net/distributions/php-7.4.0.tar.gz
tar -zxvf php-7.4.0.tar.gz
cd php-7.4.0

编译前,新增用户组,用户,用于编译使用

groupadd www
useradd -g www www

.编译安装(./configure --help 查看编译参数)

./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-fpm-user=www --with-fpm-group=www --with-curl --with-freetype-dir --enable-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 --with-apxs2=/usr/local/apache2/bin/apxs
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql-sock=/tmp/mysql.sock 
--with-apxs2=/usr/local/apache2/bin/apxs --with-mhash --with-openssl --with-pdo-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-iconv --with-zlib --enable-gd --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop 
--enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-fpm --without-gdbm --enable-opcache=no --disable-fileinfo
./configure --prefix=/usr/local/php  --with-freetype-dir --enable-gd --with-curl --with-openssl  --with-zlib --enable-libxml --enable-xml  --enable-zip --enable-opcache --enable-sysvsem --enable-mbstring --enable-mysqlnd  --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-config-file-path=/usr/local/php/etc/ --enable-sockets --with-xmlrpc --with-gettext --enable-fileinfo --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql-sock=/tmp/mysql.sock

注意:上面命令最后的–with-apxs2=/usr/local/apache2/bin/apxs千万不能少,否则在Apache下的/usr/local/apache2/modules目录下不会生成libphp7.so模块

error: checking for libzip… configure: error: system libzip must be upgraded to version >= 0.11

#先删除旧版本
yum remove -y libzip
#下载编译安装
wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make && make install

error: Package requirements (sqlite3 > 3.7.4) were not met

yum install libsqlite3x-devel -y

error: Package requirements (oniguruma) were not met

yum install oniguruma-devel -y
#当yum install 提示 "没可用软件包"
yum install -y epel-release
yum install oniguruma-devel -y

继续编译,如下

+--------------------------------------------------------------------+
| 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.

configure: WARNING: unrecognized options: --with-freetype-dir, --with-libxml-dir, --with-pcre-regex, --with-png-dir, --with-jpeg-dir, --enable-libxml

注意网上教程看到报这个错,不过我没报过复制下来收藏一下

configure: error: off_t undefined; check your library configuration
off_t 类型是在 头文件 unistd.h中定义的,
在32位系统 编程成 long int ,64位系统则编译成 long long int ,
在进行编译的时候 是默认查找64位的动态链接库,
但是默认情况下 centos 的动态链接库配置文件/etc/ld.so.conf里并没有加入搜索路径,
这个时候需要将 /usr/local/lib64 /usr/lib64 这些针对64位的库文件路径加进去。

#添加搜索路径到配置文件
echo '/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64'>>/etc/ld.so.conf

#然后 更新配置
ldconfig -v

/usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or directory

cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h

编译没问题了,执行make && make install 安装完毕

make && make install 
Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20190902/
Installing PHP CLI binary:        /usr/local/php/bin/
Installing PHP CLI man page:      /usr/local/php/php/man/man1/
Installing PHP FPM binary:        /usr/local/php/sbin/
Installing PHP FPM defconfig:     /usr/local/php/etc/
Installing PHP FPM man page:      /usr/local/php/php/man/man8/
Installing PHP FPM status page:   /usr/local/php/php/php/fpm/
Installing phpdbg binary:         /usr/local/php/bin/
Installing phpdbg man page:       /usr/local/php/php/man/man1/
Installing PHP CGI binary:        /usr/local/php/bin/
Installing PHP CGI man page:      /usr/local/php/php/man/man1/
Installing build environment:     /usr/local/php/lib/php/build/
Installing header files:          /usr/local/php/include/php/
Installing helper programs:       /usr/local/php/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/php/lib/php/
[PEAR] Archive_Tar    - installed: 1.4.8
[PEAR] Console_Getopt - installed: 1.4.3
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.4.3
[PEAR] PEAR           - installed: 1.10.10
Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
/root/php-7.4.0/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers:           /usr/local/php/include/php/ext/pdo/

配置环境

执行完安装命令后php7.4就已经安装在到了/usr/local/php目录下了

查看版本

/usr/local/php/bin/php -v
PHP 7.4.0 (cli) (built: Oct 17 2021 15:56:27) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

添加环境变量

vi /etc/profile
#添加到最后
	export PATH=$PATH:/usr/local/php/bin

更新环境变量

source /etc/profile

查看版本

php -v

配置php-fpm

cp php.ini-production /etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

启动php-fpm

/etc/init.d/php-fpm start
或者
service php-fpm start

一键部署(宝塔linux面板)

在配置完静态ip可以访问外网后,继续以下操作。

Centos安装命令:

​ 官方教程:

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

完成后会生成面板入口,用户名,及密码。做好记录以便登录

success
==================================================================
Congratulations! Installed successfully!
==================================================================
外网面板地址: http://117.152.147.66:8888/fe008c7a
内网面板地址: http://192.168.31.209:8888/fe008c7a
username: t6gkqq9a
password: cac1441e
If you cannot access the panel,
release the following panel port [8888] in the security group
若无法访问面板,请检查防火墙/安全组是否有放行面板[8888]端口
==================================================================
Time consumed: 1 Minute!

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-TnvtQHXD-1636434439210)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211022165204090.png)]

登录后会让你选装lamp还是lnmp

关于两者:关于宝塔选择LNMP还是LAMP跟编译安装还是极速安装的个人结论 (baidu.com)

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-IYhorB7B-1636434439211)(C:\Users\lying\AppData\Roaming\Typora\typora-user-images\image-20211022184037871.png)]

==================================================================
外网面板地址: http://120.26.163.54:8888/46296e87
内网面板地址: http://172.26.5.234:8888/46296e87
username: friqk0oq
password: 416103d1
If you cannot access the panel,
release the following panel port [8888] in the security group
若无法访问面板,请检查防火墙/安全组是否有放行面板[8888]端口
==================================================================

一键部署(宝塔linux面板)

在配置完静态ip可以访问外网后,继续以下操作。

Centos安装命令:

​ 官方教程:

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

完成后会生成面板入口,用户名,及密码。做好记录以便登录

success
==================================================================
Congratulations! Installed successfully!
==================================================================
外网面板地址: http://117.152.147.66:8888/fe008c7a
内网面板地址: http://192.168.31.209:8888/fe008c7a
username: t6gkqq9a
password: cac1441e
If you cannot access the panel,
release the following panel port [8888] in the security group
若无法访问面板,请检查防火墙/安全组是否有放行面板[8888]端口
==================================================================
Time consumed: 1 Minute!

[外链图片转存中…(img-TnvtQHXD-1636434439210)]

登录后会让你选装lamp还是lnmp

关于两者:关于宝塔选择LNMP还是LAMP跟编译安装还是极速安装的个人结论 (baidu.com)

[外链图片转存中…(img-IYhorB7B-1636434439211)]

==================================================================
外网面板地址: http://120.26.163.54:8888/46296e87
内网面板地址: http://172.26.5.234:8888/46296e87
username: friqk0oq
password: 416103d1
If you cannot access the panel,
release the following panel port [8888] in the security group
若无法访问面板,请检查防火墙/安全组是否有放行面板[8888]端口
==================================================================
  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值