linux-LAMP搭建

LAMP

1.架构描述

LAMP是一个C/S架构的平台:web客户端基于tcp/ip协议,发出http请求,服务端进行回应,用户的请求可能是动态的也可能是静态的。

web服务器通过用户发送的url后缀判断动静态请求:

  • 静态请求web服务器直接处理
  • 静态请求web服务器转发给后台应用服务器去处理:(CGI)php运行的后台程序

apache与php所处环境不同决定其通讯方式不同:

  • 安装在同一台服务器,就默认使用系统共享内存通信
  • 按装在不同服务器,就通过网络,进行socket网络套接字通信

2.搭建

关闭防火墙,关闭selinux

1.安装Apache

[root@localhost ~]# yum install httpd -y
[root@localhost ~]# systemctl enable --now httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

[root@localhost ~]# cat > /var/www/html/index.html <
> <meta charset=utf8>
> 一起来学LAMP
> EOF

2.yum安装mariadb(mysql)

[root@localhost ~]# yum install mariadb-server mariadb -y
[root@localhost ~]# systemctl enable --now mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

[root@localhost ~]# netstat -tunlp |grep mysql
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      11026/mysqld     

登录:
[root@localhost ~]# mysql -uroot -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [mysql]> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic   

你可能感兴趣的:(linux系统,服务器,linux,apache)