使用LAMP环境部署WordPress个人博客

视频讲解在微信公众号 问渠清源 回复关键词 博客视频 即可观看

LAMP是Linux Apache MySQL PHP的简写,即把Apache、MySQL以及PHP安装在Linux系统上,组成一个环境来运行PHP的脚本语言,通常是网站。

LAMP环境部署wordpress博客前,防火墙已经关闭 ,selinux是允许模式, yum源已部署

第一步:安装Apache
#安装Apache服务
[root@wentan ~]# yum install -y httpd
[root@wentan ~]# systemctl start httpd
[root@wentan ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.

用浏览器访问ip地址,出现Apache测试页表示一切正常

第二步:安装并配置数据库
[root@wentan html]# yum install -y mariadb mariadb-server
[root@wentan html]# systemctl start mariadb
[root@wesystemctl enable mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.

#初始化数据库
[root@wentan html]# mysql_secure_installation 

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: root
Re-enter new password: root 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

#登录数据库
[root@wentan html]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.28-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 [(noneshow databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.001 sec)

MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.001 sec)

#退出
MariaDB [wordpress]> exit
Bye

第三步:安装php及配套包
[root@wentan html]# yum install -y php php-common php-cli php-gd php-pdo php-devel php-xml php-json php-mysqlnd php-bcmath
第四步:下载 WordPress安装包
[root@wentan html]# wget https://wordpress.org/latest.tar.gz

#解压到当前位置
[root@wentan html]# tar -zvxf latest.tar.gz

#将wordpress包中所有内容 复制到apache界面下
[root@wentan html]# cp -r wordpress/* ./
[root@wentan html]# ll
total 153732
drwxr-xr-x.  4 root   root          55 Dec  2  2018 games
-rw-r--r--.  1 root   root   127022187 Jan 22 15:30 games.zip
-rw-r--r--.  1 root   root         405 Jan 22 16:27 index.php
-rw-r--r--.  1 root   root    15087521 Jan  7 03:14 latest.tar.gz
-rw-r--r--.  1 root   root       19915 Jan 22 16:27 license.txt
-rw-r--r--.  1 root   root        7346 Jan 22 16:27 readme.html
drwxr-xr-x.  5 nobody nobody      4096 Jan  7 03:13 wordpress
-rw-r--r--.  1 root   root    15087521 Jan 22 16:15 wordpress-5.8.3.tar.gz
-rw-r--r--.  1 root   root        7165 Jan 22 16:27 wp-activate.php
drwxr-xr-x.  9 root   root        4096 Jan 22 16:27 wp-admin
-rw-r--r--.  1 root   root         351 Jan 22 16:27 wp-blog-header.php
-rw-r--r--.  1 root   root        2328 Jan 22 16:27 wp-comments-post.php
-rw-r--r--.  1 root   root        3004 Jan 22 16:27 wp-config-sample.php
drwxr-xr-x.  4 root   root          52 Jan 22 16:27 wp-content
-rw-r--r--.  1 root   root        3939 Jan 22 16:27 wp-cron.php
drwxr-xr-x. 25 root   root        8192 Jan 22 16:27 wp-includes
-rw-r--r--.  1 root   root        2496 Jan 22 16:27 wp-links-opml.php
-rw-r--r--.  1 root   root        3900 Jan 22 16:27 wp-load.php
-rw-r--r--.  1 root   root       45463 Jan 22 16:27 wp-login.php
-rw-r--r--.  1 root   root        8509 Jan 22 16:27 wp-mail.php
-rw-r--r--.  1 root   root       22297 Jan 22 16:27 wp-settings.php
-rw-r--r--.  1 root   root       31693 Jan 22 16:27 wp-signup.php
-rw-r--r--.  1 root   root        4747 Jan 22 16:27 wp-trackback.php
-rw-r--r--.  1 root   root        3236 Jan 22 16:27 xmlrpc.php

第五步:修改属主属组和文件权限
[root@wentan html]# chown -R apache:apache /var/www/html/*
[root@wentan html]# chmod -R 755 /var/www/html/*
第六步:配置文件
#将配置文件的样例文件重命名为正式文件
[root@wentan html]# mv wp-config-sample.php wp-config.php

#编辑这个配置文件
[root@wentan html]# vim wp-config.php

#在数据库设置位置  设置数据库名称  用户名  密码等信息
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */

define( 'DB_NAME', 'wordpress' );

/** MySQL database username */
define( 'DB_USER', 'root' );

/** MySQL database password */
define( 'DB_PASSWORD', 'root' );

/** MySQL 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', '' );

#开启调试功能
define( 'WP_DEBUG', true );
#输出调试信息
define( 'WP_DEBUG_LOG', true );
#显示调试信息
define('WP_DEBUG_DISPLAY', true);
 
#最后重启apache服务即可完成
[root@wentan html]# systemctl restart httpd

最后只需要访问http://192.168.253.128/(服务器IP地址) 完成wordpress的站点配置即可。

在这里插入图片描述

视频讲解在微信公众号 问渠清源 回复关键词 博客视频 即可观看
在这里插入图片描述

  • 3
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
要在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 ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

tan-1210

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值