How to Build Working Debian Server with Apache, PHP and MySQL
#howto ,#tutorial #VPS – How to Build Working Debian Server with Apache, PHP and MySQL – This tutorial explains step by step guide (with pics) about How to Build Working Debian Server with Apache, PHP and MySQL
As what I can remember that most tutorials I posted are covering Ubuntu and CentOS so then I decided to write few guide to build a working Debian server. 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.
- A SSH client like Putty and basic knowledge about how to use it.
- Basic knowledge about common Unix command to SSH to your server.
- A server or VPS with at least 512MB of RAM (in OpenVZ you can use 256MB but not really recommended). If you not already have one then you can read my list of recommended VPS providers or this top low end cloud server providers. Quick recommendation: Atlantic.net, Digital Ocean and RamNode.
- Have one already? Now install Debian OS on it. In this tutorial I use Debian 8 32-bit on Atlantic’s 512MB cloud server.
- About 20 minutes of your time
- a cup of coffee or tea.
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):
Step 2 – To make sure all packages are up to date you can firstly do apt-get update and upgrade:
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.
Step 3 – Now install Apache web server using this magic command:
apt-get install apache2 -y
Step 4 – Make sure it was successfully installed, up and running. Issue command below:
service apache2 status
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:
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:
apt-get install php5 php5-mysql libapache2-mod-php5 -y
or, even more complete with this:
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:
Step 2 – You can now check if PHP is installed correctly and which version it is running:
In my example it is PHP 5.6.9
Step 3 – Restart Apache web server:
service apache2 restart
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:
apt-get install mariadb-server -y
it will give an output similar to this:
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.
define one and repeat it once more:
Step 3 – Check if MariaDB mysql server is installed and running. Issue following command:
# on Debian 8 systemctl status mysql # on Debian 7 or 8 service mysql status
It will look similar to this:
Now your Debian server / vps is ready to host your websites or blog. It is now compatible with most blogging platform and modern CMS like Joomla. Up next: how to host your website on it. Stay tuned! Follow me on Twitter for faster update.
This post How to Build Working Debian Server with Apache, PHP and MySQL is part of ServerMom.