基于openEuler配置LAMP,部署WordPress

openEuler

基于OpenEular操作系统部署WordPress,必须包含以下内容:

  1. OpenEular的安装与基本配置。

  2. 基于SSH远程管理方式开展操作。

  3. 部署LAMP环境。

  4. 部署WordPress软件。

  5. 提供个人网站服务,并通过浏览器测试应用。

  6. 简要讲授相关知识与原理。

cd /etc/yum.repos.d

欧拉系统安装后,没有配置yum源,我们需要重新配置。

[root@localhost yum.repos.d]# ls -l
总用量 4
-rw-r--r--. 1 root root 519  3月 24  2020 openEuler_x86_64.repo

vi openEuler_x86_64.repo 
[OS]
name=OS
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler

[everything]
name=everything
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/everything/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/everything/$basearch/RPM-GPG-KEY-openEuler

[EPOL]
name=EPOL
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/EPOL/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler

[debuginfo]
name=debuginfo
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/debuginfo/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/debuginfo/$basearch/RPM-GPG-KEY-openEuler

[source]
name=source
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/source/
enabled=1
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/source/RPM-GPG-KEY-openEuler

[update]
name=update
baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/update/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/$basearch/RPM-GPG-KEY-openEuler
yum install -y httpd 

安装Apache

systemctl start httpd.service

开启Apache服务

systemctl enable httpd.service

设置Apache开机自启动

systemctl stop firewalld

停止防火墙

systemctl disable firewalld

禁止防火墙自启动

yum install -y mariadb-server

安装mariadb

systemctl start mariadb

开启mariadb服务

systemctl enable mariadb

设置mariadb开机自启动

mysqladmin -uroot password '123456'

给MySQL数据库的root账户设置密码123456

yum install -y php
yum install -y php-mysqlnd php-fpm php-opcache php-cli php-curl php-dom php-exif php-fileinfo php-gd php-hash php-json php-mbstring php-mysqli php-openssl php-pcre php-xml libsodium

安装PHP和PHP模块

yum install nano

安装交互更加良好的nano 文本编辑器

systemctl status httpd

systemctl status mariadb

查看Apache和mariadb的运行状态

systemctl list-unit-files | grep httpd.service

systemctl list-unit-files | grep mariadb.service

查看Apache和mariadb是否已经开启了开机自启动

php -v

查看PHP的版本信息

echo "<?php phpinfo();  ?>" > /var/www/html/test.php

创建一个PHP测试文件测试PHP是否正常,输出重定向

chmod 755 test.php

给这个文件权限

systemctl restart httpd

重启Apache服务

yum install -y wget

安装wget

wget https://cn.wordpress.org/latest-zh_CN.zip

请求wordpress安装包(.ZIP)

rpm -qa | grep mariadb

查看mariadb的版本号

mysql -uroot -p

登录到mariadb

create database wordpressdb;

创建建WordPress数据库

在这里插入图片描述

yum install -y unzip

安装unzip解压工具

unzip latest-zh_CN.zip -d /var/www

解压latest-zh_CN.zip到/var/www目录下

chown -R apache:apache /var/www/wordpress
chmod -R 755 /var/www/wordpress/

创建用户给Apache权限

nano /etc/httpd/conf/httpd.conf

编辑Apache的配置文件


DocumentRoot “/var/www/wordpress

#
# Relax access to content within /var/www.
#
<Directory “/var/www**/wordpress**”>
Options Indexes FollowSymlinks
AllowOverride None
# Allow open access:
​ Require all granted
</Directory>

Options Indexes FollowSymlinks

以上是加粗的地方需要编辑的

nano /etc/httpd/conf.d/welcome.conf

编辑Apache的欢迎页面,将其内容都注释掉

systemctl restart httpd

重启Apache服务

在这里插入图片描述

在这里插入图片描述

cd /var/www/wordpress

找到这个文件夹

nano wp-config.php

创建 wp-config.php 文件

写入下面的内容

<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://wordpress.org/support/article/editing-wp-config-php/
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpressdb' );

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

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

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

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

/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         'WuQZ}L(BmeG_Hzg/K!sRdpK)3r^!d~i^Xt}4/p}L~au1S<H-|P6WxiNyD9i}wL >' );
define( 'SECURE_AUTH_KEY',  '4N-L(_E,|QF@]Snim^_cW9{fxffr+Tj#lDCaHSfH3ccxC?&+1FJS#9WH^B+oIIe#' );
define( 'LOGGED_IN_KEY',    '-dLv~Y)FL3%^^+~l5yU^45tM,B=]0mzb@cM1& kK~Mfem;*%aB}1ss,3Q^(}BEkf' );
define( 'NONCE_KEY',        'g5LB OVNlm+jpr<,1iLpzyQ^(Up&o{3tI^Wk7]M?r{=CMP296`.$Q;$<?}#g~a:X' );
define( 'AUTH_SALT',        '5~r~}7)Xjfopb[ScBt}g<_Rt%uRBIRv<2~j3op<6Xl8;PZ@z>((%-AyY1qVQ,GYI' );
define( 'SECURE_AUTH_SALT', '4tcO4VFwtW20Al?TO0),Vp;Oo|rhd(dO?SQo~mUN<E&4V&(b_V9/2(zGwCgM^zS{' );
define( 'LOGGED_IN_SALT',   'p<q-Wn+T R& @7m^2}/Ih~z%L!8r8PVRp)uLD7w0@:@}FW.yK*{4s1,(eWBRp=af' );
define( 'NONCE_SALT',       'nIWPxVdUaXTG?G*ER=I6) f7.A4{&k&0/xrR~EN(:/`w*CWQy Q*&2>{+7)Q]ej&' );

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the documentation.
 *
 * @link https://wordpress.org/support/article/debugging-in-wordpress/
 */
define( 'WP_DEBUG', false );

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

在这里插入图片描述

  • 3
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
要在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环境下的LAMPLinux、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 ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值