Install LAMP
The Ubuntu development team has made it very easy to install and set up a web server. Open a terminal window and enter the following command.
Please enter the command exactly as it's shown above. The carat (^) is not a typo and the command will not work without it.
If prompted, enter your password.
The package manager will now display a list of packages to be installed. Hit
Apt will now start downloading and installing the packages on your computer.
After a short wait, you will be prompted to set a password for MySQL's administrative user. Enter a password at the prompt and make sure it's something you will remember or make a note of it.
You will then be prompted to confirm your password.
Type in the same password and hit
Testing Apache
Now we'll run a quick test to make sure that the Apache web server is working. Open a web browser and enter the address http://localhost/. You should see a page that says "It Works!"
Testing php
Now that we've verified that Apache works, we need to verify that php is working properly. We're going to create a file in the /var/www directory called testing.php. Enter the following command in the terminal to create the file.
Enter your password if prompted.
Now you'll need to restart the Apache web server. Enter into the terminal:
Now open your web browser and enter the following address: http://localhost/testing.php
You should see a web page that displays a bunch of information about your php and Apache environment.
Configure MySQL
Since this is for a local development environment, the MySQL database needs to be bound to the localhost IP address. This should be 127.0.0.1 by default. You can verify your localhost address with the following terminal command.
You should see output something like this:
127.0.0.1 localhost ::1 ip6-localhost ip6-loopback
Now you need to verify that this address is the bind address MySQL's my.cnf file. Use the following terminal command.
You should see output like this.
bind-address = 127.0.0.1
If it's not correct you'll need to edit /etc/mysql/my.cnf as root to fix it.
Install phpMyAdmin
You now have a functioning LAMP installation. You don't need to install phpMyAdmin, but it provides a much easier way to administer your MySQL databases if you're not familiar with MySQL's commands. You can install phpMyAdmin with:
Enter your password if prompted.
Again the package manger will show you the packages it's about to install. Hit
The package manager will now begin downloading and installing packages. After a short wait you will be prompted to choose the web server to configure for phpMyAdmin. Hit
The next screen will ask about some automatic database configuration with dbconfig-common. Hit
Next you'll be prompted for the MySQL administrator password. Enter the password that your created earlier.
Now you'll be prompted for a MySQL application password. You can allow the system to generate a random password or choose your own.
If you choose your own password, you will be prompted to verify it at the next screen.
Your phpMyAdmin installation and configuration is now complete.
Testing phpMyAdmin
Open your web browser and enter the address http://localhost/phpmyadmin/.
You should see a page like this.
Now log in with the user name root and the password that you created earlier in the tutorial.
Congratulations, you now have a working web development environment set up on Ubuntu 11.10. You can place the files for your website under /var/www. Note that this location is owned by the root user, so you'll need to copy your files over as root for it to work. Otherwise, you can do some further Apache configuration so you can place the files for your website in a directory somewhere under your home directory.
Fixing some common problems
Fixing phpMyAdmin
One common error that some people make is that they forget to mark apache2 during the phpMyAdmin configuration. When this happens you'll get a 404 Not Found error when trying to navigate to http://localhost/phpmyadmin/.
If this happens, enter the following terminal command.
You will be prompted about reinstalling the database. Accept the default of "No" and hit
Make sure to then mark apache2 by having the cursor next to apache2 and then hitting
You will then need to reload Apache.
You should now be able to load http://localhost/phpmyadmin/. If you're still seeing the 404 Not Found error, then you will need to clear your web browser cache and try again.
Fixing the Apache fully qualified domain name
During the above steps you may have seen an error message like this when reloading Apache.
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
This doesn't seem to cause any problems for me, but if you don't like seeing that error, you can fix it with this command.
Then reload Apache with
Enjoy your new web development environment!
Remove LAMP
The most popular post on this site is the one showing how to install a LAMP server on Ubuntu. Once you're done developing your websites on your computer, you may want to remove the LAMP server from your Ubuntu installation. Actually, you probably want to leave the Linux part and only remove the AMP part, (Apache, MySQL, php).
I've done a post previously that shows how to do this in several steps, but I wanted to come up with a more automated way. So I came up with this one-liner that will remove Apache, MySQL, php, and phpMyAdmin from your Ubuntu system.
Warning: this command will uninstall the packages from your system without asking for confirmation.
dpkg -l *apache* *mysql* phpmyadmin | grep ^ii | awk '{ print $2}' | xargs sudo apt-get -y purge --auto-remove
If you're a bit unsure about doing this and you only want to see a list of packages that will be removed, just leave off the end portion from the last pipe onward, like this.
dpkg -l *apache* *mysql* phpmyadmin | grep ^ii | awk '{ print $2}'
4 Responses to “Remove LAMP in Ubuntu
How to install zend framework on ubuntu: (apache server)
1. To download zend frame work here
2. Extract zip file.
3. Open ubuntu terminal cd Zend.
4. Type terminal : cp library/* /usr/local/lib/php/
5. Type terminal : cp bin/* /usr/local/bin/
6. Type terminal : ln -s /usr/local/bin/zf.sh /usr/local/bin/zf
7. Type terminal : zf profile
To view the zend framework details.
8. Type terminal : zf create project /var/www/jacksiva
9. Type terminal : ln -s /usr/local/lib/php/zend /var/www/jacksiva/library/
10. Type terminal :cd /etc/apache2/sites-available/
11. Type terminal :cp default jacksiva
12. Type terminal :nano jacksiva
13. Delete all text and type
<virtualhost *:80>
ServerName jacksiva
DocumentRoot /var/www/jacksiva/public
< /virtualhost>
14. Type terminal :cd /etc/apache2/sites-enable/
15. Type terminal : ln -s /etc/apache2/sites-available/jacksiva
16. Type terminal : nano /etc/hosts
17. Add host name
127.0.0.1 jacksiva
18. Restart apache : sudo /etc/init.d/apache2 restart
19. open browser type http://jacksiva
20. enjoy
This would be better in a for loop (eliminating the need for xargs):
for pkg in `dpkg -l *apache* *mysql* phpmyadmin | grep ^ii | awk '{ print $2}'`; do apt-get -y purge --auto-remove $pkg; done;
I gave your command a try. It works as long as I add a sudo to the apt-get command so it looks like this:
What I don't like about it is that it ends up running apt-get multiple times. apt-get carries some overhead with it, so your command will take longer to execute. I did a little benchmarking to confirm my suspicion. My command takes about 45 seconds to execute on my computer while your version takes about 74 seconds. In the end, it's not a big deal either way.
It just goes to show that there are often many ways to do things. I don't tend to use for loops very often on the command line, so thanks for offering your perspective.
I am running Ubuntu 10.04 under Virtual Box on a MAC Host. I have attempted to do a LAMP installation per instructions found online. I have successfully installed everything but the PHPMyAdmin. Something is wrong with the installation, but I have no way of knowing what it is. The command line instructions for the install, were clear, the process just wouldn't complete. And I've tried to go back and re-install PHPMyAdmin several times, now it tells me there's nothing to change or update, but I cannot access PHPMyAdmin in a browser, so it was obviously unsuccessful.
I want to uninstall JUST the PHPMyAdmin and try again. Can you give me a line of code that would do that? You probably forgot to select apache2 during the configuration of phpMyAdmin during installation. You don't need to reinstall phpMyAdmin. You can fix the configuration by following the instructions here:
If you still want to uninstall phpMyAdmin, you can do it with: