Setup Raspberry Pi remote Server ============================================================================================================== 1. Download the latest Raspbian distro at https://www.raspberrypi.org/downloads/raspbian/ 2. Unzip the file. You'll get a file called something like 2016-05-27-raspbian-jessie.img 3. Put the SD card into your computer and then transfer the image to the SD card. An 8Gb card is sufficient for the servers. find out the device name of the SD card (e.g. /dev/sde ) sudo fdisk -l unmount the device if it has been mounted sudo umount /dev/sde1 sudo umount /dev/sde2 write img file to card (note this will erase the existing contents of the card completely) cd /home/dave/RaspberryPi/Downloads/Debian sudo dd bs=1M if=2016-05-27-raspbian-jessie.img of=/dev/sde sync 4. Eject or unmount the SD Card and put into the RPi 5. Connect the Raspberry to the network using an ethernet cable. We will set up the WiFi later. 6. Power on the RPi. A red light should glow and after a while the green light should blink (and that means the Linux is booting). A small yellow light tells you if you have network connectivity. 7. Determine the IP address for the RPI. I use Angry IP Scanner but other tools are available. If you are using the HDMI output you can just type: sudo ifconfig 8. ssh to pi ssh pi@ - default password is 'raspberry' configure using the raspi-config utility sudo raspi-config Do the following: 1. Expand Filesystem 2. Change User Password 3. Boot Options. Choose option B1. 4. Wait for Network at Boot - select 5. Internationalisation Options - I2 Change Timezone - set to Europe / London 9. Advanced Options A2. Hostname - choose a new name for your Raspi (e.g. wserver1) A4. SSH - Enable SSH A6. I2C - Enable automatic loading of I2C kernel module A7. Serial - Disable the serial connection Select Finish. Say to reboot request. When rebooted log back in via ssh using the new password you set. 9 Update the OS. sudo apt-get update (this will update the repository database) sudo apt-get -y upgrade (this will upgrade the current packages to the latest version) This may take a while, depending on how old the OS image is at time of installation. When done reboot the RPI (sudo reboot) 10. Add the following to .profile for root and pi user: alias ll='ls -l' EDITOR='vi'; export EDITOR Then run: . .profile Setup WiFi and eth0 with static ip addresses ======================================================= sudo vi /etc/wpa_supplicant/wpa_supplicant.conf add lines: network={ ssid="your_AP_SSID" psk="Your_wifi_password" key_mgmt=WPA-PSK } sudo vi /etc/dhcpcd.conf add lines: interface eth0 static ip_address=192.168.1.201 static routers=192.168.1.254 static domain_name_servers=192.168.1.254 static domain_search= interface wlan0 static ip_address=192.168.1.202 static routers=192.168.1.254 static domain_name_servers=192.168.1.254 static domain_search= Backup the RPi SDCard Contents (optional) ========================================= shutdown the RPi remove the sd card & mount on Linux PC find out what device it is using fdisk -l (sdd) cd to wherever you want to save the image cd /home/dave/RaspberryPi/Backups/ backup the sd card contents dd bs=1M if=/dev/sde of=Backup_WeatherPi_$(date +'%Y%m%d-%H%M%S').img ( to restore backup to SD Card use: dd bs=1M if= of=/dev/sde ) Setting up 1-wire on the Raspberry Pi using the Sheepwalk Electronics RPI2 Interface ==================================================================================== (using instructions from: http://www.sheepwalkelectronics.co.uk/RPI2_software.php) power off the RPi Connect the RPI2 to the GPIO connector - ensure it is in the correct pins power on the RPi The RPI2 is designed to work with the Linux kernel I2C drivers and is supported by OWFS. Add the I2C tools (this makes it possible to use the I2C interface without being root) sudo apt-get install i2c-tools To get it to work you need to ensure you have a kernel with the I2C drivers in it. Most of the kernels available for the Raspberry Pi have this support already built in. To load the modules required do the following: sudo vi /etc/modules -- add lines (if not already present): i2c-bcm2708 i2c-dev This will ensure the modules get loaded at boot. To load them immediately: sudo modprobe i2c-bcm2708 sudo modprobe i2c-dev If this has worked you can probe the I2C bus as follows: i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- This is showing the DS2482-100 I2C device as device ID 0x18 which unless you have altered J1 or J2 is where it should be. ---- Note --------------------------------------------------------- If you have an earlier RasPi you will have to "i2cdetect -y 0" as the I2C busses were swapped around between Rev1 and Rev2. ------------------------------------------------------------------- Install OWFS ==================================================================== OWFS stands for One Wire File System. It allows the devices on the 1-wire bus to be accessed like a regular file system on the Raspberry Pi. The devices are mounted onto a mount point in the file system, which can be wherever you want. I create a special mount point directly under the root filesystem at /1wire/OWFSRoot. sudo apt-get install owfs ow-shell Create a mountpoint for owfs: sudo mkdir -p /1wire/OWFSRoot Set up the following owfs.conf config file ==================================================================================== /etc/owfs.conf ==================================================================================== # Sample configuration file for the OWFS suite for Debian GNU/Linux. # # # This is the main OWFS configuration file. You should read the # owfs.conf(5) manual page in order to understand the options listed # here. ######################## SOURCES ######################## # # With this setup, any client (but owserver) uses owserver on the # local machine... ! server: server = localhost:4304 # # ...and owserver uses the real hardware, by default fake devices # This part must be changed on real installation #server: FAKE = DS18S20,DS2405 server: device=/dev/i2c-1 # # USB device: DS9490 #server: usb = all # # Serial port: DS9097 #server: device = /dev/ttyS1 # # owserver tcp address #server: server = another_host:4304 # # random simulated device #server: FAKE = DS18S20,DS2405 # ######################### OWFS ########################## # mountpoint = /1wire/OWFSRoot allow_other # ####################### OWHTTPD ######################### #http: port = 2121 ####################### OWFTPD ########################## #ftp: port = 2120 ####################### OWSERVER ######################## server: port = localhost:4304 ====================================================================================