LAMP部署wordpress

1.安装Mariadb

# 更改主机名
[root@localhost ~]# hostnamectl set-hostname wordpress
[root@localhost ~]# bash
# 关闭防火墙与selinux
[root@wordpress ~]# systemctl stop firewalld
[root@wordpress ~]# systemctl disable firewalld --now
[root@wordpress ~]# sed -i "s/SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config
[root@wordpress ~]# setenforce 0
# 备份旧的yum源
[root@wordpress ~]# mv /etc/yum.repos.d/* /media/
# 配置 Mariadb 源
[root@wordpress ~]# vi /etc/yum.repos.d/mariadb.repo
# MariaDB 11.2 CentOS repository list - created 2023-12-08 03:01 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# baseurl = https://rpm.mariadb.org/11.2/centos/$releasever/$basearch
baseurl = https://mirrors.aliyun.com/mariadb/yum/11.2/centos/$releasever/$basearch
module_hotfixes = 1
# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey = https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
# 阿里云源
curl -o /etc/yum.repos.d/Centos-7.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 生成yum源缓存
[root@wordpress ~]# yum makecache
# 清理缓存
[root@wordpress ~]# yum clean all  && yum repolist
# 下载相关依赖包
[root@wordpress ~]# yum install -y epel-release 
# 下载 MariaDB-server MariaDB-client 
[root@wordpress ~]# yum install -y  MariaDB-server MariaDB-client
# 启动服务
[root@wordpress ~]# systemctl start mariadb
# 开机自启
[root@wordpress ~]# systemctl enable mariadb --now
# 进入mariadb
[root@wordpress ~]# mariadb -uroot -p
# 设置root用户密码
alter user root@'localhost' identified by '000000';
# 创建 wordpress 数据库
create database wordpress;
show databases;
# 授权wordpress用户对wordpress数据库具有所有的操作权限
grant all on wordpress.* to 'wordpress'@'localhost' identified by '000000';		
# 刷新权限
flush privileges;				
Ctrl+C 	# 退出Mariadb
# 重启mariadb服务
[root@wordpress ~]# systemctl restart mariadb

2.安装Apache

# 安装 apache包
[root@wordpress ~]# yum install -y httpd httpd-devel
# 启动服务
[root@wordpress ~]# systemctl start httpd
# 开机自启
[root@wordpress ~]# systemctl enable httpd
# 查看服务状态
[root@wordpress ~]# systemctl status  httpd
# 查看防火墙状态
[root@wordpress ~]# systemctl status firewalld
[root@wordpress ~]# systemctl disable firewalld --now
# 验证
在浏览器地址栏输入Linux服务器的IP地址,出现欢迎界面,说明部署成功

在这里插入图片描述

3.安装Php

# 安装epel软件仓库
[root@wordpress ~]# yum install -y epel-release
# 安装REMI软件仓库
[root@wordpress ~]# yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
# 安装PHP及相关扩展模块
[root@wordpress ~]# yum -y install php74-php php74-php-common php74-php-fpm php74-php-mysqlnd php74-php-pdo php74-php-cli php74-php-json php74-php-mbstring php74-php-sodium php74-php-pecl-imagick php74-php-xml php74-php-gd php74-php-pecl-mcrypt php74-php-pecl-zip
[root@wordpress ~]# yum install -y yum-utils
# 查看PHP版本信息
[root@wordpress ~]# php74 -v
# 启动php
[root@wordpress ~]# systemctl start php74-php-fpm.service
# 开机自启
[root@wordpress ~]# systemctl enable php74-php-fpm.service
# 测试
[root@wordpress ~]# echo "<?php phpinfo(); ?>" > /var/www/html/info.php
# 重启服务
[root@wordpress ~]# systemctl restart httpd
`在浏览器中输入该机的IP/info.php查看是否能出现php的相关信息`

在这里插入图片描述

4.配置wordpress

[root@wordpress ~]# cd /var/www/html/
# 上传已经下载的wordpress-6.4.2-zh_CN.tar包
# 解压
[root@wordpress ~]# tar -zxvf wordpress-6.4.2-zh_CN.tar
[root@wordpress ~]# cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
[root@wordpress ~]# chown -R nginx:nginx /usr/data/wordpress
# 编辑wordpress配置文件
[root@wordpress ~]# vim /var/www/html/wordpress/wp-config.php
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** Database username */
define( 'DB_USER', 'wordpress' );

/** Database password */
define( 'DB_PASSWORD', '000000' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
# 安装WordPress
在浏览器中输入该机的IP/wordpress 进入安装界面

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

  • 7
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Centos 7环境下部署LAMP WordPress,您可以按照以下步骤进行操作: 1. 首先,下载并解压WordPress安装包。您可以从WordPress官方网站下载最新的WordPress压缩包。使用以下命令解压缩安装包并将其解压到/var/www/html目录中: ``` unzip wordpress-4.9.4-zh_CN.zip -d /var/www/html ``` 2. 接下来,设置WordPress目录的所有者和组为apache用户。使用以下命令设置: ``` chown -Rv apache.apache /var/www/html/wordpress ``` 3. 然后,创建一个MySQL数据库用于WordPress。使用以下命令创建数据库并查看已有的数据库: ``` mysql -e 'create database wordpress;show databases;' ``` 4. 完成以上步骤后,您可以开始进行测试和实验了。您可以访问服务器的IP地址,在浏览器中输入http://服务器IP地址/,然后按照WordPress的站点配置进行相应的设置即可。 请注意,上述步骤是基于Centos 7环境下的LAMP(Linux、Apache、MySQL、PHP)配置,并以WordPress 4.9.4为例。您需要确保您的系统已安装相应的软件版本,如Centos 7.4.1708、Apache 2.4.6、MariaDB 5.5.56和PHP 5.6.36。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [lamp+wordpress部署](https://blog.csdn.net/li_minjian/article/details/90273962)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [LAMP + WordPress 部署笔记](https://download.csdn.net/download/lyy289065406/10484861)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [使用LAMP环境部署WordPress个人博客](https://blog.csdn.net/qq_44487263/article/details/122642400)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值