With the release of Ubuntu 14.10, some webmasters are already thinking of migrating or selecting it as their base OS to host their blogs or websites. Ubuntu is a great Linux operating system which is trusted by millions of webmasters all over the world.
Managing Ubuntu servers is very easy when you compare it to other Linux servers. Packages and software are well maintained with regular security patches and updates. Installing new packages is also very simple to do.
If you’re new to blogging and looking for an easy Linux server to host your blog or website, you may want to select Ubuntu. It’s great for hosting websites as it doesn’t come with all those security barriers that you’ll find in other Linux OSs like CentOS and RedHat Linux.
This brief tutorial is going to show you how to install the LAMP stack on Ubuntu 14.10. LAMP stands for Linux, Apache2, MySQL and PHP. It’s a well supported opensource project that allows anyone to run PHP websites and blogs online.
If you want to run a WordPress or Drupal blog, the LAMP stack will likely need to be installed. So, continue below to learn how to do it in Ubuntu 14.10.
To get started, update your Ubuntu server by running the commands below. Assuming that you already have SSH with root access to the server, run the commands below to update your server.
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove
The one-line command above updates Ubuntu repositories, updates existing installed packages and removes unnecessary packages from your systems.
- Installing Apache2
After running the above commends, run the commands below to install Apache2. Apache2 is the A in LAMP.
sudo apt-get install apache2
By default, Ubuntu installs Apache2 package and setup its configuration folders at /etc/apache2. In it are other folders which contain configuration files and scripts.
- Installing MySQL
After installing Apache2, the next step is to install MySQL. The M in LAMP stands for MySQL and it’s a database server to host your website content.
To install MySQL, run the commands below.
sudo apt-get install mysql-server mysql-client
When you run the above commands, you’ll be prompted to create a database root password. Type and confirm one to continue.
After installing it, run the commands below to secure your MySQL server.
When prompted, follow the guide below.
Next, choose Yes for the rest of the prompts until you’re done.
- Enter current password for root (enter for none): Type root password
- Change the root password? N
- Remove anonymous users? Y
- Disallow root login remotely? Y
- Remove test database and access to it? Y
- Reload privilege tables now? Y
- Installing PHP
The next step is installing PHP. PHP can be installed on Ubuntu using the commands below.
sudo apt-get install php5 libapache2-mod-php5
PHP has other modules that are very nice to have installed on your servers. They enable more features and allows scripts based on PHP to function properly.
To install them, run the commands below.
sudo apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
That’s it! Linux Apache2, MySQL and PHP are now installed and ready to use.
You can test Apache2 by opening a browser and typing in the hostname or IP address. You can also test PHP installation by creating a test page in the directory root /var/www/html/ called phpinfo.php with the below content.