#!/bin/bash -x # Start loading IIAB. "bash -x" is debug mode # 1. RUN: "sudo su -" then "raspi-config" to set "Localisation Options" # 2. OPTIONAL: "passwd pi; touch /boot/ssh; reboot" to ssh in immediately # 3. RUN THIS SCRIPT: curl download.iiab.io/6.4/rpi/load-big-venvtest-vpn.txt | bash # 4. REBOOTS AUTOMATICALLY WHEN DONE (about an hour later) which # sets the hostname, while improving RTC settings + memory mgmt # 5. Run "teamviewer help" to get your TeamViewer ID and set a passwd # 6. Set /etc/iiab/handle if you use openvpn@xscenet set -e # to exit on error (avoids snowballing) tune2fs -m 1 /dev/mmcblk0p2 # Above changes reserve disk space from ~5% to 1% export DEBIAN_FRONTEND=noninteractive apt update apt -y dist-upgrade apt -y clean # Above updates Raspbian for security especially wget https://download.teamviewer.com/download/linux/teamviewer-host_armhf.deb set +e # do not exit when "dpkg -i" below inevitably fails dpkg -i teamviewer-host_armhf.deb set -e apt -y -f install # fix dependencies for above/failed "dpkg -i" rm teamviewer-host_armhf.deb apt -y install git emacs lynx bc # Above for Raspbian Lite; USE "apt remove" OR "apt purge" ON UNNEEDED SW LATER mkdir -p /opt/iiab cd /opt/iiab/ git clone https://github.com/jvonau/iiab -b python_stack # git clone https://github.com/iiab/iiab --depth 1 git clone https://github.com/iiab/iiab-admin-console --depth 1 git clone https://github.com/iiab/iiab-menu --depth 1 git clone https://github.com/iiab/iiab-factory --depth 1 # cd /opt/iiab/iiab/scripts/ # ./ansible # Above compiles & installs Ansible 2.2.0 apt -y install ansible python-kerberos python-selinux python-winrm python-xmltodict sshpass bzip2 file findutils gzip tar unzip zip python-keyczar python-boto python-dnspython python-pyrax python-sphere # Above installs a more future-proof Ansible 2.2.1+ sed -i 's/StrictVersion/LooseVersion/g' /usr/lib/python2.7/dist-packages/ansible/modules/core/web_infrastructure/htpasswd.py # ABOVE APPLIES TEMPORARY PATCH https://github.com/ansible/ansible/pull/20202 # needed by munin until Ansible 2.3.2 or 2.4.0, to overcome Ansible bug: # TASK [munin : Create admin user] ******************************** # fatal: [127.0.0.1]: FAILED! => {"changed": false, "failed": true, # "msg": "invalid version number '1.7.0.post20170423015547'"} cd /opt/iiab/iiab/vars/ if [ -f local_vars.yml ]; then echo "ERROR: Plz move /opt/iiab/iiab/vars/local_vars.yml to proceed." >&2 exit 1 elif [ -f local_vars_big_vpn.yml ]; then echo "ERROR: Plz move /opt/iiab/iiab/vars/local_vars_big_vpn.yml to proceed." >&2 exit 1 fi wget http://download.iiab.io/6.4/rpi/local_vars_big_vpn.yml mv local_vars_big_vpn.yml local_vars.yml # Above assumes a virgin RPi system (wget WON'T overwrite existing files) # In general please examine local_vars.yml carefully (and modify as nec) # before running Ansible (below, which can take ~2 hours the first time!) # NOTE: you can change many/most settings after install too, using the # Admin Console (http://box/admin) as documented at: http://FAQ.IIAB.IO cd /opt/iiab/iiab/ ./runansible # Try to rerun the above line if it fails? cd /opt/iiab/iiab-admin-console/ ./install sed -i 's/local\/bin\/ansible/bin\/ansible/g' /opt/admin/cmdsrv/cmdsrv.conf # ABOVE TEMPORARY FIX FOR ADMIN CONSOLE ON ANSIBLE 2.2.1+ ON RASPBIAN STRETCH: # Changes /usr/local/bin to /usr/bin (for both Ansible paths) on lines 23 & 24: # https://github.com/iiab/iiab-admin-console/blob/master/roles/cmdsrv/templates/cmdsrv.conf.j2 # To solve this cleanly, Tim may want to create vars/Raspbian.yml alongside: # https://github.com/iiab/iiab-admin-console/blob/master/vars/Debian.yml systemctl restart iiab-cmdsrv.service cd /opt/iiab/iiab-menu/ ./cp-menus iiab-cmdsrv-ctl GET-KIWIX-CAT # Refresh Kiwix catalog iiab-make-kiwix-lib # Rebuild local library.xml export KALITE_HOME=/library/ka-lite /usr/local/kalite/venv/bin/kalite manage generate_zone # Register with KA Lite /usr/local/kalite/venv/bin/kalite manage retrievecontentpack download en # Get KA Lite English language pack (slow download!) reboot