1.01 Initially setup your RaspberryPI

So, buy a RaspberryPI

download RASPBIAN STRETCH LITE here (it’s minimal image, only cli, no visual), and write on a SD. I use Win32DiskImager, you can download here.

When you have wrote the SD, insert it into a windows computer, and create a file into /boot/ path. Named this file “ssh” without extension. This thing allow you to use ssh from the begin.

Insert the SD into raspberry and attach power supply. Now we see my default configuration…. packages installed, configuration files ecc.

Update your raspberry with the utility raspi-config. Update your timezone, change the host name and change your password.

Put pi in the sudoers

PI user in our cases must be like root. For this purpose the user pi will be in sudoers file, without password.

sudo nano /etc/sudoers
#adding this line at the end
pi ALL=(ALL) NOPASSWD: ALL

Install Apache2 and Php7. 0-cli

For making stable interface (maybe in http) and in the future a web-app for controlling stove and other feature we install apache2 and php7. 0…. Also php7. 0-cli for making script.

sudo apt install apache2 php -y
sudo chmod -R 777 /var/www/html

the last command is for making the wwwroot accessible also for pi user.
Now, we have to change configuration of apache and php for display eventualy errors. Open the php.ini and modify a line.

sudo nano /etc/php/7.0/apache2/php.ini
# search the line with display_errors=
# and set display_errors=On

sudo cp /etc/php/7.0/apache2/php.ini /etc/php/7.0/cli/php.ini
sudo service apache2 restart

Install WiringPI for access GPIO

Install the beautiful WiringPI library (here is the original guide)

sudo apt-get update
sudo apt-get purge wiringpi
hash -r
sudo apt-get install git-core
cd
git clone git://git.drogon.net/wiringPi
cd ~/wiringPi
git pull origin
cd ~/wiringPi
./build

Install sshpass for future use

In future posts We will use ssh and the utility sshpass for an automatic reverse tunneling and controls gpio remotly… You trust me.

sudo apt-get install sshpass

Set static IP to your Raspberry

Modify this file

sudo nano /etc/dhcpcd.conf

Now reboot, please.

Ok, Raspberry is ready

Now we have a raspberry ready for control relais and temperature sensor (one little setup for the DS18B20 in the next post). We have also apache2 and php for making some API and some cli-script. And olso GCC…. for making C++ and C software that is just installed by default.

Please follow and like us:

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

Fork me on GitHub