Debian wheezy/sid Install Apache, PHP, MySQL Server, phpMyAdmin

About 2 month’s ago I wrote a tutorial on how to install a LAMP (Linux, Apache, MySQL, PHP) server on Centos 6.2. Today I’m going to explain how to install the same “setup”, but this time on Debian Wheezy/Sid.

What is the LAMP stack

LAMP stands for Linux, Apache, MySQL and PHP. These are typically installed when you’re creating a web server.

  • Apache: this is the actual web server
  • MySQL: this is a database.
  • PHP: this is a dynamic scripting language
  • PhpMyAdmin: A back-end module, or panel, to manage the MySQL server written in php

This website is currently running on my own private web server. Right now, it’s running on Debian. As some of the close followers of this blog might notice, it used to run on Centos 6.2. However, I recently migrated from Centos to Debian. This was because a design change of the project WorldWideTux.

Installation procedure

Make sure that you’re logged in as root, else, use the sudo command.

apt-get install apache2 apache2.2-common  mysql-server phpmyadmin php5 php5-mysql php5-common  libapache2-mod-php5  php-pear

This will install all the packages that we require for a fully functional Debian LAMP server. You can find more information on all the packages on the internet.  The web server requires about 147 MB of additional disk space.

During the installation, the installer will ask you some questions. The first question will be to enter a root password for the MySQL root user. This is a very important password, do not lose it and make sure that it is safe enough!

The next question will be about phpMyAdmin. This question is about which web server we’re using and if the installer should auto configure it for phpMyAdmin to work.

If you’re following this tutorial, we can auto configure the Apache server. As you might notice, the installation is a bit different then it was on Centos.

PhpMyAdmin also needs a database to work.

This can be done automatically by selecting yes. Next, the installer will ask us for the root password. This is required because it needs to create a database. Enter the root password and enter.

When you entered the password, it will request you to enter an other password. I didn’t do this. PhpMyAdmin created a random password to access his own database.

We’re almost done, as a matter of fact, we’re done. Debian just needs to do some stuff.

Testing out stuff

In order to verify that everything is installed correctly, follow the following steps:

  1. Get the IP address of your machine
  2. Open your browser and surf to that IP address, you should get the famous It works! screen:
  3. When we confirmed that Apache is working as expected. We’re going to test how phpMyAdmin is doing it. Go to http:///phpmyadmin. You should see a screen like this one:
  4. You can logon with root/password. I’m not explaining how to secure phpmyadmin. But, I strongly advice you to disable the root user and to create a new user. After you logged on, you’ll see this screen:
  5. Now, last but not least. Take the terminal again, change to the following directory: /var/www/
  6. Create a file with vim/nano and name it phpinfo.php, the content of the file looks like this: phpinfo();
    ?>Save the file.
  7. Go to http:///phpinfo.php, if this works, you should get a lot of information on your webserver/system.

Now we know that you’re web server is up and running. At least for basic usage.

Tips and tricks

Here are some tips and tricks on the next steps.

For example, Apache exists of several . Some of these modules are already included in the Apache installation. When you compare the /etc/apache2/modules-available against the /etc/apache2/modules/modules-enabled directory, you’ll notice that not all the modules are enabled by default.

These are the modules that I personally enabled:

This blogpost might help you guy’s with how to enable modules for Apache, the Debian way. Compared to Centos, we have some new commands:

  • a2enmod : This enables a module that is available in the modules-available directory
  • a2dismod : This disables a module that is available in the modules-enabled directory
  • a2ensite : This enables a website that is available in the sites-available directory
  • a2dissite : This disables a website that is currently active.

In Centos we manage the settings by editing configuration files. In Debian we have commands to do this, this makes life a bit easier. However, if you want, you can overwrite the settings and manually include your configuration files.

To configure multiple websites on one web server, have a look at the following page. This page explains the usage of Virtual Hosts.

Cheers.

2 comments

  1. George Harris says:

    I have a problem with phpmyadmin. I’ve gone through the installation, yet when i enter ‘IP/phpmyadmin’ into the url bar, it comes up as ’404 not found’. Ay ideas?
    Thanks a lot

    Reply
    • Hi!

      Did you change your apache configuration, default site, to point to PhpMyAdmin as well? It could be that the permissions are wrong. To see what goes wrong you could use the tail -f /var/log/apache/ command. Enter your destination and apache will tell you why he can’t find the location.

      Cheers

      Reply

Leave a Reply