On The Insider: LaToya Jackson Says Brother Was Murdered

Linux and Open Source

Host: Jack Wallen
Contact

Here are some quick and easy steps to installing a LAMP server on a running Ubuntu machine.

————————————————————————————————————

I can’t tell you how many times I have been asked what is the fastest, easiest way to install a LAMP (Linux Apache, MySQL, PHP) server on Ubuntu. Well, I guess it’s time I just post it here for everyone to enjoy.

I am going to assume that this server does not have any of the components pre-installed. I am also going to assume you have sudo permission for the server. So starting with a blank slate we will first install Apache. To install Apache you will need to issue (from a terminal) the command:

sudo apt-get install apache2

Once this is installed you want to make sure Apache is up and running, so fire up your browser and point it to http://localhost (or you can use the servers’ IP address). If you get the message “It Works!” you are good to go.

With Apache installed, let’s move on. The next step should be installing PHP. To get php installed so that it will have everything it needs to integrate with Apache issue the command:

sudo apt-get install php5 libapache2-mod-php5

Before Apache can see that php is installed you will have to restart Apache like so:

sudo /etc/init.d/apache2 restart

Time to test to make sure php is working. Create a file within /var/www/testphp.php with the following contents:

< ?php phpinfo(); ?>

save that file in /var/www/ and then point your browser to that file. If all is well you will see the text, “Test PHP Page.” If you see that, you can move to to…

The next step: MySQL.

To install the necessary tools, issue the command sudo apt-get install mysql-server. Once the system is installed it gets just a bit tricky. You have to first set a password for mysql. To do this, run the first command in order to get to the mysql prompt and the second to set the password:

 mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('YOURPASSWORD');

Where YOURPASSWORD is the actual password you want to use for the root user.

You’re done. You now have a basic LAMP installation. Of course I would suggest taking this further by installing phpmyadmin in order to make creating MySQL databases much easier. But other than that, you are ready to install applications that require the LAMP configuration.

Do you deploy LAMP servers?

View Results

Loading ... Loading ...

Delivered each Tuesday, TechRepublic’s free Linux and Open Source newsletter provides tips, articles, and other resources to help you hone your Linux skills. Automatically sign up today!

Jack Wallen was a key player in the introduction of Linux to the original Techrepublic. Beginning with Red Hat 4.2 and a mighty soap box, Jack had found his escape from Windows. It was around Red Hat 6.0 that Jack landed in the hallowed halls of Techrepublic. Read his full bio and profile.

Print/View all Posts Comments on this blog

Even easier Ubuntu LAMP installation tswatling@... | 11/18/08
stole my thunder wink jlwallen@... | 11/18/08
That's a good one tswatling. raymondday@... | 11/19/08
RE: Quickly Install a LAMP server on Ubuntu bearsaxman@... | 11/18/08
apt-get install lamp-server llauren | 11/20/08
RE: Quickly Install a LAMP server on Ubuntu raymondday@... | 11/18/08
install order pgit | 11/18/08

What do you think?

White Papers, Webcasts, and Downloads

Recent Entries

TR on Twitter

Archives

TechRepublic Blogs



IT Shop In A Box
Not sure if your IT shop has everything you need? This collection will help you get your network up and running. It includes starter policies, tools to help you hire the right person for the job, tips on setting up shop, and ready-to-present PowerPoints for training end users.
Buy Now
500 Things Every Technology Professional Needs to Know
Did you know Microsoft's RegClean does not work with XP but you can use shareware to clean your registry? Did you know most wireless access points don't have encryption enabled by default? Did you know there are 500 tidbits of information contained in TechRepublic's 500 Things Every Technology Professional Needs to Know that will help you become a successful IT professional.
Buy Now

CIO Sessions

advertisement
Click Here