lamp+wordpress+php

时钟同步

//下载chrony包
[root@lamp ~]# yum -y install chrony
//重启服务
[root@lamp ~]# systemctl restart chronyd
[root@lamp ~]# systemctl enable chronyd
[root@lamp ~]# hwclock -w
[root@lamp ~]# timedatectl  //查看是否时钟同步

安装软件包

// 安装 httpd mariadb mariadb-server 包
[root@lamp ~]# yum -y install httpd mariadb mariadb-server

//重启 httpd mariadb  服务
[root@lamp ~]# systemctl restart httpd
[root@lamp ~]# systemctl enable httpd
[root@lamp ~]# systemctl restart mariadb
[root@lamp ~]# systemctl enable mariadb

安装配置MySQL

[root@lamp ~]# mysql_secure_installation 
Enter current password for root (enter for none):   //输入数据库密码
Switch to unix_socket authentication [Y/n]     //指针验证
Change the root password? [Y/n] y 		//设置数据库密码
New password: 				//输入新密码
Re-enter new password: 		//再次输入新密码
Remove anonymous users? [Y/n] y     //移除匿名用户
Disallow root login remotely? [Y/n] n  //不允许root用户远程登录
Remove test database and access to it? [Y/n] y  //是否要移除测试数据库并移除访问
Reload privilege tables now? [Y/n] y    //重新加载表的权限

//登录
[root@lamp ~]# mysql -u root -p 
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.5.22-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)]> 

安装配置PHP

//安装PHP包
[root@lamp ~]# yum -y install php php-cli php-fpm php-gd php-curl php-zip php-mbstring php-opcache php-intl php-mysqlnd

//修改时区
[root@lamp ~]# vim /etc/php.ini
date.timezone =   Asia/Shanghai

//重启PHP
[root@lamp ~]# systemctl restart php-fpm
[root@lamp ~]# systemctl enable php-fpm

//编写PHP网页
[root@lamp ~]# cd /var/www/html/
[root@lamp html]# vim index.php
<?php
        phpinfo();
?>

//修改APache的默认文件
[root@lamp html]# vim /etc/httpd/conf/httpd.conf 
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

//重启服务
[root@lamp html]# systemctl restart httpd
[root@lamp html]# systemctl enable httpd

直接输入本机IP可以访问PHP
在这里插入图片描述

安装配置wordpress

安装配置下载修改解压wordpress

//安装软件包 ------>方便将文件从真实机传输到虚拟机
[root@lamp html]# yum -y install lrzsz

//创建目录并将软件包上传到 /opt/software中,安装tar包并解压
[root@lamp html]# mkdir /opt/software
[root@lamp software]# yum -y install tar
[root@lamp software]# ls
wordpress  wordpress-6.5.5.tar.gz

//复制文件、修改所有者和所属组和权限
[root@lamp software]# cp -r wordpress /var/www/html/
[root@lamp ~]# chown -R apache.apache /var/www/html/wordpress/
[root@lamp ~]# chmod -R 775 /var/www/html/wordpress/

配置数据库

//登录数据库
[root@lamp ~]# mysql -u root -p

//创建数据库(以“;”为结束)
MariaDB [(none)]> create database  wordpress_db;

//创建用户
MariaDB [(none)]> CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'password';
user 创建的用户名
@'localhost'  本地登录
IDENTIFIED BY  设置的密码

//授权
MariaDB [(none)]> grant all on wordpress_db.*  to  'wordpress_user'@'localhost';  
wordpress_db.*  //wordpress_db库下面的所有表

//刷新数据库
MariaDB [(none)]> flush privileges;

配置网站

//复制文件
[root@lamp ~]# cp -p /usr/share/doc/httpd-core/httpd-vhosts.conf  /etc/httpd/conf.d/
///etc/httpd/conf/httpd.conf 查找
<VirtualHost 192.168.100.10:80>
    DocumentRoot "/var/www/html/wordpress"  //网站位置
    <Directory "/var/www/html/wordpress">   //什么权限
        Options Indexes FollowSymLinks
         AllowOverride all
         Require all granted
    </Directory>
</VirtualHost>

在浏览器输入192.168.100.10,登录设置之后如下图

在这里插入图片描述

  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值