Main menu

Purple Technician

Din leverantör av System- och tekniklösningar inom IT-området

Tjänster Läs mer

Mjukvara

Utveckling av mjukvara

Utveckling av applikationer och spel

Läs mer
Dator

Datornätverk

Installation, konfigurering, felsökning och support av nätverk, klienter, servrar och programvaror

Läs mer
Konsult

Konsulttjänster

Systemdesign, Weblösningar, IT-säkerhet, Utbildning m.m.

Läs mer

LAMP with Raspberry Pi

In this article I will show you how to install LAMP (Linux Apache Mysql Php) on your Raspberry Pi.

Step 1. SD-card preparations

First you should prepare your SD-card accordingly to the documentation. I recommend Raspbian as the OS.

 

Step 2. Connecting

Either connect a display, mouse and keyboard to connect or use some kind of software to SSH into the Raspberry Pi.

I usually use putty to SSH into the Raspberry Pi. Use your router to examine which IP-address the Raspberry Pi receives.

You login in as 'pi' with the password 'raspberry'

 

Step 3. Updating

First of all you shall  do the basic configuration of the Raspberry Pi:

Either the system starts 'raspi-config' automatically or you have to start it manually with

sudo raspi-config

As a security measure you shall change your passwd:

sudo passwd pi

Also change the root password with

sudo passwd root

Then you shall update your system with the following commands:

sudo apt-get update
sudo apt-get upgrade

You will be prompted if you would like to continue, typefor yes and hit enter to continue. This process may take a few minutes.

 

Step 4. Install Apache and PHP

To install Apache and PHP, use the following command: 

sudo apt-get install apache2 php5 libapache2-mod-php5

You will be prompted if you would like to continue, typefor yes and hit enter to continue. This process may take a few minutes. 

If you get any errors, run the following commands:

sudo groupadd www-data
sudo usermod -g www-data www-data

Restart Apache with the following command:

sudo service apache2 restart

Now go to your web browser of choice and type the Raspberry Pi's IP address into the URL bar. (if you cannot remember the IP address, use the ifconfig command). 

You should see a web page that says "It works!"

 

Step 5. Install Mysql

Install MySQL with the following command:

sudo apt-get install mysql-server mysql-client php5-mysql

You will be asked if you want to continue, type y for yes and hit enter to continue. 

During the installation, you will be prompted to set a new password for the MySQL root user.  Type a password of your choice, confirm the password again to continue the installation.

 

You are now done with your LAMP-installation!