1

I am hoping to get guidance on using Apache and MySQL servers on Ubuntu 12.04. I am new to Linux, and am trying to setup a "Localhost" dynamic for basic website design.

In windows - I had used a simple free utiliy called XAMPP which installed Apache, MySQL, and a Localhost folder for my wesite work to reside. Though basic, this XAMPP install worked pretty good for my needs. Is there some stable utility in the Ubuntu depositories that will give me Apache and MySQL servers with a" htdocs(localhost)" folder where I can put websites that are under construction - (something similar to XAMPP) ? If not - instruction on how to manually configure this dynamic would be much appreciated.

Also, would welcome suggestions as to which is better. Thanks.

2
  • 1
    sudo apt-get install tasksel && tasksel See the menu ;)
    – Rinzwind
    Aug 12, 2013 at 17:52
  • hmm..this should be in the answer section, not in comment.
    – GaryP
    Aug 12, 2013 at 18:14

2 Answers 2

1

Check this out. LAMP means "Linux Apache MySQL, PHP".

http://www.howtoforge.com/ubuntu_lamp_for_newbies

0

LAMPP/XAMPP is probably also available for Linux.

But you can also install all things individually from the repositories (it's just a little bit harder). To install Apache, PHP, MySQL and phpMyAdmin, run the following command in the terminal:

sudo apt-get install apache2 mysql-server mysql-client php5 php5-mysql libapache2-mod-php5 phpmyadmin

You could also use Synaptic Package Manager to install these packages (it's graphical and easy to use). You can find it in the Software Center (if not installed already).

After that, open your browser and point it to localhost to see if Apache is working and localhost/phpmyadmin to see if phpMyAdmin is working. Apache should have started automatically.

You can start/stop/restart the Apache server by using the commands (respectively):

sudo service apache2 start
sudo service apache2 stop
sudo service apache2 restart

The folder where the websites (html files, php files, etc.) should go is /var/www. Note that you can't create/delete files in that folder directly (because you don't have write access). An easy solution is to create a folder for each website as root and set yourself as owner:

sudo mkdir "/var/www/SITE_NAME"
sudo chown YOUR_USERNAME:YOUR_USERNAME "/var/www/SITE_NAME"

Change SITE_NAME to the name of the folder you want and YOUR_USERNAME to your username. After that you should be able to do everything inside the folder you created. Then you would access the website in the browser through the URL localhost/SITE_NAME.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .