创建ECS服务器
打开云产品:
在页面左侧,单击 云产品资源 下拉列表,查看本次实验所需资源。
单击屏幕右侧 创建资源 ,免费创建当前实验所需云产品资源
设置登录用户和密码即可。
基于CentOS快速搭建LAMP环境
安装Apache服务
安装Apache
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
启动
systemctl start httpd.service
安装并配置MySQL
安装mysql
rpm -e mariadb-libs --nodeps
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-common-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-libs-compat-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-client-5.7.35-1.el7.x86_64.rpm
yum install -y https://mirrors.aliyun.com/mysql/MySQL-5.7/mysql-community-server-5.7.35-1.el7.x86_64.rpm
查看版本号
mysql -V
启动mysql
systemctl start mysqld.service
查看初始密码
grep "password" /var/log/mysqld.log
修改密码
set global validate_password_policy=0; #修改密码安全策略为低(只校验密码长度,至少8位)。
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';
授予权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678';
安装PHP
yum -y install php php-mysql gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap