I had a BeagleBone Green Wireless left over from a class I took at UCLA and had this really sick idea to serve my own website from the thing and also maybe have it be solar-powered. I ultimately gave up because I don't have a solar panel capable of powering my BeagleBone and also self-hosting a website seems hard. Anyway, this document is to remind me how I setup the BeagleBone in case I ever want to go through that again.
-
Download this image for the Beaglebone Green Wireless (BBGW). Other images can be found on the BeagleBoard website.
-
Use Balena Etcher to flash the image onto your microSD card.
-
Plug the microSD into the BBGW, then plug the BBGW into your computer with a USB-to-microUSB cable. Before plugging into the computer, hold down the "User" button. Wait until the BBGW shows up on your computer.
-
Open up the BBGW in your file explorer and check out the
START.htm
file. It'd behoove you to read this. -
Log into the BBGW with
ssh [email protected]
. A warning will be issued. Enter the command it tells you to enter and then try again. The login password is shown at the password prompt (should betemppwd
). The password forsu
isroot
. Same for logging in with the root user. -
Check if your BBGW has internet connectivity with
ping 8.8.8.8
. It probably will say "network unreachable". -
Run
sudo wpa_cli
. Typescan
thenscan_results
to see all WiFi networks in range. Note the SSID of the network you want to connect to. -
Select interface
wlan0
by typinginterface wlan0
, then typeadd_network
. -
Type
set_network 0 ssid "SSID"
thenset_network 0 psk "PASSPHRASE"
. Then typeenable_network 0
followed byquit
. At any point before quitting, you can typelist_networks
orstatus
to get (different kinds of) status information. -
You can check the status of your connection with
iwconfig
orifconfig
. The latter will show your ip address (as willip addr show wlan0
). As before, you can check your connectivity by pinging8.8.8.8
. If it does not work, trydhclient -r
thendhclient wlan0
. Usesudo
whenever an operation says "not permitted" or "not enough permission" or something like those.
To enable auto reconnect to WiFi on device boot, do the following.
Note: I'd recommend using static IP so that you can just connect the BBGW to any power source within range of the WiFi access point and then SSH into it via static IP (i.e., the BBGW does not need to be connected via USB to a computer for you to work with it). If you want a static IP address, check your router to find what addresses are NOT in its DHCP range and pick one of those. You should check if your router needs any additional config to support static IP (mine did not). Your router info can typically be found at
192.168.1.1
, but in my case it was192.168.254.254
. So, just Google it to find out the address for your router. You'll need to see your router config to fill out most of the details for auto reconnect anyway. See part 6 of this Ask Ubuntu answer and also this SuperUser post for details.
- Configure
/etc/network/interaces
to look like this:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static
address 192.168.254.8
netmask 255.255.255.0
gateway 192.168.254.254
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
# The primary network interface
#auto eth0
#iface eth0 inet dhcp
# Example to keep MAC address between reboots
#hwaddress ether DE:AD:BE:EF:CA:FE
##connman: ethX static config
#connmanctl services
#Using the appropriate ethernet service, tell connman to setup a static IP address for that service:
#sudo connmanctl config <service> --ipv4 manual <ip_addr> <netmask> <gateway> --nameservers <dns_server>
##connman: WiFi
#
#connmanctl
#connmanctl> tether wifi off
#connmanctl> enable wifi
#connmanctl> scan wifi
#connmanctl> services
#connmanctl> agent on
#connmanctl> connect wifi_*_managed_psk
#connmanctl> quit
# /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="SSID"
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
psk="PASSPHRASE"
}
- Add Google's nameservers by modifying
/etc/resolv.conf
to look like this:
nameserver 8.8.8.8
nameserver 8.8.4.4
You can now test by pinging google.com
. Click here to read details about Google's public DNS. Also maybe look into 1.1.1.1.
-
Reboot the device with
shutdown -r now
. You will have to do this withsudo
or as root. -
The BBGW should still be plugged into your computer via the USB cable. Wait until you see it pop up again on your computer. Then you can try SSH'ing into
[email protected]
again. Check if it has internet access. It might take a minute or two for the BBGW to establish a connection. -
I recommend updating the package list and upgrading your packages with apt update followed by apt upgrade (both run with root permissions, of course). You will need to do this to install packages anyway. For example, if you want to synchronize the time, see this Linux Hint article. I recommend using chrony.
If you want to update the boot up scripts and Linux kernel, See the "Update the boot-up scripts and Linux kernel" section of this page on the BeagleBoard site. Ignore everything else on that page.
You can change the password of the users with the passwd
command.
Note, if you want to plug in a peripheral device to the USB ports of the BBGW, they have to be plugged in before booting the BBGW. For example, I tried plugging an external HDD into the USB port (because I also wanted to try self-hosting cloud storage on the BBGW) after booting and the BBGW wouldn't recognize it. So just plug it in before booting.
Various links I looked at while working on this.
- https://askubuntu.com/a/833894
- https://linux.die.net/man/8/wpa_cli
- https://www.cyberciti.biz/faq/how-to-set-up-ssh-keys-on-linux-unix/
- https://github.com/vrk7bp/BeagleBoneWebServer
- https://askubuntu.com/questions/16584/how-to-connect-and-disconnect-to-a-network-manually-in-terminal
- https://unix.stackexchange.com/questions/182847/how-to-automatically-apply-wpa-supplicant-configuration
- https://gist.github.com/penguinpowernz/1d36a38af4fac4553562410e0bd8d6cf
- https://www.liquidweb.com/kb/how-to-install-and-configure-nmcli/
- https://www.tecmint.com/configure-network-connections-using-nmcli-tool-in-linux/
- https://www.makeuseof.com/connect-to-wifi-with-nmcli/
- https://unix.stackexchange.com/questions/158328/network-manager-not-listing-wifi
- https://askubuntu.com/questions/947965/how-to-trigger-network-manager-autoconnect
- https://embeddedinventor.com/a-beginners-introduction-to-linux-package-managers-apt-yum-dpkg-rpm/
- https://www.linuxquestions.org/questions/linux-wireless-networking-41/wpa-4-way-handshake-failed-843394/
- https://www.linuxbabe.com/debian/connect-to-wi-fi-from-terminal-on-debian-wpa-supplicant
- https://unix.stackexchange.com/questions/415816/i-am-trying-to-connect-to-wifi-using-wpa-cli-set-network-command-but-it-always-r
- https://beagleboard.org/p/mirkix/flying-beaglebone-green-448b60
- https://www.cyberciti.biz/faq/add-configure-set-up-static-ip-address-on-debianlinux/
- https://linuxhint.com/run-script-debian-11-boot-up/
- https://wiki.t-firefly.com/en/ROC-RK3308-CC/network_config.html
- https://beagleboard.org/upgrade
- https://ssg-drd-iot.github.io/getting-started-guides/docs/connectivity/ethernet_over_usb/linux/details-forward_usb0.html
- https://ofitselfso.com/BeagleNotes/HowToConnectPocketBeagleToTheInternetViaUSB.php
- https://superuser.com/questions/1453120/connect-to-wifi-on-boot-beagle-bone-black-ioctlsiocsiwencodeext-invalid-argum
- https://askubuntu.com/questions/942074/ubuntu-server-16-04-2-wifi-connection/942424#942424
- https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/
See these links about updating the security source.
- https://www.debian.org/security/
- https://stackoverflow.com/questions/70789307/how-to-fix-the-following-signatures-couldnt-be-verified-because-the-public-key
Nginx stuff (for serving a website from the BBGW).
- https://jgefroh.medium.com/a-guide-to-using-nginx-for-static-websites-d96a9d034940
- http://nginx.org/en/docs/beginners_guide.html
Links for plugging an HDD into the BBGW:
- https://www.simplified.guide/linux/disk-mount
- https://linuxopsys.com/topics/linux-fstab-options
- https://unix.stackexchange.com/questions/53456/what-is-the-difference-between-nobootwait-and-nofail-in-fstab
- https://geek-university.com/etc-fstab-file/
- https://askubuntu.com/questions/46588/how-to-automount-ntfs-partitions
When I gave up on self-hosting my website, I tried to salvage this project by using compute time for BOINC. Turns out it doesn't work ๐