Installing Raspbian OS
Important: In order to use tha Raspberry without a screen, mouse and keyboard, you must create an empty file named "ssh" into the "/boot" on your SD card. Remember that you have to connect your device to the network using an ethernet cable.
Update your OS
sudo apt-get update && sudo apt-get dist-upgrade
Mount external hard drive
First find your hardware:
sudo blkid
Next make your OS mount the external drive at boot
sudo nano -Bw /etc/fstab
You have to include the following lines (using the correct UUID)
UUID=0000000000000000 /media/externalUSB auto defaults,user,nofail 0 2
Install Samba
sudo apt-get install samba samba-common-bin
Samba setup
Open the samba configuration file
sudo nano /etc/samba/smb.conf
Simply add the following lines into that file:
[Files on external USB]
comment = Files
public = yes
writable = yes
browsable = yes
path = /media/externalUSB
create mask = 0777
directory mask = 0777
guest ok = yes
only = no
Install Apache
sudo apt-get install apache2
Change permissions
sudo chown -R $USER:$USER /var/www
sudo chown -R 755 /var/www
Restart Apache
sudo service apache2 restart
Put your device to sleep for 60 seconds
This will not work on Raspberry since the device has no internal clock
sudo rtcwake -m disk -s 60
Run a Program On Your Raspberry Pi At Startup
You can edit rc.local
using the following command:
sudo nano /etc/rc.local
Be sure to leave the line exit 0 at the end.
If your program runs continuously (runs an infinite loop) or is likely not to exit, you must be sure to fork the process by adding an ampersand (“&”) to the end of the command, like:
sudo python /home/pi/sample.py &