Raspberry Pi

From Embedded Workshop
Revision as of 23:02, 2 December 2018 by JMerkle (talk | contribs) (Created page with "Installing 2018-11-13-raspbian-stretch-full.img, I noticed the image performs more steps for the user, including... * $ sudo apt-get update * $ sudo apt-get upgrade These com...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Installing 2018-11-13-raspbian-stretch-full.img, I noticed the image performs more steps for the user, including...

  • $ sudo apt-get update
  • $ sudo apt-get upgrade

These commands prepare the unit for installation of new packages. Before installing packages, let's remove some packages that we will never use...

  • $ sudo apt-get remove wolframscript
  • $ sudo apt-get remove scratch
  • $ sudo apt-get remove scratch2
  • $ sudo apt-get remove nuscratch
  • $ sudo apt-get remove sonic-pi
  • $ sudo apt-get autoremove

Using the du command, I notice the image includes November 2018 issue of MagPi magazine

  • $ rm -r ~/MagPi
$ df
 Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root       15203948 3335488  11185240  23% /
devtmpfs          470116       0    470116   0% /dev
tmpfs             474724       0    474724   0% /dev/shm
tmpfs             474724   18292    456432   4% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs             474724       0    474724   0% /sys/fs/cgroup
/dev/mmcblk0p1     44220   22540     21681  51% /boot
tmpfs              94944       0     94944   0% /run/user/1000

$ sudo hostname Porky

  • Change Digital Clock settings - format from "%R" to "%I:%M%p" I don't like 24 hour mode, and I don't like seconds displayed.
  • Edit ~/.bashrc, change one of the commented out alias to
alias ll='ls -la --color=auto'
pi@Porky:~ $ cat /proc/version
Linux version 4.14.79-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1159 SMP Sun Nov 4 17:50:20 GMT 2018

Add apache2, enable cgi, configure permissions group for i2c

$ sudo apt-get install apache2
$ sudo a2enmod cgi
$ sudo service apache2 restart

Configure www-data as a member of group, i2c, such that it can use /dev/i2c-1

$ sudo usermod -aG i2c www-data   or use   $ sudo adduser www-data i2c

Copy cgi programs to /usr/lib/cgi-bin

$ sudo cp ~/projects/tempcgi/tempcgi.cgi /usr/lib/cgi-bin
$ sudo chmod 755 /usr/lib/cgi-bin/tempcgi.cgi
$ sudo chgrp www-data /usr/lib/cgi-bin/tempcgi.cgi

After having problems with CGI not being able to access /dev/i2c-1, restarting apache fixed the problem

$ sudo service apache2 restart