Make SD disk - MAC OS X
Option 1
df -h
unzip ~/Downloads/2012-12-16-wheezy-raspbian.zip
diskutil list //find the correct /dev/diskx
diskutil unmountDisk /dev/disk2
sudo dd bs=1m if=~/Downloads/2012-10-28-wheezy-raspbian/2012-12-16-wheezy-raspbian.img of=/dev/disk1
diskutil mountDisk /dev/diskx
Option 2
format disk met SDFormat option full
copy NOOB files on disk
Setup on SD
1 Place an empty file ssh in the root path in order to get ssh access
2 edit wpa_supplicant.conf add (file is removed after booting):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WIFI"
psk="Mysecret4"
scan_ssid=1
}
3 edit config.txt and add:
#Enable UART
enable_uart=1
4 boot and login with
ssh pi@rasberry.local password raspberry
Setup
sudo raspi-config // config screen
sudo apt-get update // install new versions of software fetch the package list
sudo apt-get upgrade // will fetch new versions of packages existing on the machine
sudo apt-get dist-upgrade //same as upgrade but also dependencies
reboot
Network
sudo nano /etc/network/interfaces
iface eth0 inet static //static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
sudo more /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="NAMEWIFIROUTER"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="password"
Multiple networks
/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SCHOOLS NETWORK NAME"
psk="SCHOOLS PASSWORD"
id_str="school"
}
network={
ssid="HOME NETWORK NAME"
psk="HOME PASSWORD"
id_str="home"
}
/etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface school inet static
address
gateway
netmask
iface home inet static
address
gateway
netmask
Network problems
1 Check that the hardware is connected (lights on both ends) or with iwconfig wlan0 (for WiFi)
2. Check that the kernel can see the hardware with:
ifconfig -a
3. Check that you active interface has an IP address
ifconfig eth0
ifconfig wlan0
4. Check the kernel routing table
route -n (or ip route)
5. Check you can ping your gateway (you get the gateway address from the route command)
ping 192.168.2.1
6. Check you can ping 8.8.8.8 (Google's DNS server)
ping 8.8.8.8
7. Check you can resolve host names (ping google.com)
Simple Unix command
ls //list files
pwd
which pwd //where is my pwd command
lsusb //show USB devices
cp file1 file2 // copy
mv file1 file3 // rename of move
df -h // show mounted filesystems
AFP
Samba
sudo apt-get update
sudo apt-get install samba
sudo apt-get install samba samba-common-bin
nano /etc/samba/smb.conf //edit config file
sudo service samba restart //iedere keer als je iets veranderd
[global]
workgroup = workgroup
server string = %h
wins support = no
dns proxy = no
security = share
encrypt passwords = yes
panic action = /usr/share/samba/panic-action %d
[sites]
path = /mnt/data
writeable = yes
broweable = yes
read only = no
guest ok = yes
force user = root
sudo smbpasswd -a john //add samba user
sudo mkdir /mnt/data
sudo chmod 777 /mnt/data
Change host name
sudo nano /etc/hostname
sudo nano /etc/hosts
sudo reboot //reboot
sudo halt //stop
sudo adduser john // make new user
sudo adduser john sudo // make user sudo
sudo nano /etc/sudoers
sudo fdisk -l // show attached drives
Add hard disk
sudo apt-get install ntfs-3g //install Read NTFS
sudo apt-get install hfsplus
sudo blkid // show all
nano /etc/fstab // mount at start up
/dev/sd /mnt/data ntfs defaults 0 0
sudo mount -a
Video Web cam
sudo apt-get install motion
sudo nano /etc/motion/motion.conf
sudo nano /etc/default/motion
http://192.168.2.111:8081
sudo apt-get install python-opencv
VNC remote desktop
apt-get install tightvncserver
if server is started on 1 this means port 5901
in finder (connect icon) vnc://192.168.2.70:5901
Apache webserver
sudo apt-get install apache2
sudo nano /etc/apache2/sites-enabled/000-default
AddHandler cgi-script .py
sudo chmod 777 /usr/lib/cgi-bin/test.py
special raspberry ROM's / images:
MotionPi: use the camera for spying or for video
ssh root@192.168.2.181
use password after the dash name router
use find to find IP adres of the raspberry
Safari: 192.168.2.1
admin ; no password
use vi for editing files
set wifi password and SIID of the router in /data/etc/wpa_ ...
Sound
sudo apt-get install alsa-utils
sudo apt-get install mpg321
sudo apt-get install lame
https://nodered.org/docs/hardware/raspberrypi
(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
node-red-start
In safari 192.168.2.70:1880
npm install node-red-node-mongodb
mongo
sudo apt-get install mongodb-server
mongod // start server
mongod --dbpath /data/db --repair // repair if RPi shutdown un
mongo
show dbs // show databases
use Mydb
show collections // show collections
db.createCollection(“my collection”) // Make a collection
db.mycollection.remove() // remove collection
db.addUser( { user: "joe",
... pwd: "secret",
... roles: [ "readWrite", "dbAdmin" ]
... } )
http://192.168.2.70:28017 //Webinterface
Option 1
df -h
unzip ~/Downloads/2012-12-16-wheezy-raspbian.zip
diskutil list //find the correct /dev/diskx
diskutil unmountDisk /dev/disk2
sudo dd bs=1m if=~/Downloads/2012-10-28-wheezy-raspbian/2012-12-16-wheezy-raspbian.img of=/dev/disk1
sudo dd bs=1m if=~/Downloads/2017-03-02-raspbian-jessie.img of=/dev/disk2
CTRL T gives information about process
Option 2
format disk met SDFormat option full
copy NOOB files on disk
Setup on SD
1 Place an empty file ssh in the root path in order to get ssh access
2 edit wpa_supplicant.conf add (file is removed after booting):
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="WIFI"
psk="Mysecret4"
scan_ssid=1
}
3 edit config.txt and add:
#Enable UART
enable_uart=1
4 boot and login with
ssh pi@rasberry.local password raspberry
Setup
sudo raspi-config // config screen
sudo apt-get update // install new versions of software fetch the package list
sudo apt-get upgrade // will fetch new versions of packages existing on the machine
sudo apt-get dist-upgrade //same as upgrade but also dependencies
reboot
Network
sudo nano /etc/network/interfaces
iface eth0 inet static //static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1
iface eth0 inet dhcp //DHCP
allow-hotplug wlan0 //wifi
iface wlan0 inet dhcp
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
sudo more /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="NAMEWIFIROUTER"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
psk="password"
Multiple networks
/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SCHOOLS NETWORK NAME"
psk="SCHOOLS PASSWORD"
id_str="school"
}
network={
ssid="HOME NETWORK NAME"
psk="HOME PASSWORD"
id_str="home"
}
/etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface school inet static
address
gateway
netmask
iface home inet static
address
gateway
netmask
Network problems
2. Check that the kernel can see the hardware with:
ifconfig -a
3. Check that you active interface has an IP address
ifconfig eth0
ifconfig wlan0
4. Check the kernel routing table
route -n (or ip route)
sudo route add default gw 192.168.2.1 wlan0
ping 192.168.2.1
6. Check you can ping 8.8.8.8 (Google's DNS server)
ping 8.8.8.8
7. Check you can resolve host names (ping google.com)
Simple Unix command
ls //list files
pwd
which pwd //where is my pwd command
lsusb //show USB devices
cp file1 file2 // copy
mv file1 file3 // rename of move
df -h // show mounted filesystems
AFP
sudo
apt-get
install
netatalk
in Finder
hit ⌘K. Enter afp://192.168.2.150Samba
sudo apt-get update
sudo apt-get install samba
sudo apt-get install samba samba-common-bin
nano /etc/samba/smb.conf //edit config file
sudo service samba restart //iedere keer als je iets veranderd
[global]
workgroup = workgroup
server string = %h
wins support = no
dns proxy = no
security = share
encrypt passwords = yes
panic action = /usr/share/samba/panic-action %d
[sites]
path = /mnt/data
writeable = yes
broweable = yes
read only = no
guest ok = yes
force user = root
sudo smbpasswd -a john //add samba user
sudo mkdir /mnt/data
sudo chmod 777 /mnt/data
Change host name
sudo nano /etc/hostname
sudo nano /etc/hosts
sudo reboot //reboot
sudo halt //stop
sudo adduser john // make new user
sudo adduser john sudo // make user sudo
sudo nano /etc/sudoers
sudo fdisk -l // show attached drives
Add hard disk
sudo apt-get install ntfs-3g //install Read NTFS
sudo apt-get install hfsplus
sudo blkid // show all
nano /etc/fstab // mount at start up
/dev/sd /mnt/data ntfs defaults 0 0
sudo mount -a
Video Web cam
sudo apt-get install motion
sudo nano /etc/motion/motion.conf
daemon ON
webcam_localhost OFF
sudo service motion startsudo nano /etc/default/motion
http://192.168.2.111:8081
sudo apt-get install python-opencv
VNC remote desktop
apt-get install tightvncserver
tightvncserver
vncpasswd
vncserver :1 -geometry 800x600 -depth 24
if server is started on 1 this means port 5901
in finder (connect icon) vnc://192.168.2.70:5901
Apache webserver
sudo apt-get install apache2
sudo nano /etc/apache2/sites-enabled/000-default
AddHandler cgi-script .py
sudo chmod 777 /usr/lib/cgi-bin/test.py
special raspberry ROM's / images:
MotionPi: use the camera for spying or for video
ssh root@192.168.2.181
use password after the dash name router
use find to find IP adres of the raspberry
Safari: 192.168.2.1
admin ; no password
use vi for editing files
set wifi password and SIID of the router in /data/etc/wpa_ ...
Sound
sudo apt-get install alsa-utils
sudo apt-get install mpg321
sudo apt-get install lame
Node-RED
https://nodered.org/docs/hardware/raspberrypi
(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
node-red-start
In safari 192.168.2.70:1880
npm install node-red-node-mongodb
mongo
sudo apt-get install mongodb-server
sudo nano /etc/mongodb.conf //edit config paths
/var/log/mongod // look into the logs
/var/log/mongod // look into the logs
mongod --dbpath /data/db --repair // repair if RPi shutdown un
mongo
show dbs // show databases
use Mydb
show collections // show collections
db.createCollection(“my collection”) // Make a collection
db.mycollection.remove() // remove collection
db.addUser( { user: "joe",
... pwd: "secret",
... roles: [ "readWrite", "dbAdmin" ]
... } )
http://192.168.2.70:28017 //Webinterface
Geen opmerkingen:
Een reactie posten