Configure a PiJack from preconfigured image

  • First, setup a ftp account on power.sil.org for this user
  • Also, setup a pagekite account and write down the credentials for both
  • Determine the wifi ssid and passphrase if there will be a wifi connection
  • use dd to copy pre-built powermon image to sd card
  • insert and boot the Pi with an internet connection
  • login as pi default password is raspberry
sudo raspi-config
    # 1-change the password for user pi to something else secure and document it 
    # 2- set the proper timezone  under Locale settings)
    # 3- expand the filesystem to fill the SD card 


    #Check that the date & time are correct by typing "date". If you have a network connection NTP should have set the clock correctly
    #automatically. You can set the time manually with:
    #sudo date -s "11 JUN 2016 11:45:00"
    #Set the hardware clock to match the system time:

date
sudo hwclock -w
sudo apt-get update

    # create new ssh keys by doing this:
sudo apt-get --reinstall install openssh-server openssh-client
cd ~
tar -zxvf powermon-VER.tar.gz
cd powermon-VER
sudo ./install.sh 
    #the install program will need the ftp account credentials

sudo nano /etc/pagekite.d/10_account.rc:
    #Replace "NAME.pagekite.me" with "blabla-powermon.pagekite.me" 
    #Replace "YOURSECRET" with the correct Pagekite password

####sudo nano /etc/pagekite.d/80_sshd.rc
####    #Make sure these 2 lines are in there
####service_on = raw/22:@kitename : localhost:22 : @kitesecret 
####service_cfg = @kitename:22  : ip/162.40.29   : ok

 
    #If using wifi, fill in the correct SSID and password by editing the file 
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
    #Also, if using wifi
sudo nano /etc/cron.d/powermon
    # remove the "#" from the line about wifi_up.sh 

#####   ***OPTIONAL***    ############################
#### By default our image won't allow ssh access using password authentication since
#### everybody in the world knows the pi password is raspberry
#### If you want to allow remote username/password access after changing pi's password, you can do this.
#### Note that you can always login locally with a keyboard and monitor using pi and the password

####enable ssh password based authentication:
nano /etc/ssh/sshd_config

    ChallengeResponseAuthentication no
    PasswordAuthentication yes
    UsePAM yes

/etc/init.d/ssh restart

 
###########  Next steps are OPTIONAL for running on a usb drive             ############
###########  Theoretically most USB drives will last longer than a SD card  ############
#Get a USB flash drive, format it with a single ext4 partition
#as root, copy all the files from the SD card second partiton onto the usb drive (or from powermon-usb folder on my hdd)
#Now edit the file /etc/fstab on the usb drive, comment out the SD partition and add a line to mount sda1 as /
#Like so:

Sudo nano /etc/fstab

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


On the SD card boot partition edit /boot/cmdline.txt
Was:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mcsBlabla rootfstype=ext4 elevator=deadline rootwait

Is:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline rootwait rootdelay=5

#########################################################