How to Install WordPress on Ubuntu – Video & Code

Easy Install WordPress on Ubuntu Desktop! Only copy the code in accordance with the tutorial video. It takes about 30 minutes. Go quickstart!
  • Switch from DHCP to Static IP on Ubuntu
  • No XAMPP
  • Allow to add extra sites


This tutorial is About 17 minutes. It is started from the initial state on Ubuntu installed only. Jump to a time whenever you want.


01. Check your location [0:24]
02. DHCP to StaticIP [0:36]
03. Update Ubuntu packages [3:14]
04. Install LAMP [4:15]
05. Update PHP [6:00]
06. Change the MySQL Configuration [6:12]
07. Create a new database of a WordPress [7:22]
08. Install phpMyAdmin [7:44]
09. Download WordPress via curl [8:51]
10. Install WordPress [10:32]
11. Set up the connection between WordPress and MySQL [11:51]
12. Enter information about the Web [15:02]


You can download the Excel on the video here.


If you watch this on desktop, You can open a new window with this button. You can watch the video and the command, simultaneously.

Commands & Hints

01. Check your location [0:24]

Change from the menu on the upper right corner.

02. DHCP to StaticIP [0:36]

Ubuntu has a short break problem on DHCP. To avoid this, change the network to static IP. In addition, if you want to access from outside of the wordpress server, you had better to set static IP.

03. Update Ubuntu packages [3:14]

Well-known command. Make sure you do this.

# Update the package list.
sudo apt-get update
sudo apt-get upgrade

04. Install LAMP [4:15]

Using ‘tasksel’ command is a simple way to install LAMP. It’s useful to install popular programs.

# Install LAMP
sudo apt-get install tasksel
sudo tasksel install lamp-server
# Define your root password on mySQL.
# Check 'localhost' after installing.

# Check the status by 'tasksel'
sudo tasksel

05. Update PHP [6:00]

Re-install PHP.

sudo apt-get install php

06. Change the MySQL Configuration [6:12]

Change the bind address setting and Character code.

sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf
# --- Comment out the following. ---
#bind-address		=

# --- Add the followings ---
default-character-set = utf8
character-set-server = utf8
default-character-set = utf8

After Setting, check it.

sudo systemctl restart mysql
mysql -u root -p
# Login by root
mysql> show variables like '%char%';

The following is the correct pattern.

| Variable_name            | Value                      |
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |

07. Create a new database of a WordPress [7:22]

Keep the ‘root’ login, and create the database for wordpress.

mysql> create database wordpress;
mysql> quit;

08. Install phpMyAdmin [7:44]

‘phpMyAdmin’ is a useful tool to check your database. It’s not necessary, but It’s useful for maintainance.

sudo apt-get install phpmyadmin

Check from the web browser if it moves or not after installing.

09. Download WordPress via curl [8:51]

Wp-Cli is a command tool to use WordPress. At first, download curl. And next, download Wp-Cli via curl. After installing Wp-Cli, download WordPress files at ‘tmp’.

# Install Curl & Wp-Cli
sudo apt-get install curl
curl -O
chmod +x wp-cli.phar # Change privilege
sudo mv wp-cli.phar /usr/local/bin/wp # Path
wp --info #Check

# Download WordPress
wp core download --path=/tmp/wordpress

# Not in English (Ex. Japanese)
wp core download --locale=ja --path=/tmp/wordpress

10. Install WordPress [10:32]

Optimize privileges and copy them to the apache server.

# Before copying
touch /tmp/wordpress/.htaccess
chmod 660 /tmp/wordpress/.htaccess
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
mkdir /tmp/wordpress/wp-content/upgrade

# Copy the files to the apache server.
sudo cp -a /tmp/wordpress/. /var/www/html/wordpress

# Change the priviledges
sudo chmod g+w /var/www/html/wordpress/wp-content
sudo chmod -R g+w /var/www/html/wordpress/wp-content/themes
sudo chmod -R g+w /var/www/html/wordpress/wp-content/plugins
sudo chown -R sysadmin:www-data /var/www/html/wordpress

# Configure Apache2
sudo gedit /etc/apache2/apache2.conf

Add the following.

<Directory /var/www/htm/wordpress>
AllowOverride All

Return to shell, and reflect the change.

# 設定の反映
sudo apache2ctl configtest
sudo a2enmod rewrite
sudo systemctl restart apache2

Set up the connection between WordPress and MySQL [11:51]

Set up the connection between WordPress and MySQL.

# Secret key
curl -s
# Copy the key to editor, temporary.

# Configure the connect setting to the Database.
sudo gedit /var/www/html/wordpress/wp-config.php
# Set ID, PW, DB and the key.

# make a config file.
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/010-wordpress.conf
sudo gedit /etc/apache2/sites-available/010-wordpress.conf
# Change 'DocumentRoot' to '/var/www/html/wordpress'

# Reboot
sudo reboot

Enter information about the Web [15:02]

Continue to set up on the WordPress web.

What for?

In the beginning, it was hard to construct development environment of WordPress. There is another way to use XAMPP, but it’s a black box. That’s why I made from scratch. If you use production environment by the auto installer on some rental servers, this method is a suitable way to construct development environment of WordPress.