How to Set Up a Home WordPress Site on Ubuntu Server

Опубликовано: 24 Март 2020
на канале: Drew Howden Tech
2,786
49

In this video, I show you how to setup a home WordPress site on Ubuntu Server.
In this tutorial, I use Ubuntu Server. Please note that this process varies from operating system to operating system.

Prerequisites:
1. 2 Computers (one of them can be virtualized) (one to use as the server, and another to download the Ubuntu Server ISO and flash it to a flash drive)
2. A Flash Drive (1 GB or larger)

Required Files:
Ubuntu Server ISO: https://ubuntu.com/download/server

If you are wondering how to create a bootable USB flash drive on Ubuntu, I made a video showing you how to do that. Click the link below to watch:
   • How To Create a Bootable Drive (Ubuntu)  

UPDATE: The MySQL command for creating a new user has changed since this video was made. It is now the command below:
CREATE USER 'wpuser'@localhost' IDENTIFIED BY '[Password]'; (example: CREATE USER 'wpuser'@localhost' IDENTIFIED BY 'StrongP@55word';)
*After you run this command, you will need to grant the WordPress user the necessary privileges (as it no longer happens automatically). To do this, run the command below:
GRANT ALL PRIVILEGES ON wpdata.* TO 'wpuser'@'localhost';
Also, the "sudo tasksel install lamp-server" command is deprecated. Use this command instead: sudo apt install apache2 ghostscript libapache2-mod-php mysql-server php php-bcmath php-curl php-imagick php-intl php-json php-mbstring php-mysql php-xml php-zip

*The list of commands below is for reference only, and is NOT in order.

Commands:
View your server's IP address: ip a (UPDATE: As of Ubuntu 20.04, it is no longer "ifconfig".)
Run commands from another computer: ssh [username]@[IP address] (example: ssh [email protected])
Set a root password: sudo passwd root (if you want to know why you should run this, I encourage you to check out the video at the link below:
   • How to Prevent Unauthorized Root Acce...  )
Install updates: sudo apt update && sudo apt upgrade
Install vsftpd: sudo apt install vsftpd
Modify the vsftpd configuration file: sudo nano /etc/vsftpd.conf
Restart vsftpd: sudo systemctl restart vsftpd
Install web server packages: sudo apt install apache2 ghostscript libapache2-mod-php mysql-server php php-bcmath php-curl php-imagick php-intl php-json php-mbstring php-mysql php-xml php-zip
Configure mysql: sudo mysql -u root -p
Create the WordPress database: CREATE DATABASE wpdata;
Create the WordPress user: CREATE USER 'wpuser'@localhost' IDENTIFIED BY '[Password]'; (example: CREATE USER 'wpuser'@localhost' IDENTIFIED BY 'StrongP@55word';)
Grant the WordPress user the necessary permissions: GRANT ALL PRIVILEGES ON wpdata.* TO 'wpuser'@'localhost'; (example: GRANT ALL PRIVILEGES ON wpdata.* TO 'wpuser'@'localhost';)
Exit mysql configuration: exit
Switch to the website directory: cd /var/www/html
Download WordPress (make sure you are in the website directory before running): sudo wget wordpress.org/latest.tar.gz
Install WordPress (make sure you are in the website directory before running): sudo tar -xvf latest.tar.gz
Allow the website directory to be read from and written to by WordPress (make sure you are in the website directory before running): sudo chmod 777 -R .
Restart the server: sudo shutdown now -r
Shut down the server: sudo shutdown now

Template index.html Code (make sure to replace [your server's IP address] with your server's actual IP address):
https://drive.google.com/file/d/1e9VV...

*To edit your WordPress site, just type [your server's IP address]/wordpress/wp-admin (example: 192.168.0.157/wordpress/wp-admin) into your web browser's address bar.