WordPress Wednesdays: Basic WordPress Setup on a VPS Server

For this new addition to “WordPress Wednesdays”, I have created this basic WordPress setup tutorial where you take a basic OpenVZ or Xen virtual private server, set up the minimum requirements of WordPress and start your new blog. In today’s later article, I will explain how to restore a backup.

Requirements:

1. Virtual Private Server:
Your WordPress installation needs a Linux operating system to run a web server, MySQL and PHP. Most Linux distributions come with a web server, such as Apache, by default and through the package managers on the operating system, we can install additional requirements that we need.

The minimum requirements, I would recommend, for a VPS to run WordPress is 512mb RAM, 1024mb burstable RAM or swap space, 20gb disk space, and 250gb bandwidth minimum. If you plan on using a lot of graphics or a lot of traffic, you may want to use 500gb of network transfer. If you are going to be traffic or resource-intensive, with lots of WordPress plugins, please go with a Xen VPS for a few dollars per month.

Other websites, blogs, and users online would say that 512mb of RAM is “too much” and you could use fewer resources but I will argue the following:

– You can indeed use 64mb RAM and 128mb burstable RAM with a WordPress site but with traffic spikes, themes and plugins you would spend more time fine-tuning your “low end” virtual private server rather than posting on your WordPress site.

– The first traffic spike you receive, such as your link being shared on social network sites or online where 10 – 20 people access that VPS at one time, will cause performance issues where you wish you had additional resources to handle the load. The folks who promote 64mb RAM don’t mention how they constantly work on their virtual private server like one of those cars you constantly work on to keep running.

I don’t know about you but do you have the time to fine-tune PHP, your web browser and operating system?

– WordPress plugins require a lot of memory. For example, Google XML Sitemaps by Arnie Brachold requires almost 23mb of memory to run and generate an XML sitemap. If you have 64mb of RAM guaranteed to your VPS and need 23mb to run this plugin, how much RAM are you using with your operating system and other files?

2. VPS Hosting Location:
Your hosting location means a lot for your WordPress blog. For example, if your audience is primarily the United States and with all your American friends I would go with a Central US hosting location such as Chicago, Dallas or Kansas City, Missouri. These would give visitors in the US the same distance to connect to your server. If you are on the West Coast, it’s not a long distance to Central US same as from East Coast to Central US.

If you have your site hosted on the West Coast of the US and your audience is primarily East Coast, you may have complaints of slowness when some folks try to connect. Keeping your hosting location centrally located is always good.

If you are from Europe, I would consider Germany, Austria or the Czech Republic as a central location for Europe if your audience is from Europe.

3. Operating System:
For this example, I am going to use Ubuntu Linux as it provides unattended updates out of the box and relatively easy to use, it’s stable and since it automatically updates there will be no requirement for server maintenance.

Virtual Private Server Setup:
After we receive our login details from our VPS hosting company, we can start setting up our web server, which is Apache, and the necessary requirements for hosting our own WordPress content management system.

This Xen VPS is located in Chicago, Illinois to provide central US hosting location to our visitors in the tutorial.

Our VPS was issued, so we login via SSH and verify that we have the necessary memory with the free -m command. free displays memory usage and the -m switch displays it in megabytes rather than bytes.

# free -m
total used free shared buffers cached
Mem: 493 48 444 0 1 18
-/+ buffers/cache: 28 465
Swap: 1023 0 1023
We have 48mb in use by the operating system and 444mb free, which is more than enough memory for our WordPress project.

First, we install the Apache webserver with the following command:
apt-get update; apt-get install apache2

