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 显示行号 120行
119 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/*