1.安装apache服务及安装包
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
- 启动apache服务
systemctl start httpd.service
- 公网访问测试(实例公网 IP)
- 安装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版本号
mysql -V
- 启动MySQL服务
systemctl start mysqld.service
- 修改密码并登录数据库
grep "password" /var/log/mysqld.log
输入上文查询出的密码登录数据库
mysql -uroot -p
修改密码
set global validate_password_policy=0; #修改密码安全策略为低(只校验密码长度,至少8位)。
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678‘;
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY '12345678';'
退出数据库
exit;
- 安装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
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
- 重启apache服务并访问测试页面输入http://实例公网 IP/phpinfo.php
systemctl restart httpd
- 安装PHPmyadmin
mkdir -p /var/www/html/phpmyadmin
下载PHPmyadmin压缩包
wget --no-check-certificate https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.zip
解压压缩包
yum install -y unzip
unzip phpMyAdmin-4.0.10.20-all-languages.zip
设置文件存放目录
mv phpMyAdmin-4.0.10.20-all-languages/* /var/www/html/phpmyadmin
访问页面测试(输入http://实例公网 IP/phpmyadmin)