# apt-get install apache2
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
apache2-MPM-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3
libaprutil1-LDAP libcap2 SSL-cert
Suggested packages:
apache2-doc apache2-suexec apache2-suexec-custom ufw OpenSSL-blacklist
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap libcap2 ssl-cert
0 upgraded, 11 newly installed, 0 to remove and 75 not upgraded.
Need to get 1,841 kB of archives.
After this operation, 5,368 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ precise/main libcap2 i386 1:2.22-1ubuntu3 [12.4 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ precise/main libapr1 i386 1.4.6-1 [91.3 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ precise/main libaprutil1 i386 1.3.12+dfsg-3 [75.4 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ precise/main libaprutil1-dbd-sqlite3 i386 1.3.12+dfsg-3 [10.2 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ precise/main libaprutil1-ldap i386 1.3.12+dfsg-3 [7,962 B]
Get:6 http://archive.ubuntu.com/ubuntu/ precise/main apache2.2-bin i386 2.2.22-1ubuntu1 [1,317 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ precise/main apache2-utils i386 2.2.22-1ubuntu1 [89.2 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ precise/main apache2.2-common i386 2.2.22-1ubuntu1 [221 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ precise/main apache2-mpm-worker i386 2.2.22-1ubuntu1 [2,290 B]
Get:10 http://archive.ubuntu.com/ubuntu/ precise/main apache2 i386 2.2.22-1ubuntu1 [1,496 B]
Get:11 http://archive.ubuntu.com/ubuntu/ precise-updates/main ssl-cert all 1.0.28ubuntu0.1 [12.3 kB]
Fetched 1,841 kB in 1s (1,128 kB/s)
Preconfiguring packages …
Selecting previously unselected package libcap2.
(Reading database … 21017 files and directories currently installed.)
Unpacking libcap2 (from …/libcap2_1%3a2.22-1ubuntu3_i386.deb) …
Selecting previously unselected package libapr1.
Unpacking libapr1 (from …/libapr1_1.4.6-1_i386.deb) …
Selecting previously unselected package libaprutil1.
Unpacking libaprutil1 (from …/libaprutil1_1.3.12+dfsg-3_i386.deb) …
Selecting previously unselected package libaprutil1-dbd-sqlite3.
Unpacking libaprutil1-dbd-sqlite3 (from …/libaprutil1-dbd-sqlite3_1.3.12+dfsg-3_i386.deb) …
Selecting previously unselected package libaprutil1-ldap.
Unpacking libaprutil1-ldap (from …/libaprutil1-ldap_1.3.12+dfsg-3_i386.deb) …
Selecting previously unselected package apache2.2-bin.
Unpacking apache2.2-bin (from …/apache2.2-bin_2.2.22-1ubuntu1_i386.deb) …
Selecting previously unselected package apache2-utils.
Unpacking apache2-utils (from …/apache2-utils_2.2.22-1ubuntu1_i386.deb) …
Selecting previously unselected package apache2.2-common.
Unpacking apache2.2-common (from …/apache2.2-common_2.2.22-1ubuntu1_i386.deb) …
Selecting previously unselected package apache2-mpm-worker.
Unpacking apache2-mpm-worker (from …/apache2-mpm-worker_2.2.22-1ubuntu1_i386.deb) …
Selecting previously unselected package apache2.
Unpacking apache2 (from …/apache2_2.2.22-1ubuntu1_i386.deb) …
Selecting previously unselected package ssl-cert.
Unpacking ssl-cert (from …/ssl-cert_1.0.28ubuntu0.1_all.deb) …
Processing triggers for man-db …
Processing triggers for ureadahead …
ureadahead will be reprofiled on next reboot
Setting up libcap2 (1:2.22-1ubuntu3) …
Setting up libapr1 (1.4.6-1) …
Setting up libaprutil1 (1.3.12+dfsg-3) …
Setting up libaprutil1-dbd-sqlite3 (1.3.12+dfsg-3) …
Setting up libaprutil1-ldap (1.3.12+dfsg-3) …
Setting up apache2.2-bin (2.2.22-1ubuntu1) …
Setting up apache2-utils (2.2.22-1ubuntu1) …
Setting up apache2.2-common (2.2.22-1ubuntu1) …
Enabling site default.
Enabling module alias.
Enabling module autoindex.
Enabling module dir.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module status.
Enabling module auth_basic.
Enabling module deflate.
Enabling module authz_default.
Enabling module authz_user.
Enabling module authz_groupfile.
Enabling module authn_file.
Enabling module authz_host.
Enabling module reqtimeout.
Setting up apache2-mpm-worker (2.2.22-1ubuntu1) …
* Starting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 1.2.3.4 for ServerName
[ OK ]
Setting up apache2 (2.2.22-1ubuntu1) …
Setting up ssl-cert (1.0.28ubuntu0.1) …
Processing triggers for libc-bin …
ldconfig deferred processing now taking place
Our web server is running, since * Starting web server apache2 was output to our screen. We verify this with lsof -i :80 which confirms that Apache is running.

Next, we install PHP5 with the following command:
apt-get install libapache2-mod-php5

# apt-get install libapache2-mod-php5
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
apache2-mpm-prefork php5-cli php5-common
Suggested packages:
php-pear php5-suhosin
The following packages will be REMOVED:
apache2-mpm-worker
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 php5-cli php5-common
0 upgraded, 4 newly installed, 1 to remove and 75 not upgraded.
Need to get 6,358 kB of archives.
After this operation, 17.3 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ precise/main apache2-mpm-prefork i386 2.2.22-1ubuntu1 [2,400 B]
Get:2 http://archive.ubuntu.com/ubuntu/ precise-updates/main php5-common i386 5.3.10-1ubuntu3.4 [162 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ precise-updates/main libapache2-mod-php5 i386 5.3.10-1ubuntu3.4 [3,108 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ precise-updates/main php5-cli i386 5.3.10-1ubuntu3.4 [3,085 kB]
Fetched 6,358 kB in 3s (1,610 kB/s)
dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you requested:
apache2 depends on apache2-mpm-worker (= 2.2.22-1ubuntu1) | apache2-mpm-prefork (= 2.2.22-1ubuntu1) | apache2-mpm-event (= 2.2.22-1ubuntu1) | apache2-mpm-itk (= 2.2.22-1ubuntu1); however:
Package apache2-mpm-worker is to be removed.
Package apache2-mpm-prefork is not installed.
Package apache2-mpm-event is not installed.
Package apache2-mpm-itk is not installed.
(Reading database … 21608 files and directories currently installed.)
Removing apache2-mpm-worker …
* Stopping web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 1.2.3.4 for ServerName
… waiting . [ OK ]
Selecting previously unselected package apache2-mpm-prefork.
(Reading database … 21603 files and directories currently installed.)
Unpacking apache2-mpm-prefork (from …/apache2-mpm-prefork_2.2.22-1ubuntu1_i386.deb) …
Setting up apache2-mpm-prefork (2.2.22-1ubuntu1) …
* Starting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 1.2.3.4 for ServerName
[ OK ]
Selecting previously unselected package php5-common.
(Reading database … 21608 files and directories currently installed.)
Unpacking php5-common (from …/php5-common_5.3.10-1ubuntu3.4_i386.deb) …
Selecting previously unselected package libapache2-mod-php5.
Unpacking libapache2-mod-php5 (from …/libapache2-mod-php5_5.3.10-1ubuntu3.4_i386.deb) …
Selecting previously unselected package php5-cli.
Unpacking php5-cli (from …/php5-cli_5.3.10-1ubuntu3.4_i386.deb) …
Processing triggers for man-db …
Setting up php5-common (5.3.10-1ubuntu3.4) …
Setting up libapache2-mod-php5 (5.3.10-1ubuntu3.4) …

Creating config file /etc/php5/apache2/php.ini with new version
* Restarting web server apache2 apache2: Could not reliably determine the server’s fully qualified domain name, using 1.2.3.4 for ServerName
… waiting apache2: Could not reliably determine the server’s fully qualified domain name, using 1.2.3.4 for ServerName
[ OK ]
Setting up php5-cli (5.3.10-1ubuntu3.4) …

Creating config file /etc/php5/cli/php.ini with new version
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode.
We confirm that PHP is installed with the php -v command, which is required by WordPress.

# php -v
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 19:00:43)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
Now, we have Apache and PHP but need MySQL running as WordPress has it’s data stored in a SQL database. We issue the command apt-get install mysql-server to get this installed.

# apt-get install mysql-server php5-mysql
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libnet-daemon-perl libplrpc-perl
mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server-5.5 mysql-server-core-5.5
Suggested packages:
libipc-sharedcache-perl libterm-readkey-perl tinyca mailx
The following NEW packages will be installed:
libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libnet-daemon-perl libplrpc-perl
mysql-client-5.5 mysql-client-core-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5
0 upgraded, 12 newly installed, 0 to remove and 75 not upgraded.
Need to get 26.5 MB of archives.
After this operation, 91.9 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://archive.ubuntu.com/ubuntu/ precise-updates/main mysql-common all 5.5.24-0ubuntu0.12.04.1 [13.5 kB]
Get:2 http://archive.ubuntu.com/ubuntu/ precise-updates/main libmysqlclient18 i386 5.5.24-0ubuntu0.12.04.1 [921 kB]
Get:3 http://archive.ubuntu.com/ubuntu/ precise/main libnet-daemon-perl all 0.48-1 [43.1 kB]
Get:4 http://archive.ubuntu.com/ubuntu/ precise/main libplrpc-perl all 0.2020-2 [36.0 kB]
Get:5 http://archive.ubuntu.com/ubuntu/ precise/main libdbi-perl i386 1.616-1build2 [849 kB]
Get:6 http://archive.ubuntu.com/ubuntu/ precise/main libdbd-mysql-perl i386 4.020-1build2 [104 kB]
Get:7 http://archive.ubuntu.com/ubuntu/ precise-updates/main mysql-client-core-5.5 i386 5.5.24-0ubuntu0.12.04.1 [1,859 kB]
Get:8 http://archive.ubuntu.com/ubuntu/ precise-updates/main mysql-client-5.5 i386 5.5.24-0ubuntu0.12.04.1 [8,067 kB]
Get:9 http://archive.ubuntu.com/ubuntu/ precise-updates/main mysql-server-core-5.5 i386 5.5.24-0ubuntu0.12.04.1 [5,799 kB]
Get:10 http://archive.ubuntu.com/ubuntu/ precise-updates/main mysql-server-5.5 i386 5.5.24-0ubuntu0.12.04.1 [8,714 kB]
Get:11 http://archive.ubuntu.com/ubuntu/ precise/main libhtml-template-perl all 2.10-1 [65.0 kB]
Get:12 http://archive.ubuntu.com/ubuntu/ precise-updates/main mysql-server all 5.5.24-0ubuntu0.12.04.1 [11.7 kB]
Fetched 26.5 MB in 15s (1,757 kB/s)
Preconfiguring packages …
Selecting previously unselected package mysql-common.
(Reading database … 21655 files and directories currently installed.)
Unpacking mysql-common (from …/mysql-common_5.5.24-0ubuntu0.12.04.1_all.deb) …
Selecting previously unselected package libmysqlclient18.
Unpacking libmysqlclient18 (from …/libmysqlclient18_5.5.24-0ubuntu0.12.04.1_i386.deb) …
Selecting previously unselected package libnet-daemon-perl.
Unpacking libnet-daemon-perl (from …/libnet-daemon-perl_0.48-1_all.deb) …
Selecting previously unselected package libplrpc-perl.
Unpacking libplrpc-perl (from …/libplrpc-perl_0.2020-2_all.deb) …
Selecting previously unselected package libdbi-perl.
Unpacking libdbi-perl (from …/libdbi-perl_1.616-1build2_i386.deb) …
Selecting previously unselected package libdbd-mysql-perl.
Unpacking libdbd-mysql-perl (from …/libdbd-mysql-perl_4.020-1build2_i386.deb) …
Selecting previously unselected package mysql-client-core-5.5.
Unpacking mysql-client-core-5.5 (from …/mysql-client-core-5.5_5.5.24-0ubuntu0.12.04.1_i386.deb) …
Selecting previously unselected package mysql-client-5.5.
Unpacking mysql-client-5.5 (from …/mysql-client-5.5_5.5.24-0ubuntu0.12.04.1_i386.deb) …
Selecting previously unselected package mysql-server-core-5.5.
Unpacking mysql-server-core-5.5 (from …/mysql-server-core-5.5_5.5.24-0ubuntu0.12.04.1_i386.deb) …
Processing triggers for man-db …
Setting up mysql-common (5.5.24-0ubuntu0.12.04.1) …
Selecting previously unselected package mysql-server-5.5.
(Reading database … 22021 files and directories currently installed.)
Unpacking mysql-server-5.5 (from …/mysql-server-5.5_5.5.24-0ubuntu0.12.04.1_i386.deb) …
Selecting previously unselected package libhtml-template-perl.
Unpacking libhtml-template-perl (from …/libhtml-template-perl_2.10-1_all.deb) …
Selecting previously unselected package mysql-server.
Unpacking mysql-server (from …/mysql-server_5.5.24-0ubuntu0.12.04.1_all.deb) …
Processing triggers for man-db …
Processing triggers for ureadahead …
Setting up libmysqlclient18 (5.5.24-0ubuntu0.12.04.1) …
Setting up libnet-daemon-perl (0.48-1) …
Setting up libplrpc-perl (0.2020-2) …
Setting up libdbi-perl (1.616-1build2) …
Setting up libdbd-mysql-perl (4.020-1build2) …
Setting up mysql-client-core-5.5 (5.5.24-0ubuntu0.12.04.1) …
Setting up mysql-client-5.5 (5.5.24-0ubuntu0.12.04.1) …
Setting up mysql-server-core-5.5 (5.5.24-0ubuntu0.12.04.1) …
Setting up mysql-server-5.5 (5.5.24-0ubuntu0.12.04.1) …
121006 16:02:04 [Note] Plugin ‘FEDERATED’ is disabled.
121006 16:02:04 InnoDB: The InnoDB memory heap is disabled
121006 16:02:04 InnoDB: Mutexes and rw_locks use GCC atomic builtins
121006 16:02:04 InnoDB: Compressed tables use zlib 1.2.3.4
121006 16:02:04 InnoDB: Initializing buffer pool, size = 128.0M
121006 16:02:04 InnoDB: Completed initialization of buffer pool
121006 16:02:04 InnoDB: highest supported file format is Barracuda.
121006 16:02:04 InnoDB: Waiting for the background threads to start
121006 16:02:05 InnoDB: 1.1.8 started; log sequence number 1595675
121006 16:02:05 InnoDB: Starting shutdown…
121006 16:02:06 InnoDB: Shutdown completed; log sequence number 1595675
mysql start/running, process 3755
Setting up libhtml-template-perl (2.10-1) …
Setting up mysql-server (5.5.24-0ubuntu0.12.04.1) …
Processing triggers for libc-bin …
ldconfig deferred processing now taking place
During this, you were prompted to create a MySQL root user password. Please remember the password you created! If not, no big deal and we can always reset the MySQL root password at a later date.

The memory consumption looked really high, almost with 400mb used and if that happens, we just reboot our Xen virtual private server for the memory consumption to go down. This happens during the “first boot”

For example:

# free -m
total used free shared buffers cached
Mem: 493 461 31 0 16 381
-/+ buffers/cache: 64 429
Swap: 1023 0 1023
This was after I installed Apache, PHP and MySQL but after the reboot

# free -m
total used free shared buffers cached
Mem: 493 103 390 0 2 46
-/+ buffers/cache: 54 439
Swap: 1023 0 1023
I don’t know what causes it but it sometimes seems like memory is not released when you setup a virtual private server however this is all the setup we need to do to meet WordPress requirements.

WordPress:
Now we’re dealing with WordPress now and not with Ubuntu Linux or WordPress’ dependencies. For simplicity’s sake in this tutorial, we are going to install WordPress in /var/www as this is just a basic tutorial about how to create a brand new WordPress site on a brand new Ubuntu VPS.

First, we go into /var/www with cd /var/www command.

Now we verify it with the pwd command:

# pwd
/var/www
Looking great! We download the WordPress installation files from the WordPress site. The latest, stable version will be latest.zip and you can download it here or the URL is always wordpress.org/latest.zip

# wget wordpress.org/latest.zip
–2012-10-06 16:31:51– http://wordpress.org/latest.zip
Resolving wordpress.org (wordpress.org)… 72.233.56.139, 72.233.56.138
Connecting to wordpress.org (wordpress.org)|72.233.56.139|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: unspecified [application/zip]
Saving to: `latest.zip’

[ ] 4,920,954 6.84M/s in 0.7s

2012-10-06 16:31:53 (6.84 MB/s) – `latest.zip’ saved [4920954]
We extract the files with unzip latest.zip:

apt-get install unzip -y
unzip latest.zip
We move the files out of the wordpress/ directory that was just created:

cd wordpress/
mv * ../
chmod -R 755 /var/www
Receive an error that says: Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

Run apt-get install php5-mysql and do not forget to run the chmod command at the end or at the end of the WordPress installation, you will have to manually create a config.php file and paste in the configuration file into config.php

If you visit the IP address of your virtual private server in your web browser, you should have a WordPress installation message. An example of a message is:

There doesn’t seem to be a wp-config.php file. I need this before we can get started.

Need more help? We got it.

You can create a wp-config.php file through a web interface, but this doesn’t work for all server setups. The safest way is to manually create the file.

If you see this, it means everything is good with your WordPress installation for now and you have a web server, PHP, and the WordPress files set up properly.

We click the “Create a configuration file” down at the bottom. The next screen we are prompted for says:

Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.

Database name
Database username
Database password
Database host
Table prefix (if you want to run more than one WordPress in a single database)
If for any reason this automatic file creation doesn’t work, don’t worry. All this does is fill in the database information to a configuration file. You may also simply open wp-config-sample.php in a text editor, fill in your information, and save it as wp-config.php.

In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you’re all ready…

We click “Let’s go!” down at the bottom.

Ok, we are asked for some information we need to setup. Please switch back to your SSH client and type in the following commands:

MySQL -u root -p
Remember the MySQL password we set up earlier? We need that password when you hit enter after typing in that command. If you successfully put in your password, you will see:

# MySQL -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \g.
Your MySQL connection id is 36
Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>
To set up a MySQL database, with a username and password, we need to type the following commands:

CREATE DATABASE wpsite;
GRANT ALL ON wpsite.* To [email protected] IDENTIFIED BY ‘RyajTedrej8wud2HukOs’;
MySQL output:

# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 36
Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> CREATE DATABASE wpsite;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL ON wpsite.* To [email protected] IDENTIFIED BY ‘RyajTedrej8wud2HukOs’;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
This creates the database wpsite, the user wpsite and the password RyajTedrej8wud2HukOs, which we put in the WordPress configuration page. We keep the server localhost in the configuration page and I change my WordPress tables from wp_ to something random like w11p_ in case there is some kind of worm that runs around breaking into WordPress sites and goes after stuff in wp_ tables. There is self replicating code on the Internet that goes after default database and table names in ecommerce sites so I know it’s not too paranoid to think like this for a WordPress site 😉

If you did you chmod -R 755 /var/www you will have to create a /var/www/config.php file and paste in the configuration file that WordPress just provided you.

After that is done, you are prompted on a welcome screen for some website information. All this information you put in can be changed later on and please remember your admin password.

# free -m
total used free shared buffers cached
Mem: 493 293 200 0 6 153
-/+ buffers/cache: 133 360
Swap: 1023 0 1023
The whole Apache web server, PHP and MySQL plus the Ubuntu operating system use 293mb total on this Xen virtual private server with 200mb of free RAM. This web server configuration should be more than sufficient for a small to medium WordPress website. It should handle more than enough traffic. If you want to use less memory, I am going to write up a tutorial about how to replace nginx web server instead of Apache.

Replacing nginx with Apache requires:

  • Uninstalling Apache
  • Installing Nginx from the package
  • Installing PHP-FPM to provide PHP as libapache2-mod-php5 provides PHP support with Apache and we uninstalled Apache.
  • The next WordPress Wednesday tutorial will teach you how to do these steps on our same Ubuntu Xen VPS setup.
Proadvisor247
Logo