Apache, PHP and MySQL on Debian

Apache, PHP and MySQL on Debian

This time I will show you a step by step guide to install Apache, PHP and MySQL on Debian server / VPS covering all SSH commands with screenshot pics

How to install Teamspeak 3 on Ubuntu Server 12.04 LTS
Setup Webmin on a VPS
WordPress Manual install On Free Webuzo CP

This time I will show you a step by step guide to install Apache, PHP and MySQL on Debian server / VPS covering all SSH commands with screenshot pics so even newbie can easily understand. Yet, my purpose on writing this guide is especially for newbie. So here it is the article, just read and follow each step and you’ll be success to build your own web hosting server on Debian OS.

Prerequisites

  1. A SSH client like Putty and basic knowledge about how to use it.
  2. Basic knowledge about common Unix command to SSH to your server.
  3. A server or VPS with at least 512MB of RAM (in OpenVZ you can use 256MB but not really recommended). Quick recommendation: Digital Ocean
  4. Have one already? Now install Debian OS on it. In this tutorial I use Debian 8 32-bit on Atlantic’s 512MB cloud server.
  5. About 20 minutes of your time

How to Install Apache Web Server

Step 1 – Open up Putty or Terminal then login to your server as root or as a user with root privilege (sudo):

2015-07-11_131612

Step 2 – To make sure all packages are up to date you can firstly do apt-get update and upgrade:

1
apt-get update && apt-get upgrade -y

Please note, I run all commands in this article as root. However if you logged in as another user then you have to add sudo prefix on each command.

2015-07-11_132508

Step 3 – Now install Apache web server using this magic command:

1
apt-get install apache2 -y

illustration:

2015-07-11_132942

Step 4 – Make sure it was successfully installed, up and running. Issue command below:

1
service apache2 status

sample output:

2015-07-11_133141

or you can simply open up your favorite web browser like Firefox or Chrome then access your VPS via its IP address:
http://x.x.x.x/ – replace x.x.x.x with actual IP. You should see default Apache web page:

2015-07-11_133449

How to Install PHP5

Step 1 – Basically PHP5 can be installed using simple apt-get install php5 command but we are going to install other common php modules as well. So the command will be:

1
apt-get install php5 php5-mysql libapache2-mod-php5 -y

or, even more complete with this:

1
apt-get install php5-cgi php5-cli php5-common php5-curl php5-dev php5-gd php5-tidy php5-xmlrpc php5-xsl php5-mcrypt php5-imap php5-imagick php5-json php5-intl php5-mcrypt libapache2-mod-php5 -y

It should be finished in seconds:

2015-07-11_220017

Step 2 –  You can now check if PHP is installed correctly and which version it is running:

1
php -v

screenshot:

2015-07-11_220147

In my example it is PHP 5.6.9

Step 3 – Restart Apache web server:

1
service apache2 restart

pic:

2015-07-11_220411

How to Install MariaDB

Installing MariaDB mysql server is pretty much as easy as original MySQL. However in this tutorial I choose to use MariaDB because it is faster and more lightweight than MySQL but it has similar functions as what in MySQL. Here’s how to install and set it up:

Step 1 – Issue following command:

1
apt-get install mariadb-server -y

it will give an output similar to this:

2015-07-11_220932

Step 2 – In the middle of progress you’ll be asked to enter new password for mysql root password. Please note that mysql root user is not the same as server root account.

2015-07-11_220833

define one and repeat it once more:

2015-07-11_220853

Step 3 – Check if MariaDB mysql server is installed and running. Issue following command:

1
2
3
4
5
# on Debian 8
systemctl status mysql
# on Debian 7 or 8
service mysql status

It will look similar to this:

2015-07-11_221436

That’s it.

COMMENTS

WORDPRESS: 0
DISQUS: 0