找额外镜像包需要到以下链接去找:
清华大学开源镜象:https://mirrors.tuna.tsinghua.edu.cn/
阿里巴巴开源镜象:https://opsx.alibaba.com/mirror
1.升级php的rpm包在阿里巴巴开源镜象找如图:
2.点击红圈的remi ,进入
3.点击红圈获取rpm-gpg-key和remi-release-7.rpm(php的yum配置文件在/etc/yum.repos.d可以看到有配置文件)
4. 为了方便就不一个一个点击url获取,就用wget把包直接下载到Linux下,前提是:Linux能够上网
yum install wget -y #没有安装的就要安装一下,如果有安装就不用再安装了
wget https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7 #epel额外包的密钥
wget https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm #epel额外包的yum的配置
wget https://rpms.remirepo.net/RPM-GPG-KEY-remi #remi包的密钥
wget https://mirrors.aliyun.com/remi/enterprise/remi-release-7.rpm #php的yum配置
5. 导入密钥,为了防止安装错误,安装yum的配置文件
rpm --import RPM-GPG-KEY-EPEL-7 #导入epel额外包的密钥
rpm --import RPM-GPG-KEY-remi #导入remi包的密钥
cd /etc/pki/rpm-gpg #存放rpm包的gpg-key
[root@node3 rpm-gpg]# ls -l #查看rpm包gpg-key,有没有存放进来
rpm -ivh epel-release-latest-7.noarch.rpm #安装epel额外包的yum配置
rpm -ivh remi-release-7.rpm #安装php的yum配置
6.安装升级php,作为依赖httpd都安装好了,apache(httpd)和php就安装好了
yum install php #升级php的软件包
php x86_64 7.3.4-1.el7.remi php 3.2 M
为依赖而安装:
libargon2 x86_64 20161029-3.el7 epel 23 k
apr x86_64 1.4.8-3.el7_4.1 centos 103 k
apr-util x86_64 1.5.2-6.el7 centos 92 k
httpd x86_64 2.4.6-88.el7.centos centos 2.7 M
httpd-tools x86_64 2.4.6-88.el7.centos centos 90 k
mailcap noarch 2.1.41-2.el7 centos 31 k
php-cli x86_64 7.3.4-1.el7.remi php 4.9 M
php-common x86_64 7.3.4-1.el7.remi php 1.1 M
php-json x86_64 7.3.4-1.el7.remi php 63 k
7.安装mariadb数据库
yum -y install mariadb mariadb-server #安装mariadb数据库
8. 开启mariadb和httpd,设置开机自动启动;执行脚本,设置mariadb数据库参数
[root@localhost ~]# systemctl start mariadb #开启mariadb
[root@localhost ~]# systemctl start httpd #开启httpd
[root@localhost ~]# systemctl enable mariadb #设置开机自动开启mariadb
[root@localhost ~]# systemctl enable httpd #设置开机自动开启httpd
mysql_secure_installation #执行脚本
...#省略部分内容
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reload privilege tables now? [Y/n] y
... Success!
Disallow root login remotely? [Y/n] n
... skipping.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reload privilege tables now? [Y/n] y
... Success!
...#省略部分内容
9.编辑php网页信息显示
[root@localhost ~]# cd /var/www/html/ #切换到apache的目录
[root@localhost html]# vi index.php #编辑php显示信息内容
10.ip地址/网页名称,就可以查看网页情况
11.查看端口和进程id,mariadb端口是3306和httpd端口是80
[root@localhost html]# netstat -atnlp | grep 80
tcp6 0 0 :::80 :::* LISTEN 12086/httpd
[root@localhost html]# ss -atnlp |grep 3306
LISTEN 0 50 *:3306 *:* users:(("mysqld",pid=11854,fd=13))
php包和依赖包下载:https://download.csdn.net/download/qq_41709494/11133266