RFID Door Access V2.0
 Page :   [ 1 ]    [ 2 ]    [ 3 ]    [ 4 ]    [ 5 ]    [ 6 ]  

Getting the Pi up and running.

For this I use the Rasbian Jessie Lite disk image from raspberrypi.org.

I use a Mac so the commands and locations I mention here reflect that.

Note : /dev/diskX here will need to be the correct disk number.  Use disk utility and look at "info" for that disk.

curl -O -L https://downloads.raspberrypi.org/raspbian_lite_latest

unzip raspbian_lite_latest

sudo dd if=./2017-07-05-raspbian-jessie-lite.img of=/dev/diskX bs=1m

cd /Volumes/boot

touch ssh

cd /

At this point you can eject the MicroSD card and put it in the Pi and boot it.

Now ssh to the Pi.  When logged in run "sudo raspi-config" and select the option for Expanding The File System (under Advanced options).

Then get things up to date:

sudo apt-get update
sudo apt-get upgrade

 

I also use some oldish IDE's that require some config options for "/etc/ssh/sshd_config"

sudo pico -w /etc/ssh/sshd_config

#i added these lines to the bottom of "sshd_config" for 
#when i use aptana studio to edit sourcefiles on the pi

KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-cbc

Then the following to get PIGPIO on there (from abyz.co.uk/rpi/pigpio/)

cd ~/

wget abyz.co.uk/rpi/pigpio/pigpio.zip

unzip pigpio.zip

cd PIGPIO

make

sudo make install

 Then put this stuff into /etc/rc.local

sudo pico -w /etc/rc.local

# add the following to /etc/rc.local
# run pigpio as a daemon 
# i will be using GPIO 27 and GPIO 17 for the relays 
# so use "pigs" to set them here when it boots
# obviously use whatever pins make sense

/usr/local/bin/pigpiod
sleep 2
/usr/local/bin/pigs w 27 1 w 17 1

In addidtion to the previous stuff I'll be handling the access logic on the Pi so will also require a database, webserver and scripting with PHP.

sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password MyPassword'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password MyPassword'

sudo apt-get -y install mysql-server

sudo apt-get install -y \
lighttpd \
php5-common \
php5-cgi \
php5 \
php5-mysql \
php5-cli \
php5-gd

sudo lighty-enable-mod fastcgi-php

sudo /etc/init.d/lighttpd force-reload

sudo chown -R pi /var/www/html/
sudo chgrp -R www-data /var/www/html/
sudo chmod -R 750 /var/www/html/
sudo chmod g+s /var/www/html/
sudo chmod g+w /var/www/html/uploads   <-- example if web server needs to write

 Finally a couple tweaks for MySQL to hopefully make it perform a bit better.

sudo pico -w /etc/mysql/my.cnf

# look in the [mysqld] section
# and add the following

  skip-innodb
  default_storage_engine=MyISAM


# then also find and change the query_cache 
# size as follows

  query_cache_size = 8M

(Page 2 of 6)