Home > Computer Tutorials > Computer Knowledge > Build a WordPress website on Ubuntu 22.04 in 9 steps

Build a WordPress website on Ubuntu 22.04 in 9 steps

PHPz
Release: 2024-02-20 15:09:22
forward
557 people have browsed it

Quickly build a WordPress website on Ubuntu 22.04. After reading the following 9 steps, you can quickly build your own WordPress site.

1. Install Apache2 and PHP.

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

<code>sudo apt update</code><code>sudo apt install apache2</code><code>sudo apt install php libapache2-mod-php php-mysql</code>
Copy after login

2. Install mariadb database

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

<code>sudo apt install mariadb-server</code>
Copy after login

In steps 3 to 6, the commands executed in the terminal can also be executed by logging in to the database and executing the corresponding SQL commands.

<code>sudo mysql -uroot -p</code>
Copy after login

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

3. Create a new database.

Suppose you want to set the database name to "wordpress", execute the following command in the terminal:

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

<code>CREATE DATABASE wordpress;</code>
Copy after login

4. Create a new database user.

Suppose you want to set the username to "linux265" and the password to the password you choose. Execute the following command in the terminal:

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

<code>CREATE USER 'linux265'@'localhost' IDENTIFIED BY 'wordpress';</code>
Copy after login

5. Grant the newly created database user all permissions on the new database.

This will allow the "linux265" user to perform any operation on the "wordpress" database, execute the following command:

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

<code>GRANT ALL PRIVILEGES ON wordpress.* TO 'linux265'@'localhost';</code>
Copy after login

6. Refresh permissions and exit MariaDB, execute the following command:

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

<code>FLUSH PRIVILEGES;</code><code>exit;</code>
Copy after login

7. Now, you can download the latest version of WordPress from the WordPress official website. Run the following command in the terminal:

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

<code>sudo wget https://cn.wordpress.org/latest-zh_CN.tar.gz</code>
Copy after login

Or download from https://cn.wordpress.org/. Unzip the downloaded WordPress file and execute the following command:

<code>sudo tar -zxvf latest-zh_CN.tar.gz</code><code>or</code><code>sudo unzip latest-zh_CN.zip</code>
Copy after login

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

8. Move the unzipped wordpress file to your website directory.

Assume that your website directory is /var/www/html, execute the following command:

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

<code>sudo mv wordpress/* /var/www/html/</code><code>sudo chown -hR www-data: /var/www/html</code>
Copy after login

9. Now, you can access the WordPress installation page through the browser.

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

Ubuntu 22.04 搭建 WordPress 网站,9 步搞定

At this point, the entire WordPress building process has been explained.

Try it on your server!

The above is the detailed content of Build a WordPress website on Ubuntu 22.04 in 9 steps. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template