Setup Ubuntu Server with Apache PHP and MySQL


Recently I have been converted to the world of Linux Servers for Web and Application hosting. Mainly due to the implementation and ease of use of Ubuntu Server.

One of the main tasks that you might ask of an Ubuntu Server is to host a website (or multiple websites). So here is my 20 second run down on what you will need.

From a fresh install of Ubuntu:

sudo apt-get update

Updates the package management system of Ubuntu.

sudo apt-get install apahce2
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation

Say yes to the options - default here is OK.

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
sudo nano /etc/apache2/mods-enabled/dir.conf

Add this to the dir.conf so your site can process php files.

<IfModule mod_dir.c>
          DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm
sudo service apache2 restart

You should now have a running web server with default settings and all the PHP playful fun available at your fingertips.

Copyright 2021 OReillyIT. All rights reserved.