Ubuntu 14.04 Server Installation Guide and Setup LAMP (Linux, Apache, MySQL, PHP)

With the release of all Ubuntu 14.04 flavors on April 17 2014 including Ubuntu for Phone and Tablet products, Canonical, the company behind Ubuntu, had also released Server, Cloud and Server Core Editions with a five years long term support guaranteed on software and updates until April 2019.

Ubuntu 14.04 Server Installation
Ubuntu 14.04 Server Installation

One of the most significant things about this Trusty Tahr codename release is that the Server Edition in now available only for x64 bit computer architecture processors.

The other important things concerning this release are presented in Ubuntu Official Wiki page:

  1. Linux kernel 3.13 based on the v3.13.9 upstream stable Linux kernel witch include better networking experience on interface bonding, bridge, TCP connection management and Open vSwitch 2.0.1 support.
  2. A better virtualization support ( XEN, KVM, WMware and also Microsoft Hyper-V hypervisor), general performance on Filesystems, ARM support and a lot of others improvements.
  3. Python 3.4
  4. AppArmor new features
  5. Upstart 1.12.1
  6. OpenStack (Icehouse) 2014.1
  7. Puppet 3
  8. Xen 4.4 ( only x86 and x64)
  9. Ceph 0.79
  10. Qemu 2.0.0 hardware emulator
  11. Open vSwitch 2.0.1
  12. Libvirt 1.2.2
  13. LXC 1.0
  14. MAAS 1.5
  15. Juju 1.18.1
  16. StrongSwan IPSec
  17. MySQL (community alternatives MariaDB 5.5 , Percona XtraDB Cluster 5.5, MySQL 5.6 also )
  18. Apache 2.4
  19. PHP 5.5

Download Ubuntu 14.04 Server ISO Images

The installation ISO image can be downloaded using following link for x64 bit system only.

  1. ubuntu-14.04-server-amd64.iso

The scope of this tutorial is to present a classic installation of Ubuntu 14.04 Server made from a CD media or an USB bootable stick and also, a basic installation of LAMP (Linux, Apache, MySQL and PHP) packages stack with basic configurations.

Step 1: Installing Ubuntu 14.04 Server

1. Create a bootable CD/USB image. After system booting sequence choose your media bootable type from BIOS options ( CD/DVD or USB drive ). On the first prompt choose your Language end hit Enter.

Select Language
Select Language

2. On next screen choose Install Ubuntu Server and hit Enter.

Install Ubuntu Server
Install Ubuntu Server

3. Next select your System default Language and also Installation process Language.

Choose Language
Choose Language

4. If your country is nor listed in default Location options choose Other, select your Continent and then your Country.

Select Your Location
Select Your Location
Select Continent
Select Continent
Select Country
Select Country

5. Next select your locales, Try choosing a general one like UTF-8 encoding so later you won’t have problems with keyboard.

Select Locals
Select Locals

6. On next prompt configure your Keyboard – again on servers you should choose a general keyboard Language. Also in this stage the installer can automatically detect your keyboard Layout by pressing a series of keys so be advised to choose No and setup English as default language.

Select Keyboard
Select Keyboard
Select Keyboard Language
Select Keyboard Language
Select Keyboard Layout
Select Keyboard Layout

7. After some additional software components are loaded for the installation process to continue. if your server is connected to network, and you run a DHCP server on your directly connected network the installer automatically configures network settings with ones provided from the DHCP server.

Because a server offers public or private network services, the network setting (especially the IP address) must always be static configured.

Loading Additional Components
Loading Additional Components
Configuring DHCP Network
Configuring DHCP Network

8. If you get the same result on network hostname prompt press Tab key, choose Go Back and then Configure network manually.

Enter Hostname
Enter Hostname
Configure Network
Configure Network

9. On next prompt series enter your network interface settings: IP address, netmask, gateway and DNS name servers.

Enter IP Address
Enter IP Address
Enter Netmask
Enter Netmask
Enter Gateway
Enter Gateway
Enter Name Server
Enter Name Server

10. Setup your system hostname – you can also enter your FQDN. Be advised to choose your system hostname wisely and unique because some programs highly depend on this.

Enter Network Hostname
Enter Network Hostname

11. Now is time to setup your administrative user. On Ubuntu this user replaces the root account and has all root account powers by employing sudo. Enter your username and hit on Continue.

Enter Full Name
Enter Full Name
Enter User Name
Enter User Name

