相关的环境搭建有很多介绍。参考了网上别人的经验,可以较快的搭建起来。这里记录了我个人的环境搭建过程。
这次的环境搭建,都是通过yum进行安装的,而没有通过编译源码进行安装。
先来看目标版本,这是安装后的信息:
点击(此处)折叠或打开
# uname -a
Linux localhostww.localdomain 4.1.12-112.14.13.el7uek.x86_64 #2 SMP Thu Jan 18 11:38:29 PST 2018 x86_64 x86_64 x86_64 GNU/Linux
# httpd -version
Server version: Apache/2.4.6 ()
Server built: Apr 11 2018 05:56:48
# mysqld --version
/usr/sbin/mysqld Ver 8.0.11 for Linux on x86_64 (MySQL Community Server - GPL)
# php -v
PHP 7.1.19 (cli) (built: Jun 25 2018 13:58:17) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
1. 安装Apahce (httpd)
1.1 安装
这个很简单:
点击(此处)折叠或打开
# yum install httpd
1.2 小插曲
然而,遇到了个小问题:
点击(此处)折叠或打开
Loaded plugins: langpacks, ulninfo
Existing lock /var/run/yum.pid: another copy is running as pid 2657.
Another app is currently holding the yum lock; waiting for it to exit...
这是个常见的问题,原因是yum在尝试更新。
我们来查一下进程以及父进程信息:
点击(此处)折叠或打开
# ps -ef | grep yum
root 2657 1571 0 07:23 ? 00:00:00 /usr/bin/python /usr/share/PackageKit/helpers/yum/yumBackend.py get-updates none
# ps -ef | grep 1571
root 1571 1 0 07:21 ? 00:00:01 /usr/libexec/packagekitd
root 2657 1571 0 07:23 ? 00:00:00 /usr/bin/python /usr/share/PackageKit/helpers/yum/yumBackend.py get-updates none
把父进程1571杀掉,然后再查,此时已经没有相关进程了。
点击(此处)折叠或打开
# kill -9 1571
# ps -ef | grep yum | grep -v grep
#
1.3 再次安装
再通过yum安装httpd,一切OK。
点击(此处)折叠或打开
# yum install httpd
1.4 启动httpd, 测试
默认的httpd是80端口,先查看一下;很好,这个端口没有被监听。
点击(此处)折叠或打开
# netstat -an | grep 80
启动 httpd
点击(此处)折叠或打开
# systemctl start httpd.service
再看一下监听端口,有了:
点击(此处)折叠或打开
# netstat -an | grep 80
tcp6 0 0 :::80 :::*
也可以通过浏览器来查看apache默认的测试界面:
点击(此处)折叠或打开
http://localhost:80
2. 安装PHP
2.1 检查并删除现有的PHP版本
参考连接
最终,执行如下命令查看是否已经完全删除:
点击(此处)折叠或打开
# php -v
bash: php: command not found...
# rpm -qa|grep php