LAMP项目部署
LAMP介绍
LAMP = Linux + Apache + MySQL + PHP
Apache:主要用于接收用户的请求,处理业务逻辑,返回结果给客户端(浏览器)
PHP:编程语言的一种,主要应用于Web开发。主要实现软件的各种功能
MySQL:数据库,永久保存数据
扩展:
-
LNMP:Linux + Nginx + MySQL + php-fpm
-
LNMPA:Linux + Nginx(80) + MySQL + PHP + Apache
使用LAMP搭建个人博客
防火墙放行&关闭SELinux
[root@server1 ~]# setenforce 0
[root@server1 ~]# getenforce
Permissive
[root@server1 ~]# firewall-cmd --add-port=80/tcp --permanent
success
[root@server1 ~]# firewall-cmd --reload
success
安装http软件包
[root@server1 ~]# yum install -y httpd wget
[root@server1 ~]# systemctl start httpd.service
[root@server1 ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
安装php软件包
[root@server1 ~]# yum install -y php-* --skip-broken php-mysqlnd
[root@server1 html]# wget http://mirrrors.eagleslab.com:8889/tz.php <--探针
[root@server1 html]# systemctl restart httpd.service
浏览器访问探针:192.168.226.10/tz.php
说明PHP运行正常
安装mariadb软件包
[root@server1 html]# yum install -y mariadb mariadb-server
[root@server1 html]# systemctl start mariadb.service
[root@server1 html]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@server1 html]# mysql_secure_installation
#初始化,设置密码即可,其他回车
测试PHP是否成功连接mysql
说明php成功连接mysql
创建用于博客的数据库
[root@server1 html]# mysql -uroot -p1 -e"create database blog;show databases;"
+--------------------+
| Database |
+---------------