Preparing a Raspberry PI (Arch Linux)

From Domoticz
Jump to: navigation, search

To prepare a Raspberry PI (Arch Linux) from scratch to run Domoticz

The Arch Linux distro is for advanced users (not recommended for beginners)

Download the Arch image http://www.raspberrypi.org/downloads

Follow instructions to prepare an SD-card http://elinux.org/RPi_Easy_SD_Card_Setup


Get your Rpi up-and running with this SD card.

Login with username/password (root/root)


Change password: passwd root


Setting the Timezone:

The default timezone is "Europe/London". If you live somewhere else, you can find the possible settings in the /usr/share/timezone/ directory. Find the sub-directory that describes where you live best, then find the file that corresponds to the location closest to you within your timezone.

ls /usr/share/zoneinfo

ls /usr/share/zoneinfo/America


With the above commands, I locate my timezone as "Europe/Amsterdam".


Now issue the following command:

timedatectl set-timezone Europe/Amsterdam


Change the name of your Pi:

vi /etc/hostname


Change "alarmpi" to the name chosen for your Pi.


Expand rootfs (to use full SD card capacity)

fdisk /dev/mmcblk0


Delete the second partition /dev/mmcblk0p2 d

2


Create a new primary partition and use default sizes prompted. This will then create a partition that fills the disk

n

p

2

enter

enter


Save and exit fdisk:

w

Now reboot

reboot


Once rebooted

resize2fs /dev/mmcblk0p2


Your main / partition should be the full size of the disk now.

Update the System

pacman -Syu

Add user 'pi' as sudo user:

pacman -S sudo

useradd -m pi

passwd pi (enter a password for this user)

gpasswd -a pi wheel

gpasswd -a pi uucp

visudo


Find the line starting with # %wheel ALL=(ALL) ALL , and remove the #

%wheel ALL=(ALL) ALL

exit visudo with typing :w

Exit (close the SSH session) exit


Login again with SSH and from now on use the pi user

Setting the system Locale:

sudo vi /etc/locale.gen


uncomment en_US.UTF-8 UTF-8 and en_US ISO-8859-1

now run

sudo locale-gen

Updating firmware

sudo pacman -S git
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
sudo rpi-update

And reboot again.

sudo reboot

Installing from Source

NOTE: You can also install domoticz from Aur: https://aur.archlinux.org/packages/domoticz-git/

See Install.txt file

Now backup the SD-card: --- sudo halt


Put the card in a Mac or Linux workstation. Find the raw disk device, be very careful not to overwrite your system disk:

sudo diskutil umount /dev/disk1s1

sudo dd bs=1m if=/dev/rdisk1 of=clean-rpi.img


If you use Windows, the free HDD Raw Copy Tool (<http://hddguru.com/software/HDD-Raw-Copy-Tool/>) can be used to create a compressed backup.

Options:

Fixed ip-adress:

sudo pacman –S netcfg

sudo cp /etc/network.d/examples/ethernet-static /etc/network.d/ethernet-static


Edit to you preference

sudo vi /etc/network.d/ethernet-static


Edit /etc/conf.d/netcfg

sudo vi /etc/conf.d/netcfg


Where it says NETWORKS= (ethernet-eth0) change to NETWORKS=(ethernet-static)

sudo systemctl disable [email protected]
sudo systemctl enable netcfg.service
sudo reboot


Python and the Requests package:

sudo pacman -S python python-pip
sudo pip install requests


now follow the GIT checkout/build procedure described in the INSTALL.txt

Run Domoticz as a service:

Option... Install the nano editor for easy file editing:

sudo pacman -S nano


Create a service control file:

sudo nano /etc/systemd/system/domoticz.service


Copy-paste the following content:

[Unit]
Description=domoticz_service
[Service]
ExecStart=/home/pi/domoticz/domoticz
StandardOutput=null
[Install]
WantedBy=multi-user.target

Enable the service:


sudo systemctl enable domoticz.service


Start the service:


sudo systemctl start domoticz.service


Check that the service started:


sudo systemctl status domoticz.service