==== Links ==== * [[parnu_elamine:smarthome.raspberry_pi|Raspberry Pi specific installation & configuration]] (GPIO PIN reading etc.) * [[parnu_elamine:smarthome.beaglebone_black|Beaglebone black specific installation & configuration]] (GPIO PIN reading etc.) ==== Installation ==== apt-get install php5 php5-cli apt-get install vim apt-get install rrdtool apt-get install screen apt-get install python apt-get install mercurial apt-get install git apt-get install imagemagick apt-get install fonts-tlwg-sawasdee apt-get install lirc apt-get install php5-mysql mysql-server mysql-client apt-get install python-mysqldb apt-get install sqlite php5-sqlite python-pysqlite2 apt-get install build-essential python-pip python-dev python-smbus git apt-get install sendmail ==== Set up my smarthome environment ==== cd /srv sudo hg clone https://renebe@bitbucket.org/renebe/smarthome/ cd /srv/smarthome/config ln -s ../1wire/configs/ 1wire # fix configuration cd /srv/smarthome/config cp conf.php-dist conf.php vi conf.php cp 1wire/owfs_temperature.py-dist 1wire/owfs_temperature.py ==== configuration ==== # configure apache vi /etc/apache2/sites-enabled/000-default ServerAdmin smarthome@rene.ee DocumentRoot /srv/smarthome/www Options FollowSymLinks AllowOverride None Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined /etc/init.d/apache2 restart # add ssh keys vi .ssh/authorized_keys # fix aliases & bashrc vim ~/.bashrc alias l='ls -la' alias vi=vim alias 1wire='python /srv/smarthome/1wire/temperature_owfs.py' alias generate_graphs='php /srv/smarthome/1wire/scripts/draw_graphs.php' alias t01='printf "sauna (28.FF24983E0400): ";cat /mnt/1wire/28.FF24983E0400/temperature; echo ""' alias t02='printf "sauna boiler (28.FF959C3C0400): ";cat /mnt/1wire/28.FF959C3C0400/temperature; echo ""' alias t03='printf "server room (28.FFAB583A0400): ";cat /mnt/1wire/28.FFAB583A0400/temperature; echo ""' alias t04='printf "outside (28.FF1D983E0400): ";cat /mnt/1wire/28.FF1D983E0400/temperature; echo ""' alias t05='printf "livingroom (28.FFC4583A0400): ";cat /mnt/1wire/28.FFC4583A0400/temperature; echo ""' alias ttt='t01;t02;t03;t04;t05' cd /srv/smarthome source ~/.bashrc # fix hgrc vi ~/.hgrc [ui] username = René Bernard # fix vimrc vi ~/.vimrc syntax enable set background=dark colorscheme solarized set encoding=utf-8 set tabstop=4 set shiftwidth=1 set nocindent set softtabstop=4 set expandtab set noerrorbells set vb set nowrap set ruler set viminfo='100,\"100,:20,%,n~/.viminfo au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif autocmd Filetype gitcommit setlocal spell textwidth=72 # add Estonian locale locale-gen et_EE.UTF-8 dpkg-reconfigure locales # shows GUI to select timezone dpkg-reconfigure tzdata # crontab crontab -e MAILTO="" * * * * * cd /srv/smarthome/; php 1wire/scripts/draw_graphs.php * * * * * cd /srv/smarthome/; sudo php sauna_display.php # add sudoers visudo # for Pi pi ALL=(ALL) NOPASSWD: ALL # for Apache to run GPIO commands www-data ALL=(ALL) NOPASSWD: ALL # screen **NB! Only run it on the main server and not on all! This is the box that has 1wire sensors and energy sensor connected to it.** vi ~/.screenrc # don't display the copyright page startup_message off # increase scrollback buffer size defscrollback 10000 # create windows screen -t "job-temperature" python /srv/smarthome/1wire/temperature_owfs.py screen -t "job-energy" python /srv/smarthome/scripts/energy_meter.py screen -t "pi" ssh pi@raspberrypi screen -t "empty"