Difference between revisions of "Install Raspberry Pi"
(→Prepare an SD card) |
(→Prepare an SD card) |
||
Line 20: | Line 20: | ||
RPI_DISK='/dev/sdb' | RPI_DISK='/dev/sdb' | ||
umount $RPI_DISK* | umount $RPI_DISK* | ||
− | ls -lh raspbian-lite.img | + | ls -lh raspbian-lite.img | sed -e 's/.*root/Copying/' | sed -e 's/G.*rasp/G file rasp/' |
dd if=raspbian-lite.img of=$RPI_DISK status=progress conv=fsync | dd if=raspbian-lite.img of=$RPI_DISK status=progress conv=fsync | ||
eject $RPI_DISK | eject $RPI_DISK |
Revision as of 15:49, 1 August 2017
The xPL protocol is light enough to run on simple machines such as the Raspberry Pi.
Contents
Install Raspbian
Several distributions are available for the Raspberry Pi. This wiki bases on the console version of Raspbian.
Prepare an SD card
On a Linux computer, download it:
su cd /tmp wget https://downloads.raspberrypi.org/raspbian_lite_latest -O raspbian-lite.zip sha1sum raspbian-lite.zip unzip raspbian-lite.zip.zip mv *-raspbian-*-lite.img raspbian-lite.img
Insert a card reader with the SD card you wish to use and write the image:
fdisk -l RPI_DISK='/dev/sdb' umount $RPI_DISK* ls -lh raspbian-lite.img | sed -e 's/.*root/Copying/' | sed -e 's/G.*rasp/G file rasp/' dd if=raspbian-lite.img of=$RPI_DISK status=progress conv=fsync eject $RPI_DISK
Unplug the SD card reader and plug it in again. Find the mount point:
df -h | grep $RPI_DISK RPI_DISK_MOUNTPOINT='/media/francois/boot'
Remove init=/usr/lib/raspi-config/init_resize.sh
from:
nano -w $RPI_DISK_MOUNTPOINT/cmdline.txt
With GPartEd, add a 1 GB partition for the swap and format the rest of the card as ext4 for the user data.
Eject the SD card reader:
eject $RPI_DISK
Change root password
Insert the SD card in the Raspberry Pi and boot it.
sudo su passwd apt update apt upgrade
Locales
Set the regional parameters:
raspi-config
Install locales (for PERL and others):
su locale-gen en_US.UTF-8
Then edit ~.bashrc
and add:
export LC_ALL=C
Swap space
Create a swap file:
dd if=/dev/zero of=/root/swapfile bs=1M count=1024 chmod 600 /root/swapfile mkswap /root/swapfile
Enable the swapfile:
swapon /root/swapfile swapon -s free -k
To enable at reboot, edit /etc/fstab
:
/root/swapfile swap swap defaults 0 0
Ethernet
Check the Ethernet connection:
ifconfig | grep inet ping google.com
Change host name:
raspi-config
Give a static address:
nano /etc/network/interfaces iface eth0 inet static address 192.168.1.14 gateway 192.168.1.1 netmask 255.255.255.0 dns-nameservers 192.168.1.1 /etc/init.d/networking restart
Set-up Apple FileProtocol (AFP) sharing:
apt install netatalk nano /etc/netatalk/AppleVolumes.default
Command-line editing
Enable history search and bash tab autocompletion:
nano .bashrc nano /etc/inputrc apt-get update && apt-get install bash-completion
Install manuals:
apt-get install man-db
Programming tools
Install compilation tools (make, gcc, …):
apt-get install build-essential
Install Perl documentation reader:
apt-get install perl-doc
Users
Remove default user
Removing the default user can close security gaps:
userdel -r pi
Create user
Add the control
user:
useradd -m -g users -G users,dialout,audio -s /bin/bash control passwd control
Checks
CPU usage
Check CPU usage:
ps -eo pcpu,user,args | sort -k 1 -r | head -10 echo && ps -eo pcpu,user,args | grep -v ' 0.0 ' | grep -v '%CPU' | sort -k 1 -r | sed 's/[ ^I]\/.*\/perl//' | sed 's/.pl[ ^I].*/.pl/'
Process priorities
Check process priorities:
ps ax -o nice,pid,user,args | grep -v ' NI ' | sort
The lowest numbers correspond to the highest priorities.
Change the priority level of xPL devices:
ps ax -o nice,pid,user,args | grep -v ' grep ' | grep -i xpl- USER='control' NEW_LEVEL=-10 SYSTEM_IFS=$IFS; IFS=$'\n'; task_list=(`ps ax -o pid,user,args | grep -v ' grep ' | grep -i '/xpl-'`) IFS=$SYSTEM_IFS for item in "${task_list[@]}" ; do task_id=`echo "${item}" | sed "s/$USER.*//"` # echo $task_id renice $NEW_LEVEL -p $task_id >/dev/null done ps ax -o nice,pid,user,args | grep -v ' grep ' | grep -i xpl-
Upstart daemons
Check the status of init daemons:
initctl list initctl list | grep xpl-
Links
Here some interesting pages for the installation process: