Category Archives: Geek

Sweet computer stuff I have found

ARPIC, Install Raspbian Lite onto a Raspberry Pi

ARPIC – Another Raspberry Pi Controller

Hardware  :

Raspberry Pi

4GB or larger Micro SD card

Network connection – cable or WiFi

PC with an SD card reader (Windows OS in this example)

Software:

For help getting Raspbian onto your SD card, take a look at these pages;

https://www.raspberrypi.org/documentation/installation/installing-images/

https://www.raspberrypi.org/documentation/installation/installing-images/windows.md

Lets get started!

Continue reading ARPIC, Install Raspbian Lite onto a Raspberry Pi

Install Lighttpd with PHP and a custom web page

Lighttpd web server has been chosen for this project, you can use Apache or anything else you like that supports PHP, I found others a little heavy for this.

As normal, ensure your system is up to date and cleanup any archived download packages using the below code;

sudo apt-get update && sudo apt-get dist-upgrade

sudo apt-get clean

Install Lighttpd

After running the update and cleanup from above, go for launch!

sudo apt-get install lighttpd

Reboot the system to get all the services up and running together.

sudo reboot now

www-data Permissions

I think there is a miss conception concerning the folder permissions for this section,  most instructions that I have come across say to add the pi user to the www-data group to allow modify access the the files.

I think this is wrong as the Lighttp daemon runs in its own service with access to no writable files/folders, apart from \tmp. This is great for security, but if you add the pi user to this group, you are then allowing write access to your web folder.

Instead, the pi user takes ownership of the www-data folder and provides Lighttp with read and modify access to only the files it needs.

sudo chown -R pi:www-data /var/www
sudo chmod u+rxw,g+rx-w,o-rwx /var/www
sudo chmod g+s /var/www

chmod documentation: https://ss64.com/bash/chmod.html

Install PHP

Install php7.0 including it’s dependencies

sudo apt-get install php7.0-common php7.0-cgi php7.0

To enable Lighttp with PHP FastCGI, use the below code;

sudo lighty-enable-mod fastcgi-php

Reload the service;

sudo service lighttpd force-reload

Testing time

From another device, using an internet browser, navigate to your Raspberry Pi’s address i.e. http://raspberrypi or the hostname updated in the install section.

If no page loads, check the logs Lighttp logs located at /var/log/lighttpd/error.log

 

 

Raspberry Pi FTP WWW Folder Permission issues

After following guides to install my preferred web server for the Raspberry Pi, Lighttpd, I always seem to have a problem with permissions when modifying files in or under /var/www/ folder.

In the guides that have I have gone through you do go through adding the Pi user to the www-data folder and what not but you will still get Permission Denied error when trying to add/remove/modify/create files when SFTP’ing in.

Continue reading Raspberry Pi FTP WWW Folder Permission issues

Raspberry Pi Thermal Probe

How to read a temperature probe, save the value to a MySQL database and then show the value on a webpage or just show the value with no database.

 

See this link for how to setup a DS18B20+ thermal probe with a Raspberry Pi, these instructions  are the best that i have come across for this and will cover the bullet points below :

  • Enabling the 1 wire features in the Raspbian OS
  • Physically connecting the probe via a resistor to the RPi
  • Instructions on how to read the probe and a script example

https://www.modmypi.com/blog/ds18b20-one-wire-digital-temperature-sensor-and-the-raspberry-pi

Once you have followed the above steps you should have a working temperature probe, that’s great.. but what can you do with it now!?

For the piTank/piGrow projects,  I started off by just using the script provide in the instructions above, modifying it slightly and using that to display the temperature value on the piTank web-page. Using some JavaScript you can make the box’s refresh every x seconds, running the probe read script and showing a new value without the need for a page reload.  I call this a ‘live’ reading.

Continue reading Raspberry Pi Thermal Probe

Configure Client Network Time (NTP)

Information directly copied from : https://www.cs.cmu.edu/~help/networking/ntp.html –

for quic ref…

 Windows 7

Windows 7 systems benefit from using the full set of NTP servers, but cannot be configured to obtain NTP server information from DHCP. Because the control panel does not allow setting multiple servers, settings on these systems must be verified and changed from a command prompt. Systems which are members of the SCS domain will receive NTP configuration via domain group policy and should not be reconfigured.

Continue reading Configure Client Network Time (NTP)