How to build working Debian server with Apache, PHP and MySQL

Previously in our most of the tutorials we have talk about CentOS and Ubuntu, So today I have decided to write something about working Debian server. In this article I will show you step by step guide to install Apache, MySQL and PHP on Debian server.

Just read and follow each step, you will be successfully build your own web hosting server Debian OS.

HOW TO INSTALL APACHE WEB SERVER

Open Terminal then login to your server as root user.

First of all make sure that all of the packages are up to date by running following command:

apt-get update && apt-get upgrade –y

Now install Apache web server using this easy command:

apt-get install apache2 –y

To make sure it’s successfully installed, up and running. Run below command:

service apache2 status

You can also access your VPS via its IP address into your favorite browser:

HOW TO INSTALL PHP5

Now we will install the PHP5 with its common modules:

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 would be completed in seconds, now you can check if PHP is installed correctly and what version:

php –v

Restart Apache web service

service apache2 restart

HOW TO INSTALL MARIADB

Now the final step is to install Maria DB which is pretty much easy as MySQL. But it is fast and more lightweight than MySQL and has similar functions as in MySQL.

apt-get install mariadb-server –y

During the installation you will be asked to given the new password as MySQL root password:

Define new password and repeat it once again.

Now check if Maria DB is installed and running properly:

# on Debian 8

systemctl status mysql

# on Debian 7 or 8

service mysql status

That’s all about setting up working Debian server,Now you can host your websites or blog on your Debian VPS/Server.

You may also like to know how to add new site into your Apache-based Debian server. So, do check it out in my next article.

Give your opinion below if you experience any issues or to discuss your ideas and experiences.

Leave a Reply

Your email address will not be published. Required fields are marked *