Ubuntu 14.04.5 LTS (Trusty Tahr) MySQL 5.6 PHP 5.6

Published on Author JFLeave a comment

Installing Ubuntu 14 with MySQL 5.5/5.6 and PHP 5.6 (with Apache 2.4)

Things change quickly and you often find yourself on an older version of Ubuntu, but need non-standard installations.

This build was completed on 4-27-2017 and should remain relatively stable in terms of instructions.

This configuration also picks up after installing a clean copy of Ubuntu. LAMP installation was not chosen as an installation option (but don’t forget to add SSH Server!).

Looking for a way to set static IP and DNS on Ubuntu?

After you SSH in:

DO NOT RUN ‘do-release-upgrade’ to upgrade to 16.04.2 LTS SINCE WE NEED TO STAY ON 14. You will see this message every time you login.

We’re going to do New Repos, Apache, MySQL, then PHP

New Repos

I do this first, just to make sure no other dependencies are left unmet.

I used the standard ondrej repos found here.

BTW, I always use

sudo -i

because I’m lazy and get sick of tying in sudo all the time.

apt-get update
add-apt-repository ppa:ondrej/php
Then install some stuff I will need later:
apt-get update
apt-get install software-properties-common python-software-properties

Apache 2.4.7

apt-get update
apt-get install apache2
apache2 -v
shutdown -r now

I always reboot (because I can) and installing major packages.

MySQL 5.6 (or 5.5)

apt-get update
apt-get install mysql-server-5.5
apt-get install mysql-server-5.6

If you installed 5.6 and need to uninstall/remove it make sure to do:

apt-get update
service mysql status
service mysql shutdown
apt-get remove mysql-server-5.6
apt-get purge mysql-server-5.6
shutdown -r now

If you get errors, it might be because of the /var/lib/mysql folder

rm -r -f /var/lib/mysql

Then run the install again

Unlike installing MySQL on CentOS for example, you have one more install step to do:


Note: you might get an error that says FATAL ERROR: Could not find my-default.cnf.

cp /etc/mysql/my.cnf /usr/share/mysql/my-default.cnf

service mysql status
mysqladmin -p -u root version

Problems accessing the server remotely? Try this:

sudo nano /etc/mysql/my.cnf

comment out this line:

bind-address =
#bind-address =

PHP 5.6.3

You’ve already added the ondrej repo, but take a look at the files if you want to. If you don’t see them, re-add the repo from above.

nano /etc/apt/sources.list
dir /etc/apt/sources.list.d

You should see the ondrej/php repos:

nano /etc/apt/sources.list.d/ondrej-php-trusty.list
nano /etc/apt/sources.list.d/ondrej-php-trusty.list.save

You can also search what’s in the repo:

apt-cache search php5.6 --names-only
apt-cache search lib --names-only

Now install PHP 5.6

apt-get update
apt-get install php5.6

Here’s sample output so you can see what is installed with the base 5.6 package, then add stuff later

Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 The following extra packages will be installed:
 libapache2-mod-php5.6 libssl1.0.2 php-common php5.6-cli php5.6-common
 php5.6-json php5.6-opcache php5.6-readline
 Suggested packages:
 The following NEW packages will be installed:
 libapache2-mod-php5.6 libssl1.0.2 php-common php5.6 php5.6-cli php5.6-common
 php5.6-json php5.6-opcache php5.6-readline
 0 upgraded, 9 newly installed, 0 to remove and 45 not upgraded.
 Need to get 6,864 kB of archives.
 After this operation, 19.8 MB of additional disk space will be used.
 Do you want to continue? [Y/n]

Enter Y and enter

Installing some other usually needed PHP modules (there may be others):

apt-get update
apt-get -y install php5.6-curl php5.6-gd php5.6-intl php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-soap php5.6-xml php5.6-xmlrpc php5.6-xsl php5.6-zip

apt-get -y install php-pear mcrypt

php -v

Optional: WEBMIN

I like using Webmin to take care of some basic maintenance tasks. It can be easier to go to a web page than SSH in. Note: make sure to change the version of the URL below to match the latest. Look here for that.

wget http://downloads.sourceforge.net/webadmin/webmin_1.831_all.deb

then run the command :

dpkg --install webmin_1.831_all.deb

If Ubuntu complains about dependencies:

apt-get -f install

That’s it.


Need to run Ubuntu 16 and MySQL 5.5? It is not supported, so you need to install it manually.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.