快速搭建LAMP架构


1.安装apache

[root@localhost ~]# yum install httpd -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
软件包 httpd-2.4.6-

#启动apache
systemctl start httpd

[root@localhost ~]# netstat -tunlp |grep "httpd"
tcp6       0      0 :::80                   :::*                    LISTEN      1789/httpd

2.部署mysql

#安装
yum install mariadb -y
#启动
systemctl start maridb
#验证
[root@localhost ~]# netstat -tunlp |grep "mysql"
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      1581/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)]> 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]> excite
    -> Ctrl-C -- exit!
Aborted 、

3.部署php结合apache

#解决php安装的依赖开发环境
[root@localhost ~]# yum install -y zlib-devel libxml2-devel libjpeg-devellibjpeg-turbo-devel libiconv-devel freetype-devel libpng-develgd-devel libcurl-devel libxslt-devel libtool-ltdl-devel pcrepcre-devel apr apr-devel zlib-devel gcc make
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
#安装php,以及php连接mysql数据库的驱动
[root@localhost ~]# yum install php php-fpm php-mysql -y
#编辑apache配置文件
vim /etc/httpd/conf/httpd.conf
:set nu 显示行号 120119 DocumentRoot "/var/www/html"
120  TypesConfig /etc/mime.types
121  AddType application/x-httpd-php .php
122  AddType application/x-httpd-php-source .phps
123  DirectoryIndex index.php index.html

4.验证

#编写一个php脚本,放在
vim /etc/var/www/html/index.php
<meta charset=utf8>
test
<?php
phpinfo();
?>
#重启httpd
systemct restart httpd

看到phpinfo的页面后,表示lamp架构搭建完成

5.部署一个论坛disuz

#下载论坛代码
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip

# 解压缩
yum install unzip -y
# 拷贝upload,到apache目录下即可访问
[root@ceph discuz]# cp -r upload/* /var/www/html/
cp: overwrite ‘/var/www/html/index.php’? y
# 
[root@ceph discuz]# chmod -R 777 /var/www/html/*

在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值