Setup LAMP and PhpMyAdmin in Ubuntu

Here are the steps to setup LAMP in Ubuntu:

  1. Execute this command in terminal: sudo apt-get install apache2 php5 php5-gd mysql-server-5.0 phpmyadmin. During this operation, you'll be prompted to enter some information needed.
  2. Test if setup was successful by opening your browser and entering "http://localhost/".
  3. Execute in terminal: sudo vim /etc/apache2/apache.conf. At this point, you'll be editing a file using vim to configure Apache2 to work with phpMyAdmin.
  4. Add this line at the bottom of the file: Include /etc/phpmyadmin/apache.conf
  5. Restart apache by executing this command in terminal: sudo /etc/init.d/apache2 restart
  6. Open your browser and go to "http://localhost/phpmyadmin/"
  7. You might notice that there is an error message when you restart apache w/c says "Apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName". To remove this, execute the command: echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn. "man tee" if you need information on the command.
  8. Then try restarting Apache2 again. If all is good, proceed to the next step.
  9. The default location where web documents are stored would be on /var/www/ though the folder requires owner permission. What I did is configured Apache2 to look for the files in /home/[user]/public_html. To do this, copy /etc/apache2/sites-available/default to /etc/apache2/sites-available/[name_you_would_like] by executing the command: sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/[name_you_would_like].
  10. Edit the newly copied file: sudo vim /etc/apache2/sites-available/mine
  11. Change the DocumentRoot and Directory to /home/[user]/public_html/
  12. Disable the default configuration file and enable the new one: sudo a2dissite default && sudo a2ensite [name_of_new_configuration_file]
  13. Reload the new configuration: sudo /etc/init.d/apache2 reload
  14. Restart Apache2: sudo etc/init.d/apache2 restart
  15. Done.
Note: I'm not sure what commands "really" require to "sudo". But, basically, those are the commands I went through. ^_^

References:
Update: I just found out after installing wordpress that you need to do:
chmod -R a+w /home/[user]/public_html/

0 comments: