To be able to work with de RPI we need to get a few things in order beforehand.

Frist we need to put an image on the SD-card of the RPI.

— Download the image below (naam).

— Put the image on the SD-card (minimum 8 GB space required on SD-card). A handy tool to do this is Win32 Disk Imager.

— Safely remove the SD-card from your computer (safely remove: At the bottom right click on the arrow, then right click on the SD card and choose remove safely).

Connect the RPI

— Boot the RPI.

— Connect the RPI to your pc with an ethernet cable.

— Make an ssh connection using putty to the adress: 192.168.168.168 for the user *student* and password *W8w00rd*, remove the ‘*’.

Note: This image is written for azerty keyboards. The password in qwerty is: *Z!zààrd*, remove the ‘*’.

Setting up the RPI

— Type `sudo raspi-config`.

— Choose Advanced > Expand Filesystem.

— Reboot the PI (use command: sudo reboot and fill in the password: *W8w00rd*, remove the «*»).

WIFI connection

— Type `sudo -i`

— Type `wpa_passphrase >> /etc/wpa_supplicant/wpa_supplicant.conf`. Replace and to your own SSID and password, remove the «».

— Type `wpa_cli -i wlan0 reconfigure`

— (Optional) type `wget www.google.com` to see if it’s working.

Upgrade

If you want to upgrade the image to a newer version.

— Type `apt update` to see which updates are available

— Type `apt upgrade` to install the available updates.

— Type `Y` if you are asked if you are sure.

Configuration MySQLWorkbench

— start MySQLWorkBench on your PC.

— Make a new connection in MySQLWorkbench.

— Under Connection Method, choose Standard TCP/IP over SSH.

— SSH Hostname: `192.168.168`.

— SSH Username: `student`

— SSH Password: `W8w00rd`. Save this if possible.

— MySQL Hostname: `127.0.0.1`.

— MySQL Server Port: `3306`.

— Username: `student`

— Password: `W8w00rd` Save this if possible.

Configuration Visual Studio

— Open Visual Studio
— Install the extension : Remote-SSH.

— Press F1 and tap SSH.

Select the option: Remote-SSH: Add New SSH Host.

— Tap `ssh student@192.168.168.168 -A`

— Choose an option to save the file.
— Press F1 and tap SSH.

— Choose the option: Remote-SSH: Connect To Host.

— Choose the option: 192.168.168.

— A new window will open and the password for the RasPi will be requested.

— Type `W8w00rd`.

— After this, Visual Studio Codede connection will open and install some things on the RasPi.

> Be patient. It takes a little longer the first time.

Cloning GitHub repository:

— Create a repository. If you don’t know how watch a video about it.

— Click on the icon: Source Control in Visual Studio Code.

— Past your link to your repository.

— Press yess if Visual Studio Code asks to open the repository.

— You can also colne my repository from step (nog aan te vullen)

Frontend in apache

— Surf to: http://192.168.168.168.

— Normally you should see the Apache2 Debian Default Page.

— Type `sudo -i`

— Type `nano /etc/apache2/sites-available/000-default.conf`.

— Use the arrow keys to navigtate to «DocumentRoot /var/www/html or `DocumentRoot /home/student//Code/Frontend».

— Change this to `DocumentRoot /home/student//Code/Frontend`.

— Press: Ctrl + x, type `Y` and press: Enter.

— Type `service apache2 restart`.

— Now we have to set the permissions on the root folder correctly.

— open `nano /etc/apache2/apache2.conf` and use the down arrow to look for the following lines:

`\

Options FollowSymLinks

AllowOverride All

Require all denied

`

Change this to:

\

Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride All

Require all granted

_`

— Press: Ctrl + x, then type: `Y` and press: Enter.

— Type: `service apache2 restart`

automatic start-up (optional)

— Create a file named _myproject.service_.
— Place the following code in the file:

`[Unit]`

`Description=ProjectOne Project`

`After=network.target`

`[Service]`

`ExecStart=/usr/bin/python3 -u /home/student//Code/Backend/app.py`

`WorkingDirectory=/home/student//Code/Backend`

`StandardOutput=inherit`
`StandardError=inherit`

`Restart=always`

`User=student`

`[Install]`

`WantedBy=multi-user.target`

— As root user, copy this file to _/etc/systemd/system_ with the command `sudo cp myproject.service /etc/systemd/system/myproject.service`.

— To test the file, type `sudo systemctl start myproject.service`

— To stop the file, type `sudo systemctl stop myproject.service`

— If all works well, you can have the script start automatically after booting:

`sudo systemctl enable myproject.service`

Leave a Reply