How to install WordPress 4.1 on Ubuntu 14.10

WordPress is the “de facto” standard when talking about blogs. Furthermore, WP is not restricted to the blog universe – WP is largely used as a CMS to make non-blog websites. 23% of the whole internet are build with WordPress. Sites like Time, TechCrunch, The New Yorker, Fortune, Variety, Sony, Reuters, GM, Best Buy, and so on. And more important: WP was the platform that I choose to publish this blog🙂

So if you want to publish a blog, the fastest way is to access the site and create a free account. But beware: is **not** “the” WordPress. is just a hosting enterprise that uses wordpress. “The” WP is actually a open-source PHP software that you download and install at you own server and can be accessed at Hosting at is cool, but your domain will be something like “” and not just “” – not much professional. If you want a personalized domain name, you just pay for them and they will do all the process to you. It is easy, but I like to control my things at maximum, like a Stalin of software. I like to be free to change the code, install plugins, and so on. So, I decide to migrate from to my own server.

The recipe:

1. Buy a domain:

There are many domain name registrar providers. I choose Go Daddy to buy the, and payed just US$ 0.99, but was a promotional discount – by now the prices are about US$ 13/year.

2. Buy a cloud server:

As the domain name register providers, there are many options to buy cloud servers. I’m using a local provider (of my city), but there are many options like AWS (the first machine is free, but you need one credit card to create an account), or Digital Ocean (US$ 5/month). Or you can host at your home or at your company – if you have a fixed IP and a specific computer for that.

2. Download WordPress:

Go to and download it. I’m using the 4.1 version. It’s a small file (5.9 MB).

At your server (please don’t do like me – I had downloaded in my PC):

# mkdir -p ~/install

# cd ~/install

# wget

# tar -xf latest.tar.gz

# cd wordpress

3. You need to have Apache + PHP 5 + MySQL installed:

I’m using Apache 2.4 and PHP 5.6. Check my tutorial of how to install Apache + PHP if you need. You need to check if your Apache + PHP are working before proceed. Check the versions with: “apache2 -v” and “php5 -v”

To the database, I’m using the MySQL 5.5, installed via apt-get (check with “mysql –version”).

# sudo apt-get install mysql-server-5.5 mysql-client-5.5

yeap, my PC is configured to the portuguese language
yeap, my PC is configured to the portuguese language

# mysql -u root -p

Inform the password that you define while installing the server. Once inside the mysql prompt, create the user and database for our blog (for example, user will be “lwdblog”, password “123456”, database “lwdblog”).

mysql> CREATE DATABASE lwdblog;

mysql> GRANT USAGE on *.* to lwdblog@localhost identified by ‘123456’;

mysql> GRANT ALL PRIVILEGES ON lwdblog.* to lwdblog@localhost;

Exit (type “quit” and press enter) and test the new user / database:

# mysql -u lwdblog -p

mysql> use lwdblog

PS: To change the password (to ‘102030’, for example), type “SET PASSWORD = PASSWORD(‘102030’);” at mysql prompt.

PS II: The best way to manage a MySQL server is with the Oracle’s MySQL Workbench, that you will install on your PC (not on the server). But in order to be possible to access remotely, you need to change your /etc/mysql/my.cnf:

#bind-address = <—- comment this line and add the below
bind-address =

4. Create a PHP folder with the WP and create the Apache configuration:

# cd

# sudo mkdir -p /var/www/

# sudo mv ~/install/wordpress /var/www/

# sudo mkdir -p /var/www/

# sudo chown -R www-data.www-data /var/www/

# sudo nano /etc/apache2/sites-available/

Note that you can name this conf file as you want but never forget the “.conf” extension!

<VirtualHost *:80>
DocumentRoot /var/www/
ErrorLog /var/www/
CustomLog /var/www/ combined

DirectoryIndex index.php
AddHandler php-script .php

Note that *:80. Never use something like “<VirtualHost>”. Always use “*:80” even if you have many virtualhost. Is the ServerName and the ServerAlias directives that will tell to Apache what the correct VirtualHost. If you have multiple domain names pointing to this site, you can add multiple ServerAlias. Also note that I use a “log” folder to the logs and a “public” folder for the site itself.

