Home > Article > Computer Tutorials > Build 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.
<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
<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>
3. Create a new database.
Suppose you want to set the database name to "wordpress", execute the following command in the terminal:
<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:
<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:
<code>GRANT ALL PRIVILEGES ON wordpress.* TO 'linux265'@'localhost';</code>
6. Refresh permissions and exit MariaDB, execute the following command:
<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:
<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>
8. Move the unzipped wordpress file to your website directory.
Assume that your website directory is /var/www/html
, execute the following command:
<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.
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!