search
HomeComputer TutorialsComputer KnowledgeBuild a WordPress website on Ubuntu 22.04 in 9 steps

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>

2. Install mariadb database

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

<code>sudo apt install mariadb-server</code>

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>

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>

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>

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>

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

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

<code>FLUSH PRIVILEGES;</code><code>exit;</code>

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>

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>

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>

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!

Statement
This article is reproduced at:每日运维. If there is any infringement, please contact admin@php.cn delete
[Fixed] You Need to Authenticate Microsoft Services in Minecraft? - MiniTool[Fixed] You Need to Authenticate Microsoft Services in Minecraft? - MiniToolApr 27, 2025 am 12:51 AM

In this post, php.cn provides several effective solutions to the “you need to authenticate to Microsoft services” issue in Minecraft on the PC. If you get stuck in this issue, you should pay attention to this post.

Top 4 Fixes for High Power Usage in Task ManagerTop 4 Fixes for High Power Usage in Task ManagerApr 27, 2025 am 12:49 AM

In Task Manager, you can view how much power the processes on your computer use. What if you receive high power usage in Task Manager constantly?  In this post from php.cn Website, we will explore how to address this issue easily and effectively.

2 Windows Folders in C Drive: How to Deal with Them?2 Windows Folders in C Drive: How to Deal with Them?Apr 27, 2025 am 12:48 AM

The Windows folder contains the Windows operating system and is a crucial folder in Windows computers. Sometimes, you may see 2 Windows folders in the C drive. How to delete one of them? This post from php.cn tells you how to do that.

Top 4 Halo Infinite Trackers to Track KD, Stats, Ranks, and More! - MiniToolTop 4 Halo Infinite Trackers to Track KD, Stats, Ranks, and More! - MiniToolApr 27, 2025 am 12:47 AM

Many people are looking for a feasible Halo Infinite tracker. In this post, php.cn introduces several available Halo Infinite trackers to help you track the Halo Infinite KD, ranks, stats, etc. Now, keep on your reading.

10 Best Google Sheets Add-ons You Must Have - MiniTool10 Best Google Sheets Add-ons You Must Have - MiniToolApr 27, 2025 am 12:46 AM

Have you ever heard of Google Sheets add-ons? Do you have any idea how to install them in your Google Sheets? Do you want to get the best and the free Google Sheets add-ons? This article on php.cn focuses on these questions and provides you with seve

Enable/Disable Ctrl Alt Delete Secure Sign-In on Windows 11 - MiniToolEnable/Disable Ctrl Alt Delete Secure Sign-In on Windows 11 - MiniToolApr 27, 2025 am 12:45 AM

Secure Sign-In is a handy way to keep your PC safe, but if you don't want it around, here's how to disable it for Windows 11. This post from php.cn provides 3 ways for you to enable or disable Ctrl Alt Delete secure sign-in on Windows 11.

How to Fix Word Dictation Not Working Issue in Windows 10 - MiniToolHow to Fix Word Dictation Not Working Issue in Windows 10 - MiniToolApr 27, 2025 am 12:44 AM

Have you ever heard of Microsoft Word dictation? What if Word dictation not working? This post from php.cn shows you the basic information about Word dictation and some feasible ways to fix the “Word dictation not working” issue.

What Is Atlas VPN? How to Free Download Atlas VPN for Use? - MiniToolWhat Is Atlas VPN? How to Free Download Atlas VPN for Use? - MiniToolApr 27, 2025 am 12:43 AM

What is Atlas VPN used for? Is Atlas VPN safe? Can you use Atlas VPN for free? How to download Atlas VPN & install it on your device for use? Refer to this post from php.cn and you can find details about this VPN service and Atlas VPN download fo

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),