标签:信息 smp ace 虚拟 gif permanent pac tor redhat
物理机安装:
1.Linux系统用的是: CentOS Linux release 7.3.1611 (Core)
2. 版本: Linux version 3.10.0-514.10.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (RedHat 4.8.5-11) (GCC) ) #1 SMP Fri Mar 3 00:04:05 UTC 2017
安装过程(以下都是在root用户权限):
一、安装Apache
1.安装yum -y install httpd
2.开启apache服务systemctl start httpd.service
3.设置apache服务开机启动systemctl enable httpd.service
4.验证apache服务是否安装成功
在本机浏览器中输入虚拟机的ip地址,CentOS7查看ip地址的方式为:ip addr
(阿里云不需要用这种方式查看,外网ip已经在你主机列表那里给你写出来了的;)
这里是访问不成功的
(阿里云用外网访问,能成功,不需要做以下步骤)
查了资料,说法是,CentOS7用的是Firewall-cmd,CentOS7之前用的是iptables防火墙;要想让外网能访问到apache主目录,就需要做以下的操作:firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
然后再访问外网ip,如果看到apache默认的页面--有Testing 123...字样,便是成功安装了apache服务了;
二、安装PHP
1.安装yum -y install php
2.重启apache服务systemctl restart httpd
或者systemctl restart httpd.service
然后,你可以写一个php文件在浏览器中运行一下了;
eg:vi /var/www/html/info.php
i<?php phpinfo(); ?>
Esc:wq
然后,在自己电脑浏览器输入 127.0.0.1/info.php
运行,会出现php的一些信息
三、安装MySQL
1.官网下载安装mysql-server
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
安装成功后重启mysql服务。
# service mysqld restart
初次安装mysql,root账户没有密码。
[root@yl-web yl]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.26 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.01 sec)
mysql>
设置密码
mysql> set password for ‘root‘@‘localhost‘ =password(‘password‘);
Query OK, 0 rows affected (0.00 sec)
mysql>
不需要重启数据库即可生效。
在mysql安装过程中如下内容:
Installed:
mysql-community-client.x86_64 0:5.6.26-2.el7 mysql-community-devel.x86_64 0:5.6.26-2.el7
mysql-community-libs.x86_64 0:5.6.26-2.el7 mysql-community-server.x86_64 0:5.6.26-2.el7
Dependency Installed:
mysql-community-common.x86_64 0:5.6.26-2.el7
Replaced:
mariadb.x86_64 1:5.5.41-2.el7_0 mariadb-devel.x86_64 1:5.5.41-2.el7_0 mariadb-libs.x86_64 1:5.5.41-2.el7_0
mariadb-server.x86_64 1:5.5.41-2.el7_0
如何搭建lamp(CentOS7+Apache+MySQL+PHP)环境
标签:信息 smp ace 虚拟 gif permanent pac tor redhat
原文地址:http://www.cnblogs.com/miaoer/p/6560896.html