From SmartCore Wiki
Revision as of 21:29, 19 September 2017 by Simon (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

SD card:

From Derbian:

get raspbarian image

 dd if=2015-09-24-raspbian-jessie.img of=/dev/sd?

/etc/resolv.conf

 nameserver 208.67.220.220
 nameserver 208.67.222.222

/etc/network/interfaces

 auto lo
 iface lo inet loopback
 auto eth0
 iface eth0 inet static
 address 10.0.0.10
 netmask 255.255.255.0
 gateway 10.0.0.1

Make user with i/o access

 adduser bruger
 sudo usermod -a -G sudo,dialout,audio,video,input,i2c,gpio,adm bruger 

edit /etc/ssh/sshd_config

 sudo nano /etc/ssh/sshd_config

find the line: (At the end of the file)

 Subsystem sftp /usr/lib/openssh/sftp-server

Change it to:

 Subsystem sftp /usr/lib/openssh/sftp-server -u 0002

and save the file

Remove user pi

 sudo killall -u pi
 sudo userdel pi
 sudo useradd -G gpio www-data

Remove X packages and stuff (~3GB) or use light version.

 apt-get purge --auto-remove  xserver* x11-common x11-utils x11-xkb-utils x11-xserver-utils xarchiver xauth xkb-data console-setup xinit lightdm  libx{composite,cb,cursor,damage,dmcp,ext,font,ft,i,inerama,kbfile,klavier,mu,pm,randr,render,res,t,xf86}* lxde* lx{input,menu-data,panel,polkit,randr,session,session-edit,shortcut,task,terminal} obconf openbox gtk* libgtk* alsa* nano python-pygame python-tk python3-tk scratch tsconf xdg-tools desktop-file-utils python3-numpy python3 python omxplayer
 raspi-config

install node as root

 git clone https://github.com/creationix/nvm.git nvm
 nvm/install.sh
 rm -R nvm
 nvm install 6.9
 nvm install 4.3
 nvm alias default 6.9

Do the same for each developer user




for development use:

https://github.com/creationix/nvm#installation

 sudo ln -s /home/bruger/.nvm/versions/node/v5.6.0/binode /usr/bin/node56
 sudo ln -s /home/bruger/.nvm/versions/node/v4.3.0/binode /usr/bin/node43


Alt 2

http://eureka.ykyuen.info/2014/05/07/ubuntu-install-node-ver%C2%ADsion-man%C2%ADager-globally-for-all-users/

 sudo apt-get install build-essential openssl libssl-dev curl git
 sudo git clone https://github.com/creationix/nvm.git /opt/nvm
 sudo mkdir /usr/local/nvm
 sudo mkdir /usr/local/node
 sudo chown -R root:www-data /usr/local/nvm
 sudo chmod -R 775 /usr/local/nvm
 sudo chown -R root:www-data /usr/local/node
 sudo chmod -R 775 /usr/local/node
 sudo vi /etc/profile.d/nvm.sh
 export NVM_DIR=/usr/local/nvm
 source /opt/nvm/nvm.sh
 export NPM_CONFIG_PREFIX=/usr/local/node
 export PATH="/usr/local/node/bin:$PATH"
 nvm alias default 6.9 


Install php

 sudo apt-get install php5-cgi php5-curl php5-pgsql

as new user

 mkdir smartcore
 cd smartcore

Set timezone

 sudo dpkg-reconfigure tzdata
 npm init
 npm install --save express express-session ws ini wildcard body-parser serve-favicon toobusy-js winston cookie-parser cookie sphp timexe


Copy smartcore files

 sudo chown -R www-data:www-data *
 sudo chmod 775 var
 sudo chmod 666 var/*
 echo ‘{"defensiveness":1}’  > public/var/def.conf


Posrgre batabase

 sudo apt-get install postgresql postgresql-contrib
 
 cd /home/smartcore/public/context/system/database
 su postgres -c psql < DBregenerate.sql
 
 sudo -u postgres psql postgres
   \c smartcore
   GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO "www-data";
  
 sudo vi /etc/postgresql/9.4/main/postgresql.conf
   autovacuum = on


Orange

Enable sftp edit /etc/ssh/sshd_config

 Subsystem sftp internal-sft
 Auth login ssh
 ssh-keygen
 ssh-copy-id <hostname>


Extras

samba

 sudo apt-get install samba samba-common-bin
 sudo edit

locate

 sudo apt-get locate


Aliase l ll la

 > cd
 > edit  .bashrc

unremark these:

 alias ll='ls -l'
 alias la='ls -A'
 alias l='ls -CF'



� Some handy shell commands

Scan all ports of a machine:

 nmap -p- 123.45.67.89


Opsætning af diverse ting via tekst menuer

 sudo raspi-config

SSH automise login Create shorthand eg: ssh name

 edit .ssh/config:
 	Host	a name of your choice	
 User	user id
 Port	port number
 HostName  DNS name or IP

if keys has been exchanged, this will store the password permanently:

 ssh-copy-id userid@remotehost


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