sunnuntai 31. maaliskuuta 2013

LAMP - Linux, Apache, MySQL, PHP

Original tutorial: Penguintutor

I wanted to install LAMP stack to my RaspberryPi, because I wanted to host websites, files and other stuff. Your computer has to have static IP address to succesfully host websites available for anyone. Read more about static IP address on my next post.

My Pi has 512mb ram memory. However it is shared between the graphics and main system memory. By default 64mb is allocated to graphics. This is overkill if you don't plan to run the graphical interface as in the case of a server. To reduce the amount of memory available for graphics to 32mb enter the following command.

$ sudo cp /boot/arm224_start.elf /boot/start.elf
or use sudo raspi-config to do this using the config menu

First we install Apache webserver. But before that make sure you have updated the repositories to make sure that your computer knows about any new packages or versions available, with:
$ sudo apt-get update
Then install the Apache with:
$ sudo apt-get install apach2

Now you could basically host websites just putting them under /var/www 
to test that the Apache is working open your browser and surf to http://localhost/ you should see apache welcome message. You can also put directories to www folder and locate them with browser by typing example http://localhost/testpage

Installing MySQL
$ sudo apt-get install mysql-server

During the install there is a prompt request for a password.
The password is for the mysql root user.

Installing PHP version 5 and the mysql libraries to allow PHP to access the mysql database.

$ sudo apt-get install php5
$ sudo apt-get install php5-mysql

Completed
Once the setup is completed you can acces the web page by pointing your browser to the router IP address or DNS entry. 

To test that the webserver and PHP are working correctly then delete the file /var/www/index.html and create a file /var/www/index.php with the contents of this page.

To enter phpmyadmin panel go to http://localhost/phpmyadmin

Ei kommentteja:

Lähetä kommentti