实验名称:基于lamp搭建wordpress实验
实验目的:创建wordpress,并访问
实验环境:Linux CentOS 7虚拟机一台
实验步骤:
一、配置基本信息。
1、配置本地yum
[root@localhost ~]# mkdir /media/cdrom
[root@localhost ~]# mount /dev/cdrom /media/cdrom/
修改配置文件,如图所示
[root@localhost ~]# vim /etc/yum.repos.d/CentOS-Media.repo
2、关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# setenforce 0
3、检查yum
[root@localhost ~]# yum repolist
4、搭建LAMP环境,使用yum安装
[root@localhost ~]# yum -y install httpd php php-mysql mariadb mariadb-server
5、启动
[root@localhost ~]# systemctl enable httpd
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl status httpd
[root@localhost ~]# systemctl enable mariadb
[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# systemctl status mariadb
6、添加php页面测试文件
[root@localhost ~]# cd /var/www/html/
[root@localhost html]# vim index.php
配置文件如图
7、重启httpd,通过进程和端口查看是否成功
[root@localhost html]# systemctl restart httpd
[[root@localhost html]# ps -ef | grepht httpd
[root@localhost html]# ss -lntp | grep httpd
8、访问php测试网页
[root@localhost html]# firefox 192.168.68.86
9、安装wordpress
把包复制粘贴到虚拟机
[root@localhost html]# cp ‘//tmp/VMwareDnD/d5562097/wordpress-4.8.1-zh_CN.tar(2).gz’ ./
[root@localhost html]# tar zxvf wordpress-4.8.1-zh_CN.tar(2).gz
10、访问
[root@localhost html]# firefox 192.168.68.86/wordpress
11、去数据库授权访问
[root@localhost html]# systemctl restart mariadb
[root@localhost html]# mysql
12、创建数据库wordpress
create database wordpress charset utf8;
grant all on wordpress.* to ‘a’@‘localhost’ identified by ‘123456’;
flush privileges;
13、再次访问,点击“现在开始!”
出现以下页面,出去改一下属主属组就OK了!
[root@localhost html]# systemctl restart httpd
[root@localhost html]# chown -R apache:apache wordpress
14、再次访问
[root@localhost html]# firefox 192.168.68.86/wordpress
至此,基于lamp搭建wordpress实验成功!