快速搭建一套LAMP环境以及phpmyadmin数据库管理工具

安装LAMP

#安装apache
yum -y install httpd mod_ssl mod_perl mod_auth_mysql
httpd -v
systemctl start httpd.service

进入http://<ECS公网IP>,若返回页面如下图所示,说明Apache服务启动成功。 快速搭建一套LAMP环境以及phpmyadmin数据库管理工具


#安装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>](<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>](<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>](<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>](<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>](<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
#查看mysql状态
systemctl status 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';
#授予root用户远程管理权限
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
#创建PHP测试页面
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
#重启Apache服务
systemctl restart httpd

进入http://<ECS公网IP>/phpinfo.php,显示如下页面表示PHP语言环境安装成功。

快速搭建一套LAMP环境以及phpmyadmin数据库管理工具安装phpMyAdmin

#phpmyadmin数据库管理工具
mkdir -p /var/www/html/phpmyadmin
wget --no-check-certificate [<https://files.phpmyadmin.net/phpMyAdmin/4.0.10.20/phpMyAdmin-4.0.10.20-all-languages.zip>](<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
#进入网址在phpMyAdmin登录页面,依次输入MySQL的用户名和密码:
公网ip/phpmyadmin
快速搭建一套LAMP环境以及phpmyadmin数据库管理工具
上一篇:Sphinx+github+ReadtheDocs书写笔记


下一篇:Oracle 11g on ECS 测试实践--DB篇