编译安装LAMP

来源:互联网 发布:数控编程实例 编辑:程序博客网 时间:2024/05/21 08:40

编译安装php

# wget http://hk1.php.net/get/php-7.0.19.tar.gz/from/this/mirror //下载php镜像资源# ll //查看当前目录文件# file mirror //查看文件属性,确认是否为.tar.gz文件,而不是HTML document text # tar -zxvf php-7.0.19.tar.gz //解压php镜像#  cd php-7.0.19/[root@localhost php-7.0.19]# ./configure --prefix=/usr/local/php7 --enable-fpm //将php安装在/usr/local文件目录下,新建php7文件夹,并安装FPM+--------------------------------------------------------------------+| 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.出现以上表示config配置成功# make //编译php,编译时间较常+--------------------------------------------------------------------+Build complete.Don't forget to run 'make test'.+--------------------------------------------------------------------+出现以上表示编译完成# make install //编译安装# vim test2.php# /usr/local/php7/bin/php test2.php //编辑测试,打印输出phpinfo()信息ConfigurationCorePHP Version => 7.0.19显示php版本信息,php编译安装成功

mysql> select user,password,host from user;
+——–+——————————————-+———————–+
| user | password | host |
+——–+——————————————-+———————–+
| root | *E94BB31DEB47B4D1C4455CC4E6C2A2068B11FEAF | localhost |
| root | | localhost.localdomain |
| root | | 127.0.0.1 |
| root | | ::1 |
| | | localhost |
| | | localhost.localdomain |
| root | *E94BB31DEB47B4D1C4455CC4E6C2A2068B11FEAF | % |
| yanyan | *40973C3FEAC1C9AC2AF8A126DA9632D9F4263B5C | ’172.17.130.224’ |
+——–+——————————————-+———————–+
8 rows in set (0.00 sec)

MySQL 安装

查看是否已经安装了mysql

[root@localhost ~]# rpm -qa|grep mysqlmysql-community-libs-5.6.36-2.el7.x86_64mysql-community-devel-5.6.36-2.el7.x86_64mysql-community-release-el7-5.noarchmysql-community-common-5.6.36-2.el7.x86_64php-mysql-5.4.16-42.el7.x86_64mysql-community-server-5.6.36-2.el7.x86_64mysql-community-client-5.6.36-2.el7.x86_64

进入mysql

[root@localhost ~]# mysql -u root -pEnter password:Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.6.36 MySQL Community Server (GPL)Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>

具体安装可以参考这篇博客,介绍比较详细。传送门

Apache安装

因为之前已经安装好了Apache,我们查看一下它的版本和状态。

[root@localhost ~]# apachectl -v[root@localhost ~]# whereis httpdhttpd: /usr/sbin/httpd /usr/lib64/httpd /etc/httpd /usr/include/httpd /usr/share/httpd /usr/share/man/man8/httpd.8.gz[root@localhost ~]# rpm -qa|grep httpdhttpd-devel-2.4.6-45.el7.centos.4.x86_64httpd-tools-2.4.6-45.el7.centos.4.x86_64httpd-2.4.6-45.el7.centos.4.x86_64[root@localhost ~]# service httpd statusRedirecting to /bin/systemctl status  httpd.service● httpd.service - The Apache HTTP Server   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)   Active: active (running) since 四 2017-06-08 20:53:55 CST; 4 days ago     Docs: man:httpd(8)           man:apachectl(8)  Process: 16871 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS) Main PID: 1016 (httpd)   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"   CGroup: /system.slice/httpd.service           ├─ 1016 /usr/sbin/httpd -DFOREGROUND           ├─16883 /usr/sbin/httpd -DFOREGROUND           ├─16884 /usr/sbin/httpd -DFOREGROUND           ├─16885 /usr/sbin/httpd -DFOREGROUND           ├─16886 /usr/sbin/httpd -DFOREGROUND           └─16887 /usr/sbin/httpd -DFOREGROUND608 20:53:41 localhost.localdomain systemd[1]: Starting The Apache HTTP S...608 20:53:55 localhost.localdomain systemd[1]: Started The Apache HTTP Se...612 03:34:02 localhost.localdomain systemd[1]: Reloaded The Apache HTTP S...Hint: Some lines were ellipsized, use -l to show in full.

安装参考传送门

注意对防火墙访问80端口

[root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanentsuccess[root@localhost ~]# systemctl restart firewalld.service

完成。这里写图片描述