在Ubuntu 22.04 LTS上安装WordPress 6.2
以下是在Ubuntu上安装LAMP(Linux/Apache/MariaDB/PHP)环境的步骤。
时区的改变
sudo su -
timedatectl set-timezone Asia/Tokyo
安装Apache
apt -y update
apt -y install apache2
systemctl enable apache2
systemctl start apache2
使用网络浏览器访问 Ubuntu 20.04 服务器的IP地址(curl -w ‘\n’ ifconfig.me 进行确认),以验证是否显示 Apache 的测试页面。

安装 PHP 7.4
apt -y install php7.4 php7.4-mysql
安装 MariaDB 10.5
apt -y install mariadb-server mariadb-client
systemctl enable mariadb
systemctl start mariadb
截至2023年7月7日,已安装了MariaDB 10.5.19。
$ sudo mariadb
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 30
Server version: 10.5.19-MariaDB-0+deb11u2 Debian 11
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)]>
安装 WordPress
WordPress 下载/解压
将当前最新版的WordPress下载,并将其解压到DocumentRoot目录下。
cd /var/www/html
wget https://ja.wordpress.org/latest-ja.tar.gz
tar xvf latest-ja.tar.gz
chown -R www-data:www-data .
用WordPress创建数据库。
在MariaDB Monitor(mariadb命令)上,使用UTF8字符编码创建数据库wordpress。
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8;
创建一个 MariaDB 用户用于 WordPress。
我們要創建一個具有完整權限的 WordPress 用戶(請自行更改用戶名和密碼),僅限於剛剛建立的數據庫。
GRANT ALL ON wordpress.* TO wordpress@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
WordPress 的初始設定
使用网络浏览器访问xx.xx.xx.xx/wordpress/,进行WordPress的初始设置。


当安装成功后,您可以使用指定的用户名和密码登录到仪表板。
