Monday 17 December 2012

Instructions for SCANPI setup

TODO number 2. Taken from the bitbucket see this...
== INSTALLING BITS ==
(get an updated set of files onto the PI)
* sudo apt-get update
* sudo apt-get install vim
* sudo apt-get install apache2
* sudo apt-get install php5
* sudo apt-get install mpg123

== SETTING UP USERS ==
(ensures that apache can read, write, etc)
* sudo groupadd www-pub
* sudo usermod -a -G www-pub pi
* sudo usermod -a -G www-pub www-data

== SET UP AUDIO OUT ==
(points the audio out the headphone socket instead of the HDMI)
* sudo amixer cset numid=3 1

== MOUNTING USB HDD ==
(first make places to mount and set permissions)
sudo mkdir -p /mnt/2tb_USB_hard_disc
sudo mkdir -p /mnt/scanpi
sudo chmod 775 /mnt
sudo chmod 775 /mnt/2tb_USB_hard_disc
sudo chmod 775 /mnt/scanpi

(mount the main disc and test...)
sudo mount -o uid=pi,gid=www-pub /dev/sda1 /mnt/2tb_USB_hard_disc
ls /mnt/2tb_USB_hard_disc/

(create a loopback disc for mounting a second partition)
sudo losetup /dev/loop0 /mnt/2tb_USB_hard_disc/virtualfs

(mount the loopback disc and test...)
sudo mount -t ext3 /dev/loop0 /mnt/scanpi/
ls /mnt/scanpi/

if that all works, then you can do it 'properly'.

== MAKING THE MOUNT STICKY AFTER REBOOT ==
(edit the HDD details for main disc and loopback)
* sudo vim /etc/fstab

 #!shell
 proc            /proc           proc    defaults          0       0
 /dev/mmcblk0p1  /boot           vfat    defaults          0       2
 /dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
 # a swapfile is not a swap partition, so no using swapon|off from here on,
 use  dphys-swapfile swap[on|off]  for that

* AFTER EDITING

 #!shell
 proc            /proc           proc    defaults          0       0
 /dev/mmcblk0p1  /boot           vfat    defaults          0       2
 /dev/mmcblk0p2  /               ext4    defaults,noatime  0       1

 # EXTERNAL DISC MOUNTS
 UUID=4830-1CF9 /mnt/2tb_USB_hard_disc vfat uid=pi,gid=www-pub 0 0
 /mnt/2tb_USB_hard_disc/virtualfs /mnt/scanpi ext3 loop,auto 0 0

 # a swapfile is not a swap partition, so no using swapon|off from here on,
 use  dphys-swapfile swap[on|off]  for that

(test the remounting)
* sudo mount -a

== SETTING STATIC IP ==
(making comms easier = set PI as 192.168.0.227)
* more /etc/network/interfaces

 #!shell
 auto lo

 iface lo inet loopback
 iface eth0 inet dhcp

 allow-hotplug wlan0
 iface wlan0 inet manual
 wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
 iface default inet dhcp

== AFTER EDITING ==
* more /etc/network/interfaces

 #!shell
 auto lo

 iface lo inet loopback
 iface eth0 inet static
 address 192.168.0.227
 netmask 255.255.255.0
 gateway 192.168.0.1

 allow-hotplug wlan0
 iface wlan0 inet manual
 wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
 iface default inet dhcp

* sudo /etc/init.d/networking restart (might work for you... for me, it
 showed warning... so I did a reboot)
* reboot = ip correct.

After all that, you should have PI with all the bits running, installed, etc. You should be able to get the Apache It Works page at http://192.168.0.227. If you can't, add comment and we'll look into it.

No comments:

Post a Comment