5. Enable the site, test (“Syntax OK”), restart Apache:

# sudo a2ensite

# apachectl -t

# sudo /etc/init.d/apache2 restart

6. Point your DNS to your Cloud Server

normally your domain name register provider (GoDaddy, NameCheap, …) have an interface to add DNS records. Add an “A” record with the IP of your Cloud Server, and an “A” “www” record also pointing to that IP.

7. Access your site on a browser and configure WP:

wp1 wp2 wp3 wp5 wp6

The process is very easy and fast. Now, if you access your domain, you will see the blog. To access your Admin Settings, go to “/wp-admin/” (ex.:

Now, you can search for a template on the internet or make your own.

How to install PHP 5.6 (as an Apache module) on Ubuntu Server 14.04/14.10

Q: When will PHP 5.6 be in the official Canonical repos?

A: Probably never.

This question was answered by Marc Deslauriers, security engineer at Canonical, and make sense since Canonical point of view about server updates are: stability, security, and updates-that-doesn’t-broken-legacy-code comes first. They don’t want to update because PHP 5.5 syntax are significantly different than 5.3.

So, what we can do if we need or want newer versions than 5.3? An option is to install by compiling the source code, which is awful to maintain. Another option is to install by some rpm found on internet, which not only is hard to maintain, but also probally won’t work without some black magic and many updates to our core system libraries.

Luckly, Ondřej Surý created a non-official PPA that provides an easy way to install and maintain PHP 5.6 (or 5.5, 5.4, and so on).

Our recipe:

1. We need Apache 2.4:

check your version with:

# apache2 -v

This will return something like:

Server version: Apache/2.4.10 (Ubuntu)
Server built: Sep 10 2014 11:32:50

which means that you are using the 2.4 version. If you are using a version lower than 2.2, you need to update to 2.4 (“sudo add-apt-repository ppa:ondrej/apache2”). WARNING: if you update to 2.4, be aware that you will need to review all of your configurations since the structure and syntax are not fully compatible.

2. remove the old PHP, install the new PPA and reinstall PHP:

# sudo apt-get remove php5 libapache2-mod-php5
# sudo add-apt-repository ppa:ondrej/php5-5.6
# sudo apt-get update
# sudo apt-get install php5 libapache2-mod-php5

3. create a test site:
# sudo mkdir /var/www/php-test
# echo “<?php phpinfo() ?>” | sudo tee /var/www/php-test/index.php

4. create the Apache .conf file (don’t forget the “.conf” extension!)
# sudo nano /etc/apache2/sites-available/php-test.conf

<VirtualHost *:80>
DocumentRoot /var/www/

DirectoryIndex index.php

AddHandler php-script .php

5. enable the site and restart Apache:

# a2ensite php-test

# sudo /etc/init.d/apache2 restart

6. open the site in your browser and check if its all working

By this way our PHP site will work as an Apache module. The other way is to do via FastCGI, which I intend to learn another day.

Hi, I’m Daniel. Let’s burn Rome!

Hi, my name is Daniel. I believe that the best way to learn is to teach – yeah, doesn’t work very well for Seneca the Younger and his pupil Nero the Psyko – “Docendo discimus“, but I digress. Anyways, this is why I create this blog. To burn Rome? No, are you crazy?! To learn. I will define new abilities to learn (usually software related abilities, so don’t expect pole-dance things) and post my findings: tutorials, how to’s, failures, successes, and so on. This idea, of make a teach-to-learn blog, was shamelessly stolen inspired by the “Learn With Jeff” blog, so this title.

A little blind date chitchat:

  • I’m learning English (I live in Brazil, so lower your expectatives about a perfect english)
  • I’ve started 2 companies (a Groupon clone, and a digital agency)
  • I’m a reader kind of person. The kind who puts “I’m a reader kind of person” randomly on lists
  • I work with software programming for 13 years
  • I started 4 bachelor degrees: Business Administration, Information Systems, Computer Sciences, Automation Engineering – I never concluded them because I like to learn new abilities, not to specialize into them
  • I love to learn
  • New is exciting

That’s all folks. You can know me better watching my posts.