openEuler
基于OpenEular操作系统部署WordPress,必须包含以下内容:
-
OpenEular的安装与基本配置。
-
基于SSH远程管理方式开展操作。
-
部署LAMP环境。
-
部署WordPress软件。
-
提供个人网站服务,并通过浏览器测试应用。
-
简要讲授相关知识与原理。
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';