**
配置LAMP架构web服务器
**
下载配置文件:
yum install httpd mariadb-server mariadb php php-mysql -y
启动apache和数据库:
systemctl start mariadb
systemctl start httpd
安装PHP运行环境:
yum info php-mysql
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
- base: mirror.lzu.edu.cn
- epel: ftp.riken.jp
- extras: mirrors.163.com
- updates: mirrors.163.com
已安装的软件包
名称 :php-mysql
架构 :x86_64
版本 :5.4.16
发布 :46.el7
大小 :232 k
源 :installed
来自源:base
启动MySQL:
mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB Server
Copyright © 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> exit
Bye
修改MySQL密码:
/usr/bin/mysqladmin -u root password “*************”
重新登陆MySQL:
mysql -uroot -p
(只用# mysql 会报错)
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO)
进入apache文件夹:
cd /var/www/html/
新建一个PHP文件:
vim index.php
1 <?php
2 phpinfo();
3 ?>
浏览器访问试验
e.g. 192.168.***.***