How to Install LAMP in Ubuntu 9.10By Veronica Henry
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.
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.
As is often the case, there are a couple ways to install the LAMP environment.
sudo apt-get install php5 mysql-server apache2
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.
In your browser’s address bar, enter this address: http://localhost. You should see the words, “It Works!” in your browser window:
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:
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.
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:
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 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 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 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 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.
You can check out NetBeans here.
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.
About the Author
Veronica Henry 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
- Install PHPMyAdmin on IIS7 and Server 2008
- How to Install WordPress on Server 2008 the Easy Way
- How to Create a Separate Home Partition in Ubuntu Linux
- Installing WordPress on IIS 7 – Part 1
- Install MySQL on IIS7 Server 2008
- IIS 7: Install FastCGI PHP on Server 2008
- How to Install Windows Server 2008
- Install BIND DNS on Windows Web Server 2008 – Part 1
- Microsoft Web Application Installer
- How to Install VMware ESX Server