快速搭建LAMP环境--学习记录

1.安装apache服务及安装包
yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql

  1. 启动apache服务

systemctl start httpd.service

  1. 公网访问测试(实例公网 IP)
  2. 安装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

  1. 查看MySQL版本号

mysql -V

  1. 启动MySQL服务

systemctl start mysqld.service

  1. 修改密码并登录数据库

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;

  1. 安装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

  1. 重启apache服务并访问测试页面输入http://实例公网 IP/phpinfo.php

systemctl restart httpd

  1. 安装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)

上一篇:Linq多表查询条件批量删除


下一篇:mysql负载均衡笔记