-
Notifications
You must be signed in to change notification settings - Fork 0
Raspberry Pi 3
These are the steps to follow in order to get the full BlackoutPedia installation running on the Raspberry Pi 3
- Basic arch linux installation
- Copy pre-populated index directory#
- Configure access point
- BlackoutPedia installation
- You have a Linux based PC that has a SD card reader
- The PC is connected to your home network
- The Raspberry Pi can be connected to the same home network by its wired
eth0
interface - You have a power supply for the Pi
- You have a Micro SD card ready with a minimum size of
64GB
- You can become
root
user on the PC - Your PC has internet access
- You understand the above
At the time of writing I decided to use 32-bit arch linux, since it perfectly installs headless (we need no screen or keyboard connected to the Raspberry and can work with the Raspberry through ssh), it is lean and supports all aspect of the Pi's hardware that we need.
First thing is to attach the SD card to the PC and created a partition setup. The following table explains the partitions we want to setup
Partition | Type | Size | Purpose |
---|---|---|---|
1 | W95 FAT32 (LBA) | 100 MB | Boot partition |
2 | Linux | 10 GB | Root parition for arch linux |
3 | Linux | Rest | Data partition, where we hold the index directory |
The reason for having the third data partition is so that we can replace the arch linux installation itself independent of the data that is used by BlackoutPedia
As user root
run
fdisk /dev/mmcblk0
Now create a fresh DOS partition table, by typing o
Create the first partition and set the correct type
np 1 Enter +100M
t c
Now create the remaining two paritions
np 2 Enter +10G
np 3 Enter Enter
Finally save the partitioning to the SD card by typing w
Then create the file systems on the partitions and mount the first two partitions
mkfs.vfat /dev/mmcblk0p1
mkfs.ext4 /dev/mmcblk0p2
mkfs.ext4 /dev/mmcblk0p3
mkdir boot
mkdir root
mount /dev/mmcblk0p1 boot
mount /dev/mmcblk0p2 root
Download the arch linux distribution. Make sure you use the 32-bit one, since at the time of writing, the wifi driver for the Raspberry Pi was not available for the 64-bit version. Once downloaded extract arch linux
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root
Finally move the boot content to the boot partition and unmount everything
mv root/boot/* boot
umount boot root
Because the creation of an index for BlackoutPedia is a CPU intensive process, it is highly recommended to create such an index directory on your PC and copy over the result to the SD card directly.
This will safe a lot of time, as user root
run
mkdir data
mount /dev/mmcblk0p3 data
cp -r 201708_dewiki data
umount data
Now take out the SD card plug it into your Pi and boot it. Make sure the Pi is connected to by wire. After a couple of seconds you can log into the Pi and run a system update. The alarm
users default password is alarm
and the root
users default password is root
. Check your home network to find out the actual IP address of the Pi (I am using 1.2.3.4 in the example below)
ssh alarm@1.2.3.4
su - root
pacman -Syu
Once updated you can continue with installing a package that will ease the creation of the accesspoint
pacman -S create_ap
After the installation, we create a copy of the config file that the preconfigured service is using and we will launch create_ap
manually to storing our new configuration (no internet sharing, no password). Finally we start the access point and enable the service on boot
mv /etc/create_ap.conf /etc/create_ap.conf.orig
create_ap -n wlan0 BlackoutPedia --mkconfig /etc/create_ap.conf
systemctl start create_ap
systemctl enable create_ap
This requires first of all a Java 8 installation, as root
run
pacman -S jre8-openjdk-headless
Then we have to make sure the data partition is properly mounted
mkdir /data
mount /dev/mmcblk0p3 /data
And ensure it is mounted automatically after restart, by adding the following line to /etc/fstab
/dev/mmcblk0p3 /data ext4 defaults 0 0
Now create a folder for BlackoutPedia and change the owner for the data partition
mkdir /opt/blackoutpedia
chown alarm.alarm /opt/blackoutpedia
chown -R alarm.alarm /data
And copy the JAR archive from your PC
scp blackoutpedia.jar alarm@1.2.3.4:/opt/blackoutpedia
From the SSH terminal with the Raspberry connection you can start BlackoutPedia for testing
java -jar /opt/blackoutpedia/blackoutpedia.jar --index /data/201708_dewiki --bind 0.0.0.0
Past that point you should be able to reach it through a Smartphone that you connect with the BlackoutPedia
wifi by browsing to http://192.168.12.1:8080
Stop BlackoutPedia by hiting Ctrl+C
We now want to enable Blackoutpedia as a service that it automatically starts at boot time, so as user root
create a file /etc/systemd/system/blackoutpedia.service
with the following content
[Unit]
Description=BlackoutPedia service
[Install]
WantedBy=multi-user.target
[Service]
User=alarm
ExecStart=/usr/bin/java -jar /opt/blackoutpedia/blackoutpedia.jar --index /data/201708de_wiki --bind 0.0.0.0
After the file is created you can enable the service for auto booting and start it by running
systemctl enable blackoutpedia
systemctl start blackoutpedia