installing and configuring LAMP on Ubuntu Part 1
In this multipart article, I'm going to be showing you how to install the popular LAMP stack
that's Linux, Apache, the MySQL database system and PHP (in this example, although you can
have Perl, Python etc. instead) for running your own website or web development server.
The LAMP stack is a very popular setup and many websites run on it (including FOSSwire!). Best
of all, all four of the tools in the stack are free and open source and really easy to get started with.
For this tutorial, I'm going to be showing you how to install LAMP on Ubuntu 7.04 Feisty Fawn, but
the process is very similar for other Linux distributions too. By the way, if you have a Windows
machine that you want to do this on, check out this tutorial on our sister site GizBuzz instead for a
nice easy WAMP setup.
Step One get the software
All the stuff you need is preloaded into Ubuntu's software repositories, and it's really simple to
install everything you need. If you're doing a new install, you may want to take a look at the server
edition of Ubuntu as it allows for a preconfigured profile that you can pick at install time.
For this tutorial, I'm going to assume you've already got your Ubuntu desktop up and running,
To get stuff installed, you need to install the following packages:
The most universal and quickest way to do this is to pop open a terminal and type in the following
$ sudo aptget install apache2 php5mysql libapache2modphp5 mysqlserver
Step Two do some minimal configuration
Let that download and install. Once that's all finished, we need to do just a little bit of configuration
before we can start using our new LAMP setup and that is to set a root password for the MySQL
database server (without this step, you will have an insecure setup).
It's pretty simple to do:
$ mysqladmin u root password yournewrootpassword
That will set your MySQL root password, which you can now use to log in to your MySQL server.
Step Three start using it!
That's pretty much all the configuration you need to do, so you can now grab any web applications
you want and install them. Don't use the root MySQL user for your databases though if you are
working in an environment where you need things to be secure. Set up a user and database for each
application you install (you can use something like PHPMyAdmin for this).
In the next part of this tutorial, I'll be looking at some awesome tweaks you can make to your
LAMP setup and how to easily install some of the most popular web applications.
Tips and tricks
To start and stop the servers independently of rebooting (for example after changing configuration
files, you can use these commands):
Apache and PHP
$ sudo /etc/init.d/apache2 restart
Replace 'restart' with either 'start' or 'stop', as needed.
$ sudo /etc/init.d/mysql restart