Install BrewPi
Update repository pointers
$ sudo apt-get update
Install packages:
APACHE2 INSTALLATION
Full installation:
$ sudo apt-get install apache2
$ sudo apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi
But php5-cgi was the only thing missing from RPIDEV, so just install that:
$ sudo apt-get install php5-cgi
This actually resulted in multiple package installs and upgrades:
The following extra packages will be installed:
libapache2-mod-php5 php5-cli php5-common php5-gd php5-mcrypt php5-mysql php5-sqlite
The following NEW packages will be installed:
php5-cgi
The following packages will be upgraded:
libapache2-mod-php5 php5-cli php5-common php5-gd php5-mcrypt php5-mysql php5-sqlite
Package installation completed successfully
PHP INSTALLATION
This was already resident but ran installer to update the package
$ sudo apt-get install php5
Package update completed successfully
MYSQL INSTALLATION
Already resident but performed to update packages
$ sudo apt-get install mysql-server mysql-client php5-mysql
$ sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
Package updates completed successfully
PYTHON REQUIREMENTS INSTALLATION
$ sudo apt-get install python-serial python-simplejson python-configobj python-psutil python-git
Package updates completed successfully
ARDUINO IDE INSTALLATION
$ sudo apt-get install arduino-core
Already newest versions
SETTING UP USERS AND PERMISSIONS
Create user brewpi and group brewpi
$ sudo useradd -m -k /dev/null -G www-data,dialout brewpi
$ sudo passwd brewpi (set password = xxxxxxx)
Check brewpi rights
$ id brewpi
uid=1001(brewpi) gid=1004(brewpi) groups=1004(brewpi),20(dialout),33(www-data)
Add user pi to www-data and brewpi group
$ sudo usermod -a -G www-data pi
$ sudo usermod -a -G brewpi pi
NOTE: If you get the error "usermod: user 'pi' does not exist" then add user 'pi' then execute the usermod commands.
$ adduser pi
$ passwd pi (set the password twice)
Set the ownership of all files and subdirectories to brewpi and www-data (first two lines)
Give the group all permissions on all files (third and fourth line)
Give the group all permissions and set the sticky bit on all directories (fifth and sixth line).
NOTE: DID NOT DO THIS SECTION YET!
$ sudo chown -R www-data:www-data /var/www
$ sudo chown -R brewpi:brewpi /home/brewpi
$ sudo find /home/brewpi -type f -exec chmod g+rwx {} \;
$ sudo find /home/brewpi -type d -exec chmod g+rwxs {} \;
$ sudo find /var/www -type d -exec chmod g+rwxs {} \;
$ sudo find /var/www -type f -exec chmod g+rwx {} \;
4. Installing BrewPi
4.2.1. Cloning the remote repository
For BrewPi1:
$ sudo -u brewpi git clone https://github.com/BrewPi/brewpi-script /home/brewpi/brewpi1
Completed successfully
4.3. The web interface: brewpi-www
4.3.1. Cloning the remote repository
Target www directory should be empty (automatic installer may delete it!)
$ sudo -u www-data git clone https://github.com/BrewPi/brewpi-www /var/www/brewpi1
4.3.3. Fixing permissions after git commands
Edit the fixPermissions script in each BrewPi instance to match up with its path:
$ sudo nano /home/brewpi/brewpi1/utils/fixPermissions.sh
change webPath to point to subordinate brewpi1 folder:
webPath="/var/www/brewpi1"
Save the file and exit
Then execute each of the bash scripts:
$ cd /home/brewpi/brewpi1/utils
$ sudo bash fixPermissions.sh (for BrewPi1)
1.3. Modify the config files
1.3.1. Edit the script config files
The settings/config.cfg needs to be created in each script instance to properly configure them.
BrewPi1:
$ sudo nano /home/brewpi/brewpi1/settings/config.cfg
scriptPath = /home/brewpi/brewpi1/
wwwPath = /var/www/brewpi1/
port = /dev/brewpi1
altport = /dev/null
boardType = uno
Save the file and exit
1.3.2. Edit the web interface config files
config_user.php needs to be created in each web interface instance to properly configure them.
Here are the config files I’m using.
1. /var/www/brewpi1/config_user.php
<?php
// The default settings in config.php are overruled by the settings in config_user.php
// To use custom settings, copy this file to config_user.php and make your changes in config_user.php
// do not add a php closing tag, because newlines after closing tag might be included in the html
// Do not include a trailing slash on the path
$scriptPath = '/home/brewpi/brewpi1';
Save the file and exit
Set up identifiers for UNOS:
Remove all but one UNO from the USB ports and hubs, then run these commands:
$ udevadm info -a -n /dev/ttyACM0 | less > info.log
$ nano info.log
looking at parent device '/devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.4':
KERNELS=="1-1.3.4"
ATTRS{manufacturer}=="Arduino (www.arduino.cc)"
ATTRS{serial}=="85336303532351F0A031"
Repeat for additional UNOS on the USB ports
Then create the rules files:
$ sudo nano /etc/udev/rules.d/99-arduino.rules
SUBSYSTEM=="tty", KERNEL=="ttyACM*" , ATTRS{serial}=="85336303532351F0A031", SYMLINK+="brewpi1", GROUP="brewpi"
SUBSYSTEM=="tty", KERNEL=="ttyACM*" , ATTRS{serial}=="85334333931351F0F020", SYMLINK+="brewpi2", GROUP="brewpi"
[NOTE: created entries for both UNOs to allow swapping]
Once the udev rules file is created, disconnect your Arduino and then reload udev
before connecting all of the Ardiunos to their respective ports.
Disconnected UNO (but did not power cycle)
$ sudo /etc/init.d/udev reload
REBOOTED
BrewPi is up and running!