MoodleBox一開始就是設定在Raspberry Pi 3上執行運作,讓使用者可以隨身帶著一個Raspberry Pi 3及行動電源就可以使用Moodle教學平台,MoodleBox官網有做動的img檔可供使用者下載,然後燒錄到Raspberry Pi 3,或者可以透過手動建置的方式,在剛開始官方所提供的是一步一步的指令去修改設定,接著又轉換成使用script自動安裝(github中切換到Branch:https),現在則改用Ansbile自動化組態管理把Moodle安裝到Raspberry Pi 3中。
在官方的Github中有以下10點的安裝步驟
To build a MoodleBox from scratch with this script, you need a Raspberri Pi 3 (Wi-Fi!) and follow these instructions.
Clone Rasbpian Stretch Lite on your microSD card.
Create asshfile on thebootpartition, e.g. usingtouch ssh
Insert the microSD card into your Raspberry
Connect your Raspberry to your Ethernet network and boot it.
Create akeysdirectory in the repository folder and copy your public key into it, under the nameid_rsa.pub.
Get the IP address of your RaspberryPi and change it in thehosts.ymlfile. Do not change anything else, unless you know what you're doing. You're on your own.
Runansible-playbook moodlebox.ymlfrom the repository folder.
Wait 30–50 minutes, depending on your SD card and Internet bandwidth. You're done.
因為目前是要使用MoodleBox安裝在BananaPi M64上,而官方是預設安裝於Raspberry Pi 3上所部分安裝內容會不同,以下我們依順說明
1. Clone Rasbpian Stretch Lite on your microSD card.
IMG檔燒錄完成後,接著就是把microSD卡插入設備的microSD插槽,Raspberry Pi 3和Banana Pi M64這兩台設備的使用方式有點不用,Raspberry Pi 3直接把microSD卡推到最底就可以,取出的方式是直接拔出microSD,而Banana Pi M64的插槽有自動彈回的功能,所以在microSD卡推到最底時,還要再用力按壓一下,會自動卡住,而取出的時後,也是要再按壓一下後會自動彈回,再拔出microSD卡即可。
4. Connect your Raspberry to your Ethernet network and boot it
Raspberry Pi 3及Banana Pi M64都內建RJ-45網路介面,這個步驟只要把網路線線上,及插上電源,會自動開機。
8. Get the IP address of your RaspberryPi and change it in thehosts.ymlfile. Do not change anything else, unless you know what you're doing. You're on your own.
如果要ssh到安裝好的MoodleBox時,連線的網址會不同,被修改成moodlebox開頭,另外在未連MoodleBox的wifi時,都要用[「moodlebox.local」,連wifi後的網址後面原本在Raspberry Pi 3原本是用「.home」而Banana PI M64修改成「.bpi」,連線網址及帳號密碼,請參照下方的對照表
allen-mba:~ allen$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/allen/.ssh/id_rsa):
Created directory '/Users/allen/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/allen/.ssh/id_rsa.
Your public key has been saved in /Users/allen/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:nCpzaCPq6waI3KTpm0sq+Yfoxku/ENVcL2gKX2ZLJrE allen@allen-mba.local
The key's randomart image is:
+---[RSA 2048]----+
| . . |
| = o . |
| . E @ . . |
| +.X .... |
|+.=o . S |
|++.. . . |
|+*..* o |
|B*=o.= |
|X@*+. |
+----[SHA256]-----+
allen-mba:~ allen$ ls -al ~/.ssh/
total 16
drwx------ 4 allen staff 128 3 7 15:28 .
drwxr-xr-x+ 53 allen staff 1696 3 7 15:27 ..
-rw------- 1 allen staff 1675 3 7 15:28 id_rsa
-rw-r--r-- 1 allen staff 403 3 7 15:28 id_rsa.pub
allen-mba:~ allen$ cp ~/.ssh/id_rsa.pub ~/github/moodlebox-bpi/keys/
allen-mba:~ allen$ ls ~/github/moodlebox-bpi/keys/
id_rsa.pub
allen-mba:~ allen$ ssh pi@raspberrypi.local
The authenticity of host 'raspberrypi.local (fe80::5f74:cb72:5324:c40b%en0)' can't be established.
ECDSA key fingerprint is SHA256:rvM07WHr9gcI+KOY1sr7+m3IpvakmgMRnpGt6tP2i8w.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'raspberrypi.local,fe80::5f74:cb72:5324:c40b%en0' (ECDSA) to the list of known hosts.
pi@raspberrypi.local's password:
Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Mar 7 09:23:27 2018
SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.
pi@raspberrypi:~ $ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:b6:d3:08 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.3/24 brd 192.168.0.255 scope global eth0
valid_lft forever preferred_lft forever
inet6 fe80::5f74:cb72:5324:c40b/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether b8:27:eb:e3:86:5d brd ff:ff:ff:ff:ff:ff
allen-mba:~ allen$ ssh pi@bpi-iot-ros-ai.local
The authenticity of host 'bpi-iot-ros-ai.local (fe80::84e0:eaff:fef2:36e2%en0)' can't be established.
ECDSA key fingerprint is SHA256:5sZdACIsvP5cxP3bob+z563JmKelc5liBZfAz89eGHM.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'bpi-iot-ros-ai.local,fe80::84e0:eaff:fef2:36e2%en0' (ECDSA) to the list of known hosts.
pi@bpi-iot-ros-ai.local's password:
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 3.10.105-BPI-M64-Kernel aarch64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
116 packages can be updated.
0 updates are security updates.
*** System restart required ***
Last login: Sat Oct 21 16:21:23 2017 from 192.168.88.162