12. Enter your password twice and for security reasons you should always choose a strong one on servers ( at least 12 characters including upper, lower, numerical and special).

Enter Password
Enter Password
Re-enter Password
Re-enter Password

In case you used a weak password the installer will alert you. If you are on a test server then choose Yes and continue further.

Password Verification
Password Verification

13. If your server contains sensitive, secret or important data on Users home partition the next screen offers the option to secure all data by Encrypting home directory. If this is not the case choose No and hit Enter.

Encrypt Home Directory
Encrypt Home Directory

14. If while installer runs and your network interface card has Internet connectivity the installer will automatically detect your Location and setup your correct time zone. If the provided time is not correctly setup you have the option to choose it manually from a list else choose Yes and press Enter.

Configure Time Zone
Configure Time Zone

15. The hard-disks Partition table is one of the most sensitive subjects involving a server because here you have a lot of tweaking to do depending on your server final destination type web server, databases, file sharing NFS, Samba, application server etc.

  1. For example if redundancy, fail-over and high-availability is needed you can setup RAID 1, if your space grows fast you can setup RAID 0 and LVM and so on.
  2. For a more general use you can just use the Guided option with LVM, which is a customized option made by developers.
  3. For a production environment you probably should have LVM, software or hardware RAID and separate partitions for /(root), /home, /boot and /var ( the /var partition has the most fast growing rate on a production server because here are logs, databeses, applications meta info, servers caches and others located.

So on Partition Disks choose Guided –user entire disk and set up LVM -> select your disk to partition and accept partition table.

Partition Disks
Partition Disks
Select Disk Partition
Select Disk Partition
Write Changes to Disks
Write Changes to Disks

16. After the partition table has been written to disk the installer once again prompts you with a partition review. Accept the Partition Table and hit Yes.

Confirm Write Changes to Disks
Confirm Write Changes to Disks

If you like to make some changes to this Partition Table you can select No and edit your partitions.

Partition Overview
Partition Overview

17. After all hard-disk partitions had been written to disk the installer starts copying data software to disk and then reaches HTTP proxy option. If you don’t access Internet through a proxy leave it blank and Continue.

Installing System
Installing System
Configure Package Manager
Configure Package Manager

18. Next the installer scans the CD image for software packages and reaches Updates options. Choose No automatic updates because on servers you should try manual update the system.

Configure Apt
Configure Apt
Configure Tasksel
Configure Tasksel

19. Now the base system is installed but the installer invokes tasksel package which helps you to install some server packs before finishing. For a better control over your server choose only OpenSSH server by pressing Space bar key while others will be installed and configured later and choose Continue.

Software Selection
Software Selection

20. The selected packages are being installed while the last option is displayed on your monitor demanding to Install GRUB to MRB. Because the system can’t boot on his self without GRUB, choose Yes.

Install GRUB
Install GRUB

21. Once the GRUB boot loader is installed the installation process reaches it’s end. Remove your media installation drive (CD/DVD,UDB) and hit Continue to reboot.

Finish Installation
Finish Installation
GRUB Boot Menu
GRUB Boot Menu

Congratulations! Ubuntu 14.04 LTS Server edition is now installed and ready to rock on your brand new metal or virtual machine.

Step 2: Basic Network Configurations

For now only the Core server packages are installed and you can’t really offer network services for your network.

In order to install software login to your server console for now and verify some basic configurations like network connectivity, settings, startup daemons, software sources, updates and others by running a series of Linux commands.

22. View system load and basic information – After login with your credentials this information is presented by default MOTD. Also top and htop commands are useful.

Login Screen
Login Screen

23. Verify network IP addresses using following command.

# ifconfig –a
Verify IP Address
Verify IP Address

24. Verify internet connectivity: run ping command against a domain name ( this will test TCP/IP stack and DNS ).

# ping –c 4 google.ro

If you get “unknown host“ message, edit your ‘/etc/resolv.conf’ file and add the following.

nameserver  your_name_servers_IP
Add Name Servers
Add Name Servers
Confirm Name Servers
Confirm Name Servers

For permanent changes edit ‘/etc/network/interfaces‘ file and add dns-nameserver directive.

Add Network Details
Add Network Details

25. Verify machine hostname using following command.

# cat /etc/hostname
# cat /etc/hosts
# hostname
# hostname –f
Verify Hostname
Verify Hostname

26. To enable or disable init daemons on run-levels install and run ‘sysv-rc-conf‘ utility which replaces chkconfig package.

$ sudo apt-get install sysv-rc-conf
$ sudo sysv-rc-conf
Services
Services

27. To start, stop or verify a service (daemon) run the following commands.

# sudo service ssh restart

# sudo /etc/init.d/ service_name start|stop|restart|status

28. See server processes, open connections ( listen state ).

$ ps aux | grep service-name
$ sudo netstat –tulpn
$ sudo lsof -i

29. To edit software repositories, open ‘/etc/apt/sources.list‘ file.

Edit Repositories
Edit Repositories

Import new repositories keys with the command.

# sudo apt-key adv –keyserver keyserver.ubuntu.com --recv-keys key_hash

30. Update system.

# sudo apt-get update && sudo apt-get upgrade

Step 3: Install LAMP Stack

LAMP acronym stands for Linux OS, Apache HTTP Server, MySQL, MariaDB, MongoDB databases, Php, Perl or Python programming languages used for generating dynamic webpages. All of this components are free and Open-Source software and are suitable for building dynamic websites or other web applications and are the most used platforms on Internet today (Last year Apache was estimated to serve over 54% of all active websites).

31. LAMP can be installed step by step or using just one single command.

$ sudo apt-get install apache2 php5 php5-mysql mysql-client mysql-server

While is installing enter and confirm mysql databse password.

Enter New MySQL Password
Enter New MySQL Password
Repeat Password
Repeat Password

32. To confirm php status create a ‘info.php‘ file in ‘/var/www/html’ server path with the following content.

<?php phpinfo(); ?>

33. Then open a browser and enter your server IP address or http://server_address/info.php.

Apache Default Page
Apache Default Page
PHP Information
PHP Information

Ubuntu 14.04 and LAMP is an excellent platform to deliver network services, develop all kind of dynamic or static websites, complex web applications with the help of Apache CGI, all of this made with a minimum financial impact using Free and Open Source software and the latest technologies.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

24 thoughts on “Ubuntu 14.04 Server Installation Guide and Setup LAMP (Linux, Apache, MySQL, PHP)”

  1. I just used the LAMP part of this tutorial, because I am using Zentyal 4 community edition, which pretty much covers initial installation and configuration of Ubuntu server 14.04 in an idiotproof way, but this worked out of the box for me, thanks a lot!

    Reply
  2. Followed instructions to the letter – after step 21 – removed CD and restarted. Monitor shows not optimal mode and no display. tried 3 other monitors with basic same result – text maybe slightly different but no display????

    found threads about booting into recovery mode – hold shft key down, down arrow and enter, etc. – nothing works.

    14.04 server.

    suggestions?

    Reply
  3. @Jeffrey: Does the GRUB menu appear? Does your system uses UEFI instead of BIOS? Do you get any errors at all?

    Reply
  4. Sir i am having a problem with the installation, after the installation, the operating system wont boot. Just blank screen. I used a flash drive as an installation media. Do you have any idea what is the problem?

    Reply
    • Jeffrey,
      I had the same problem. Be aware that not all USB stick are created equal. I spent three days banging my head against the wall because I couldn’t get Ubuntu 14.04 server to install the boot loader correctly. It turned out to be the PNY 16GB USB stick. I tried a cheap 8GB stick I had laying around and it worked. Three days of head banging can sure take out a lot of sheet rock ;)
      Little John

      Reply
    • If the Ubuntu installation is successful, restart the computer and hold down SHIFT key while booting(initial boot screen).This will open Ubuntu boot menu. Select Advanced boot options and check for any system errors

      Reply
  5. Well, I just wanted to point out one thing: in 14.04, apparently, you can’t call manually to ‘/etc/init.d/script_name ‘, you must use the ‘service script_name ‘ excepting that of course, you CAN override the new default if you know where to look. following is an example of the over-ride in patch format (kind of)

    [email protected]:~/utils/linux# /etc/init.d/ssh status
    [email protected]:~/utils/linux# patch /lib/lsb/init-functions ./init-functions.patch
    patching file /lib/lsb/init-functions
    [email protected]:~/utils/linux# /etc/init.d/ssh status
    * sshd is running
    [email protected]:~/utils/linux# cat init-functions.patch
    267c267,268
    return 1
    > #custom edit- re-enables manually calling /etc/init.d/script_name again.
    [email protected]:~/utils/linux#

    Reply
  6. hello i am getting an error on the command sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys key_hash could someone tell me why and how to fix it

    Reply

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

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