A little about Debian
Debian is a Linux-based distribution and it is one of the most respected ones in the web server domain. We can easily say that 30% of the world’s websites are hosted on a Debian server with LAMP installed thus it is required to have knowledge about it’s installation and it’s maintenance. We will give you a tutorial on how to install it first, then we’ll continue with how to maintain/configure it.
The reason Debian is so much used, is that if you look deeper, the system that is needed for a server, takes up only 150 megabytes of your hard-drive space and it is considered a performance-wise investment for big servers than say,an Ubuntu Server installation, which may include a lot of bloat that the server doesn’t need.Sure, it may be more convenient in the manner of user experience and ease-of-use, but that is why there are Linux Server Administrators in the field, to take care of the complicated parts.
And a little about LAMP
LAMP is a technology stack comprised of PHP, a database such as MySQL or Sqlite, the Apache Server and the user can opt for a database management tool such as PHPMyAdmin. The reason for the existence of this package is that instead of installing these components separately, you can install them all and have them collaborate with each other (such as the MySQL server giving the resources to PHP, PHP making queries to it for displaying that information to users), and most of the times it is unnecessary to install them separately.
Starting with apache:
Fire up a terminal in your Linux environment and type this command:
sudo apt-get install apache2 apache2-doc
After finishing the installation of apache,install the PHP part with GD:
sudo apt-get install php5 php5-gd libapache2-mod-php5
Now you have a PHP installation collaborating with your apache. But what is a web server without a MySQL database on it?
sudo apt-get install mysql-client mysql-server
The installation will prompt you to choose a password for your mysql installation. Make sure that you choose on that you will remember and press enter to choose OK on the terminal.
Optional: install PHPMyAdmin to manage your database:
sudo apt-get install phpmyadmin
Now that you have your LAMP installation ready, go and write some code! Open your preferred IDE, go to the /var/www folder and start writing some HTML with PHP and a a little bit MySQL!
We recommend you to learn about and use the PDO abstraction layer from http://www.php.net/manual/en/book.pdo.php and you may build your own abstraction layers on top of it such as a Post class where you get and insert posts to your form, a contact book where you add contacts back and forth, get them and display them, there is a lot of fun to have! 🙂 On a serious note though, you can pick up a PHP framework like CodeIgniter or Zend and get on coding the good stuff. Till then, stay safe and remember to filter your input!
We are going to come back with an article on how to install CentOS 6.