I have Ubuntu Server 22.04 installed on a VM in Proxmox. I am going to set up WordPress on there. This guide will show you how to do it.
- Update your system
apt update && apt upgrade
2. Install Apache
apt install apache2
systemctl enable --now apache2
Next, go you your servers IP address in your browser.
3. Install MySQL
apt install mariadb-server mariadb-client
mysql_secure_installation
It will ask you if you want to change the root password. If you didn’t make a password for root, you can just type n. For the rest of the questions, answer yes (y) for the best security.
4. Install PHP
apt install php php-mysql
To confirm PHP is working, create a file like so
vim /var/www/html/info.php
<?php
phpinfo();
?>
Then go to your server in your browser
ip-address/info.php
5. Create a WP database (swap password for a more secure password)
$ mysql -u root -p
CREATE DATABASE wordpress_db;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON wordpress_db.* TO 'wp_user'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
Exit;
6. Install WordPress
The following commands will download WP to /tmp and extract it
cd /tmp && wget https://wordpress.org/latest.tar.gz
tar -xvf latest.tar.gz
cp -R wordpress /var/www/html/
chown -R www-data:www-data /var/www/html/wordpress/
chmod -R 755 /var/www/html/wordpress/
mkdir /var/www/html/wordpress/wp-content/uploads
chown -R www-data:www-data /var/www/html/wordpress/wp-content/uploads/
To complete WP installation, go to http://ip-address/wordpress
When you hit Lets go! you should fill in the database information from earlier.
- Database Name: wordpress_db
- Username: wp_user
- Password: password
- Database Host: localhost
- Table Prefix: wp_
You should be able to run the installation and the last step after installation would be to create a WP account and choose a site title.
Congrats! You setup your self-hosted WordPress. You can start blogging/making a website!