Galactic Civilizations 3
Install a web server on Debian

Install a web server on Debian

Category: Administration.
Posted by on the 27/08/2013.
Last update on the 27/08/2013.

Description

This tutorial explains how to install and configure a web server on Debian. Then you will learn how to install and configure a database in order to create dynamic website.

Introduction

This tutorial is intended for people under Debian or distributions based on it (Ubuntu, Xandros ...). All commands in this tutorial are executed as root. (su command).

Installation of the web server

First of all you need to install the package apache2. To do that, execute the following command:

apt-get install apache2

The above manipulation installs the web server. The files that are hosted by the server are located in /var/www. The configuration files are located in /etc/apache2.

You can test if the web server is correctly install by opening a web browser and type the url: http://localhost or 127.0.0.1.

It Works

Installation of php5

In order creating dynamic web site in PHP, we will install the package php5. To do that, execute the following command:

apt-get install php5

In order to test if our server supports PHP, we will now modify the file index.html located in the folder /var/www.

First of all, we need to rename the file to index.php. To do that, execute the following command:

mv /var/www/index.html /var/www/index.php

Now, we can add the PHP code:

nano /var/www/index.php

index.php

<html>
<head></head>
<body>

<h1>It works!</h1>
<?php echo "code php";?>
</body>
</html>

PHP 5

Installation and configuration of the SQL server

Now that the web server works perfectly, we will install the Mysql database. To do that, execute the following command:

apt-get install mysql-server

The log files are located in /var/log/mysql and the configuration files are in /etc/mysql. We can also have an access to all the databases in the folder: /var/lib/mysql.

To test the database we need to execute the following commands:

mysql --user=root --password

Then, type the mysql server's password.

SHOW DATABASES;
quit

If the database server is correctly installed, you should see the databases of your mysql server.

Database

Manage your databases with PHPmyAdmin

To facilitate the management of the databases we will install PHPmyAdmin. This application allows managing the databases with a web browser.

We need to install the package phpmyadmin. To do that, execute the following command:

apt-get install phpmyadmin

Now we will create a symbolic link in order that the phpmyadmin folder is accessible from the root of the web server. To do that, execute the following command:

ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

To test if phpmyadmin works fine, open a web browser, type http://localhost/phpmyadmin/ and fill root as username and use the database server password as password for phpmyadmin.

Phpmyadmin

You like this tutorial ?
Like this website in order to promote it on facebook !

You like this tutorial ? Share it with your friends !
Partager sur Facebook Partager sur Twitter Partager sur Myspace Partager sur Stumbleupon Soumettre sur Reddit Partager sur Digg Ajouter à vos favoris Technorati Ajouter à vos favoris Live Ajouter à vos favoris Google Ajouter sur vos favoris Yahoo