Raspberry Pi

http://robin.me/pi
version number: sudo apt-get install lsb_release lsb_release -a architecture: dpkg --print-architecture sudo raspi-config sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get --yes --force-yes install screen sudo apt-get --yes --force-yes install npm sudo npm install -g node-red-admin sudo apt-get --yes --force-yes install festival sudo apt-get --yes --force-yes install apache2 sudo apt-get --yes --force-yes install libasound2-dev sudo apt-get --yes --force-yes install fail2ban sudo apt-get --yes --force-yes install lynx sudo apt-get --yes --force-yes install sshpass sudo apt-get --yes --force-yes install ddclient sudo apt-get --yes --force-yes install screen && sudo apt-get --yes --force-yes install npm && sudo npm install -g node-red-admin && sudo apt-get --yes --force-yes install festival && sudo apt-get --yes --force-yes install apache2 && sudo apt-get --yes --force-yes install libasound2-dev && sudo apt-get --yes --force-yes install fail2ban && sudo apt-get --yes --force-yes install lynx && sudo apt-get --yes --force-yes install sshpass && sudo apt-get --yes --force-yes install ddclient sudo /etc/init.d/apache2 restart fail2ban: sudo vi /etc/fail2ban/jail.local [ssh] enabled = true port = ssh filter = sshd logpath = /var/log/auth.log bantime = 900 banaction = iptables-allports findtime = 900 maxretry = 3 sudo service fail2ban restart ~/.screenrc startup_message off shell -/bin/bash put in /boot/ : touch ssh wpa_supplicant.conf file is: ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=GB network={ ssid="Rowling" psk="password" key_mgmt=WPA-PSK } export EDITOR=vi export PATH=/home/pi:$PATH sudo apt-get install raspberrypi-ui-mods sudo apt-get install raspberrypi-net-mods run scripts on startup http://goo.gl/1uxBui Extra io http://goo.gl/qD0E9R check for hotspots: sudo iwlist wlan0 scan sudo vi /etc/wpa_supplicant/wpa_supplicant.conf sudo ifdown wlan0 and sudo ifup wlan0 Bring up and down the lan and renew dhcp: sudo ifup wlan0 dhclient -v {interface_name} (renew dhcp) brng network up and down sudo ifdown eth0 && sudo ifup eth0 wifi setup: wpa_gui sudo apt-get install samba samba-common-bin sudo vi /etc/samba/smb.conf workgroup = WORKGROUP sudo service samba restart [pihome] comment= Pi Home path=/home/pi browseable=Yes writeable=Yes only guest=no create mask=0777 directory mask=0777 public=no smbpasswd -a pi sudo reboot apt-cache search ftp gpio -v gpio readall install apache sudo apt-get install apache2 php5 libapache2-mod-php5 -y cd /var/www/html reinstall apache2: sudo apt-get purge apache2 sudo apt autoremover apache2 sudo apt-get install apache2 sudo /etc/init.d/apache2 restart send a file via rsync rsync -av -e 'ssh -p21098' ./localfile robin@lefever.website:~/ change the hostname: sudo vi /etc/hostname sudo vi /etc/hosts w3m wget -r -npH lefever.website/utils/ SSH ssh -l robin lefever.website -p 21098 sudo apt-get install weavedconnectd sudo weavedinstaller sudo apt-get install mlocate sudo updatedb locate / set teh time sudo ntpd -q -g sudo apt-get install wavemon ( wifi monitoring ) process manager sudo apt-get install htop ssh_keygen ssh-keygen -R server.example.com copy ssh credentials ssh-keygen -t rsa -b 2048 ssh-copy-id -i ~/.ssh/id_rsa.pub pi@4kendrick.com mv .ssh/authorized_keys /etc/dropbear/authorized_keys How to force ssh client to use only password auth ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no example.com get ip on pi: ifconfig\ ssh to pi: ssh -l pi 192.168.60.102 run vnc from pi: sudo apt-get install tightvncserver tightvncserver vnc from mac terminal open vnc://192.168.60.102:5901 to set a root password: sudo su passwd sudo chown user:user ~/.Xauthority to send a file from mac to pi over ssh rsync -v -e ssh ./bashaliases.txt pi@192.168.60.102:~/ Shutdown x: Sorry the ctrl-alt-F1, ctrl-C Firmware update: sudo rpi-update .bash_aliases alias ,='/bin/ls -AC --color=tty -F -b' alias ,,='/bin/ls -lA --color=tty -F -b' alias ,,,='/bin/ls -AC1 --color=tty -F -b' alias ,l='/bin/ls -AC --color=tty -F -b |less -E' alias ,,l='/bin/ls -Al --color=tty -F -b |less -E' alias ,,,l='/bin/ls -AC1 --color=tty -F -b |less -E' alias ..='cd ..' alias e='exit' alias c='clear' alias x='startx' alias s='screen -R' alias hg='history |grep' ============================================== sudo vi /etc/dhcpcd.conf # Example static IP configuration: interface wlan0 static ip_address=192.168.0.200/24 static routers=192.168.0.1 static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1 interface eth0 static ip_address=192.168.1.23/24 Certification ========= for Stretch: add source to debian sources list: sudo vi /etc/apt/sources.list.d/raspi.list deb http://ftp.debian.org/debian stretch-backports main sudo apt-get update then sudo apt-get install python-certbot-apache -t stretch-backports then install certs for apache: sudo certbot --apache Certificates stored: /etc/letsencrypt/live/$domain /etc/letsencrypt/live/12kendrick.com/privkey.pem /etc/letsencrypt/live/12kendrick.com/cert.pem ======================== Internet Speed testing: sudo pip install speedtest-cli speedtest-cli ======================== audio works: sudo apt-get install festival install node-red-contrib-say install node-red-contrib-play-audio ======================== ======================== alarm in bed block one Please speak more loudly, except when I ask you to speak in a quiet voice. ======================== sudo npm install node-red-contrib-speakerpi sudo apt-get install libasound2-dev amixer cset numid=3 1 amixer cset numid=3 2 alsamixer ======================== @reboot /home/pi/dd.sh 0 0 * * * /home/pi/dd.sh 0 1 * * * sudo apt-get update 0 2 * * * sudo apt-get upgrade dd.sh exec 1> >(logger -s -t $(basename $0)) 2>&1 sudo ddclient -force ======================== sudo adduser bob sudo update-alternatives --set editor /usr/bin/vim.tiny To add a new user to sudoers, type sudo visudo (from a sudoer user) and find the line root ALL=(ALL:ALL) ALL, under the commented header # User privilege specification sudo visudo # User privilege specification root ALL=(ALL:ALL) ALL bob ALL = NOPASSWD: ALL sudo userdel -r bob ======================== # m h dom mon dow command # * * * * * command to execute # ┬ ┬ ┬ ┬ ┬ # │ │ │ │ │ # │ │ │ │ │ # │ │ │ │ └───── day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0) # │ │ │ └────────── month (1 - 12) # │ │ └─────────────── day of month (1 - 31) # │ └──────────────────── hour (0 - 23) # └───────────────────────── min (0 - 59) ======================== sudo service cron restart */1 * * * * /root/job.sh ========================