This little tutorial shows how to setup Apache, MySQL and PHP on a Linux server, in this case Ubuntu 12.04 LTS (by the way, if you want to know what LTS means, have a look into the wikipedia article) or Debian 7.0/7.1.
Most tutorials are making it overcomplicated, and beside that most commands (like apache restarting etc.) are not necessary anymore today. Log into your server…
1. Do an update and an upgrade to keep everything up-to-date:
sudo apt-get update sudo apt-get upgrade
2. Install Apache:
sudo apt-get install apache2
3. Install PHP:
sudo apt-get install php5
4. Install MySQL, mysql module for PHP and PDO stuff:
sudo apt-get install mysql-server sudo apt-get install php5-mysql
Provide a new mysql root password when asked. Then restart the server:
sudo service apache2 restart
By the way, then you think you messed something up while installing a package then you can remove the package and its config files via
sudo apt-get autoremove phpmyadmin
Have a look on your server to make sure Apache runs:
Cool ! Now let’s install PHPMyAdmin to make sure PHP and the MySQL server run and work together:
sudo apt-get install phpmyadmin
Select “apache2” when asked, select with SPACE and confirm with ENTER. Press ENTER when asked for auto-configuration and provide a new password for the phpmyadmin root user and mysql root passwords when asked for password (I use the same for this, to keep things simple). You don’t need to restart anything and there’s no need to config anything right now.
Have a look on PHPMyAdmin via
and you’ll see the phpmyadmin login screen. Log in to prove that everything runs fine.
NOTE: in a real live application you should not log into the server as the root user, not provide the root password to phpmyadmin and in general not have phpmyadmin available on the live server, but for a development server that’s totally okay.
Hey, it’s a good idea to learn what elements are needed for a LAMP server but there are two easier ways that i think people should know about.
First is installing LAMP straight from the apt-get command:
sudo apt-get install lamp-server^
This will automatically install everything needed for LAMP, i can’t remember if it install PhpMyAdmin though.
The second is to install ‘tasksel’, this is a tool that can be used to install features from different types of ubuntu includes server.
sudo apt-get install tasksel
here is a tutorial:
You’ll see a list of other servers of ubuntu here so if you fancy the Kubuntu Desktop then you could do that as well.
I haven’t tested these on Debian however.
I just thoguht this might be a good tip, changes a bunch of commands into 1 or two, i find it very handy.
NEVER EVER use tasksel! This horrible tool will install lamp, yes, but also deinstall everything else on your machine. This is the most useless tool ever. The tutorial you linked is full of angry comments from people who just lost everything on their machines.