apache安装配置
1.安装
yum install httpd

2.启动apache
systemctl start httpd

3.查看apache服务器状态
systemctl status httpd

4.apache配置
vim /etc/httpd/conf/httpd.conf
重启修改配置
systemctl reload httpd.service
5.开启防火墙80端口
查看端口
firewall-cmd --list-ports
添加端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
重启防火墙
firewall-cmd --reload
6.添加安全组规则
7.外网输入ip访问
8.其他的apache操作指令
systemctl start httpd.service 启动
systemctl status httpd.service 查看状态
systemctl stop httpd.service 停止
systemctl restart httpd.service 重启
systemctl reload httpd.service 重启修改配置
systemctl enable httpd.service 配置开机自启动
php7.0安装
1.获取php7.0的yum源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

2.查看php7.0扩展
yum search php70w

2.安装通用扩展(安装扩展yum install 扩展名)
yum install php70w php70w-fpm php70w-cli php70w-common php70w-devel php70w-gd php70w-pdo php70w-mysql php70w-mbstring php70w-bcmath


3.查看php版本
php -v

4.其他的php操作指令
systemctl start php-fpm.service 启动
systemctl status php-fpm.service 查看状态
systemctl stop php-fpm.service 停止
systemctl restart php-fpm.service 重启
systemctl reload php-fpm.service 重启修改配置
systemctl enable php-fpm.service 配置开机自启动
mysql安装
1.下载mysql的repo源
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

2.安装下载好的mysql-community-release-el7-5.noarch.rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm

3.安装mysql
yum install mysql-community-server

4.启动MySQL
systemctl start mysqld
5.初始登录MySQL(不需要密码)
mysql -u root

6.设置密码为root
set password for 'root'@'localhost' =password('root');
7.退出重新登录
exit;

mysql -u root -p

8.开启防火墙3306端口
查看端口
firewall-cmd --list-ports
添加端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
重启防火墙
firewall-cmd --reload
9.远程连接MySQL
root是用户名,%是所有ip地址,你也可以写自己的IP地址比较安全,password是远程连接的密码。
grant all privileges on *.* to root@'%'identified by 'password';
也可以通过下面的指令创建新的用户来分配权限。
username是用户名,%是所有IP地址,如果输入的是IP地址,就规定只有改IP地址才能使用,password是登录密码。
create user 'username'@'%' identified by 'password';
添加安全组规则
Navicat连接

10.开机启动MySQL
vi /etc/rc.local
将service mysqld start添加进去

11.其他的MySQL操作指令
首先启动MySQL:systemctl start mysqld
查看MySQL状态:systemctl status mysqld
重启MySQL指令:systemctl restart mysqld
停止MySQL指令:systemctl stop mysqld
本文详细介绍了如何在阿里云ECS的CentOS 7系统上安装和配置Apache、PHP7.0及MySQL。包括apache的安装配置,php7.0的yum源获取与安装,mysql的下载与初始化,以及防火墙规则和安全组的设置,确保外网可以成功访问和远程连接MySQL。
1270

被折叠的 条评论
为什么被折叠?



