- 1 Prerequesites
- 2 Install from windows
- 2.1 Install from a unix
- 2.2 Install Raspberian OS
- 2.3 Connect and boot the device
- 2.4 Configure WiFi
- 2.5 Basic configuration
- 2.6 Establish remote connection
- 2.7 Configure network parameters manually
- 2.8 Create new user account
- 2.9 Set timezone
- 2.10 Install software
- 2.11 Connect with SFTP
- 2.12 Copying the Smartcore files onto the RaspBerry Pi
- 2.13 Install database tables
- 2.14 Configure startup script
- 2.15 Install node modules
- 2.16 Set file permissions
- Raspberry Pi unit.
- Cabled USB keyboard.
- PC monitor (or similar) with HDMI input.
- HDMI cable.
- Power supply.
- Micro SD card with a minimum of 4 GB capacity.
Install from windows
You need to add 3 programs to a windows PC to install and work with the raspberry computer: a sd-card image writer a sftp client and a ssh terminal.
Here I assume that you have these programs installed:
Install from a unix
Most distributions with GNU package installed, has native programsto support the operations needen.
To write a SD-card image, use this command:
dd if=<the downloaded image file> of=</dev/sd?>
To connect to the filesystem, open your filemanager and write in the address line:
sftp://<IP address of the RPI>
To access the ssh terminal, open a command line terminal and write:
ssh <IP address of the RPI>
Install Raspberian OS
Download Rasberian Stretch lite (zip file) - https://www.raspberrypi.org/downloads/raspbian/
Format your SD-card with a file system (doesn't matter which). It is recommended that you have only a single partition on the card, or no partitions.
The Linux distribution you have downloaded in the above ZIP file is provided as an ISO image. To install the image on to an SD card you need to use Etcher, which is a tool to transfer ISO files (and other image files) to portable storage media such as SD cards.
Launch Etcher, select your Raspberian Stretch Lite, select your SD card as the target, and start the transfer. When the transfer has completed, you are ready to boot your Raspberry Pi device with the card. Put the SD card into the device.
Connect and boot the device
For the first launch you will need to connect the power, keyboard and monitor. When the OS has booted you will be presented with a log-in prompt. The default username and password is:
(also sometimes denoted as pi::raspberry)
If your device only supports WiFi (Pi Zero) you must first configure the Wifi settings. (Otherwise you may skip this section)
This will open a text-based menu that allows you to alter the configuration of your device.
Select "Network options (2)"
Enter your local Wifi SSID (press <OK>)
Enter your local wifi password (press <OK>)
Exit the confifuration.
Check network configuration if using DHCP
You can check that your device is connected correctly to your network by typing the following command:
It will output something like this:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.0.0.128 netmask 255.255.255.0 broadcast 10.0.0.255 inet6 fe80::34f8:a96a:72b4:fc0b prefixlen 64 scopeid 0x20<link> ether b8:27:eb:67:57:97 txqueuelen 1000 (Ethernet) RX packets 28691 bytes 7663250 (7.3 MiB) RX errors 0 dropped 2 overruns 0 frame 0 TX packets 4552 bytes 475357 (464.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1 (Local Loopback) RX packets 147 bytes 60441 (59.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 147 bytes 60441 (59.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Note the IP address under the "eth0" network interface -> inet
If your network is using DHCP, you should see your current IP address, subnet mask, gateway address and DNS servers.
Enable SSH connections
To configure the device remotely from another computer, you must enable SSH connections. Type the following command:
This will open a text-based menu that allows you to alter the configuration of your device.
Select "Interfacing options (5)"
Select "P2 Enable SSH"
Select "OK" to the verification
You are now ready to connect to the device from another computer. The easiest tool to use from a Windows PC is Putty.
vælg menupunkter [Localisation Options] -> [Change Locale] vælg da_DK.UTF-8 UTF-8 tryk [space]-> [tab] til "ok" og tryk [Enter] vælg default: da_DK.UTF-8 UTF-8 [tab] til "ok" og tryk [Enter]
Establish remote connection
Launch Putty. Enter the IP address of the device into the "Host name or IP address" field. ENsure that SSH is selected as the connection type, and click "Open" at the bottom of the program.
The first time you connect, a warning about encryption keys will be displayed. You can safely select "Yes" to proceed, and get the SSH terminal window.
Log in to the device using the default credentials again.
Configure network parameters manually
If you need to configure the network settings manually in order to fit the device to your network, use the following commands:
sudo nano /etc/network/interfaces
This will open a text editor with the network parameters. Append the below text to the end of the file. Adapt the addresses to fit your own network. Click [CTRL][X] to exit. Select [Y] to save the changes. Your file should look something like this:
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.2 netmask 255.255.255.0 gateway 192.168.1.1
sudo nano /etc/resolv.conf.head
nameserver 22.214.171.124 nameserver 126.96.36.199
sudo systemctl disable dhcpcd.service
echo "net.ipv6.conf.all.disable_ipv6=1" | sudo tee -a /etc/sysctl.conf
sudo service networking restart
You will loose the connection. So noew you have to connect to the new address, to continue the installation.
Create new user account
Create an administrator account for SmartCore:
sudo adduser --ingroup www-data admin
- Press [Enter] to use default values or Specify values you prefer.
- Type and re-type a password when prompted
- At the end, type 'Y' to commit and exit.
Add groups to the new user
sudo usermod -a -G sudo,dialout,audio,video,input,i2c,gpio admin
Add groups to the SmartCore user account
sudo usermod -G gpio www-data
Set file permissions to allow sharing of files with the smartCore server:
sudo nano /etc/profile # insert this line at the bottom umask 002
Login with the new administrator account:
Delete pi default account:
sudo deluser pi
Set FTP file creation rights
Edit the the file /etc/ssh/sshd_config:
sudo nano /etc/ssh/sshd_config
find the line: Subsystem sftp /usr/lib/openssh/sftp-server (At the end of the file)
Change it to (or insert):
Subsystem sftp /usr/lib/openssh/sftp-server -u 0002
Save the file with: [ctrl]+[x] Then press [y],[enter] to confirm
Restart the SSH server:
sudo service ssh restart
Set the timezone to UTC
sudo dpkg-reconfigure tzdata
Install linux packages needed:
sudo apt-get update sudo apt-get install npm php-cgi postgresql postgresql-contrib php-pgsql
Do you want to continue? [Y/n]
Install node version manager
sudo -s cd /home/admin apt-get install git git clone https://github.com/creationix/nvm.git nvm nvm/install.sh rm -R nvm . nvm/nvm.sh nvm install 10
Answer "Y" and press [Enter] Make sure there are no error messages.
Create SmartCore directory: Type the below
sudo mkdir /home/smartcore cd /home/smartcore chown www-data:www-data . chmod 775 .
Connect with SFTP
You will need to know the IP Address of your smartcore
To find the Ip address of your smartcore:
Please consult the section #Basic configuration Note the eth0 line highlighted in bold letters In our example the IP Address is 10.0.0.128.
Open the file manager of windows
In the search bar:Type in: sftp://firstname.lastname@example.org - replace 10.0.0.128 with your IP address.
A password prompt will open
Type in: [Password you set earlier] You should now see the root directory of the raspberry Futu-rum: Please show a screenshot of the root folder
From Windows using WINSCP PROGRAM
We are using the Winscp program to access the Raspberry PI
You will be prompted when activating the winscp program
Login details User:
Type in admin
Type in [Password you set]
IP Address Check the #Basic configuration section for finding your IP address
Once you are logged in, you should see the /home/smartcore folder
We now have access to the Raspberry PI's smartcore folder
Open the filemanager and type the following in the address line:
It will prompt you for the password. You can now access the filesystem on the smartcore.
Copying the Smartcore files onto the RaspBerry Pi
Find the link named smartcore-yy-mm-dd.zip Download it, unpack and copy to the PI
Install database tables
****** Jesper todo :<) ******************
sudo -u postgres psql
Copy and paste the followin SQL to the command postgres prompt:
Set administrator password:
ALTER USER postgres WITH PASSWORD '<The password you use for the admin user>';
Create SmartCore database
CREATE DATABASE smartcore;
Create SmartCore user:
CREATE USER "www-data" WITH PASSWORD 'the secret database password'; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "www-data"; ALTER DATABASE smartcore OWNER TO "www-data";
Create tables etc:
\c smartcore SET SESSION AUTHORIZATION 'www-data'; \i /home/smartcore/public/context/system/operation/database/DBregenerate.sql
If no errors occurred, exit the SQL terminal by typing:
Edit Postgres settings:
sudo nano /etc/postgresql/9.6/main/postgresql.conf
Find the the line with autovacuum and change it to:
autovacuum = on
Press [Ctrl] + [X] confirm and press enter to exit the editor
Configure startup script
Smartcore uses init.d method to initialize startup script. (Soon to be Deprecated)
sudo ln -s /home/smartcore/smartcore.d /etc/init.d/smartcore sudo chmod 755 /home/smartcore/smartcore.d sudo update-rc.d smartcore defaults
Install node modules
Install node packages: express express-session ws body-parser cookie-parser ini pg serve-favicon winston wildcard sphp timexe
cd /home/smartcore sudo npm install
Set file permissions
sudo chown root:root /home/smartcore sudo chown www-data:www-data /home/smartcore/public chmod 777 /home/smartcore/public/var