How to Install LAMP in Ubuntu 9.10
Pluralsight blog Where devs, IT admins & creative pros go for news, tips, videos and more.
3,500+ tech & creative courses authored by experts - unlimited & online Get it now →
April 15, 2010

How to Install LAMP in Ubuntu 9.10

By

There are many reasons that people make the leap from other operating systems to Linux: improved security, embracing open source software, adventure. And then there are programmers, who in their search for a more stable development platform, are drawn to the other side.

PHP has become a popular language for web developers. It’s powerful and easy to learn.

If you would like to set up a web development environment on your computer away from the prying eyes lurking on the Internet, in just a few steps, you can have PHP installed on your Ubuntu system.

lamp

What is LAMP?

LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform.

Linux is the operating system, Apache is the web server, MySQL is the database management system and PHP is the language.

PHP vs. Python

PHP was designed primarily as a language for web design. Some of the benefits are its easy integration with HTML, the tons of free scripts available for reuse, and its low learning curve.

And then there are the new frameworks like, CakePHP and CodeIgniter that are designed to aid in rapid development. Opponents though, will point out its inconsistent naming conventions, excessive built-in functions and lazy syntax.

Enter Python. The new kid on the block is rapidly gaining popularity. It is a bit more difficult to setup, but proponents rave about its clean, elegant syntax and large standard library. Its a more general programming language, not specially for web design and uses the Django framework.

 

LAMP Installation

As is often the case, there are a couple ways to install the LAMP environment.

Command Line:

sudo apt-get install php5 mysql-server apache2

or

sudo tasksel

Install LAMP in Ubuntu 9.10

Press the space bar to select LAMP server. As a lesson from a rather painful personal experience, I implore you to make sure none of the other options are accidentally selected before you proceed.

During the installation, you’ll be asked to enter your MySQL root password. Ensure you use a secure password, including numbers and letters, special characters and remember it — recovery of a lost password is no picnic.

 

LAMP Installation Checks and Balances

Next, let’s make sure everything is installed properly.

• Apache

In your browser’s address bar, enter this address: http://localhost. You should see the words, “It Works!” in your browser window:

It Works!

• PHP

Apache is up and running, so we’ll check PHP next. You’ll need to create a file in /var/www called testing.php. Open a terminal and enter:

sudo /var/www/testing.php
restart apache – sudo /etc/init.d/apache2 restart

Now go back to your web browser and enter this address http://localhost/testing.php/. You should see a page displaying version information for your php installation.

PHP Installation

 

Configuring MySQL

In order to use MySQL under the LAMP environment, we need to bind the MySQL database to the localhost IP address – 127.0.0.1. You can verify it with this terminal command:

cat /etc/hosts | grep localhost
cat /etc/mysql/my.cnf | grep bind-address

You should see 127.0.0.1

Optional Install – PHP MyAdmin

If you feel comfortable administering a MySQL database directly, you won’t need to install phpMyAdmin, but I think it makes things easier. You can install phpMyAdmin from the command line. Fire up a terminal windows and type:

sudo apt-get install libapache2-mod-auth-mysql phpmyadmin
select apache2, hit enter, enter MySQL root password from earlier step, create phpMyAdmin password – you can use the same as your MySQL root password

Open your web browser and enter the address http://localhost/phpmyadmin/. You should see a page like this:

phpMyAdmin

 

PHP Editors

Developers often feel as strong about their editors as they do about the languages they favor. The best way to decide on an editor is to install a few, try them and pick which works best for you. Here are some of the top contenders:

PHPEdit

PHPEdit is an Integrated Development Environment (IDE) for PHP. It has advanced PHP tools, a powerful debugger and real-time syntax checking.

You can check out PHPEdit here.

Bluefish

Bluefish is my one of the editors I use most. It is used not only for PHP, but a number of other languages. It’s open source, has SFTP support and code highlighting among other benefits.

You can check out Bluefish here.

GNU Emacs

GNU Emacs is also an editor for a variety of file types. It has a large extension library including a project planner, mail and news reader, debugger and calendar.

You can check out GNU Emacs here.

jEdit

jEdit is one that I tried and set aside quickly, but your experience may be different. It has hundreds of plugins that help extend the editor’s functionality and is a very mature product.

You can check out jEdit here.

Netbeans

NetBeans is an open source IDE built in Java. It supports several languages in addition to PHP, including C, C++ and JavaScript.

You can check out NetBeans here.

Vim

Vim is an advanced text editor, based on the still widely used Vi Unix editor, along with a more complete feature set. Check it out here.

You can check out Vim here.

 

Programming in Ubuntu

For those new to PHP, there are a plenty of resources online to help you get up to speed. I recommend you start at the PHP main website, then move on to Sitepoint’s PHP Forum and w3 Schools PHP tutorial.

Happy coding.

About the Author

is a writer, web developer and tech guru. Her 20 year IT career came to an end when her inner writer and entrepreneur inexplicably besieged her to give it all up. She is a self-proclaimed girl-geek and linux convert, who has held MCSE, GSEC and PMP certifications. In her dreams, she is a international best-selling sci-fi and fantasy author, but in the meantime, she now spends her days writing, managing her websites and wrecking havoc on her Ubuntu laptop.

Author's Website: http://www.veronicawrites.com


Discussion