tisdag 15 augusti 2017

Install Apache, MySQL & PHP (LAMP) on Raspberry Pi

#Install apache
sudo apt-get install -y apache2

#Install mysql-server (replace with mariadb-server?)
sudo apt-get install -y mysql-server


 
#Install PHP
sudo apt-get install -y php5 php5-cli php5-mysql
sudo apt-get install  -f php-pear
#-f forces late version, fixes dependency problem with Net_SMTP

sudo pear install Mail
sudo pear install Net_SMTP

Prepare new Raspberry Pi

#Burn latest Raspbian Light with Etcher

#Create file with name "ssh" in boot partition

##http://downloads.raspberrypi.org/raspbian/release_notes.txt

#Boot and sign in with pi:raspberry


sudo nano /etc/fstab

#Add following lines:
tmpfs    /tmp    tmpfs    defaults,noatime,nosuid,size=100m    0 0
tmpfs    /var/tmp    tmpfs    defaults,noatime,nosuid,size=30m    0 0
tmpfs    /var/log    tmpfs    defaults,noatime,nosuid,mode=0755,size=100m    0 0
tmpfs    /var/run    tmpfs    defaults,noatime,nosuid,mode=0755,size=2m    0 0
tmpfs    /var/spool/mqueue    tmpfs    defaults,noatime,nosuid,mode=0700,gid=12,size=30m    0 0
##http://www.zdnet.com/article/raspberry-pi-extending-the-life-of-the-sd-card/
tmpfs    /var/log/apache2 tmpfs defaults,noatime,nosuid,mode=0755,size=50m 0 0
tmpfs    /var/log/mosquitto    tmpfs    defaults,noatime,nosuid,mode=0777,size=100m    0 0




sudo raspi-config
#1 - Change password
#2 - Hostname
#4 - Localization (x3)
#7 - Advanced - Expand filesystem

sudo nano /etc/dhcpcd.conf

interface eth0
static ip_address=192.168.1.2/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1


sudo reboot

#Log in again


sudo apt-get update && sudo apt-get upgrade -y





#https://www.raspberrypi.org/learning/networking-lessons/rpi-static-ip-address/