COSMOS Running on Raspberry Pi 4
The Raspberry Pi 4 is a low-cost powerful ARM-based minicomputer that runs linux. And because it runs modern linux, it can also run COSMOS! These directions will get you up and running.
What you’ll need:
- Raspberry Pi 4 board (tested with 8GB RAM)
- A Pi Case but Optional
- Raspbeerry Pi Power Supply
- 32GB or Larger SD Card - Also faster the better
- A Laptop with a way to write SD Cards
Let’s get started!
Setup 64-bit Raspian OS Lite on the SD Card
Make sure you have the Raspberry Pi Imager app from: https://www.raspberrypi.com/software/
- Insert the SD Card into your computer (Note this process will erase all data on the SD card!)
- Open the Raspberry Pi Imager App
- Click the “Choose OS” Button
- Select “Raspberry Pi OS (other)”
- Select “Raspberry Pi OS Lite (64-bit)”
- Click the “Choose Storage” Button
- Select Your SD Card
- Click the Gear Icon
- If prompted if you would like to prefill the Wifi information, select OK
- Click all the checkboxes, except for “Enable Telemetry”
- Set the hostname to: cosmos.local
- You can either use Password auth, or public-key only if your computer is already setup for passwordless SSH
- Set the username and password. The default username is pi, you should also set a password to make the system secure
- Fill in your Wifi info, and set the country appropriately (ie. US)
- Set the correct time zone
- Click “Save” when everything is filled out
- Click the “Write” button, Yes to Are You Sure, and Wait for it to complete
Make sure the Raspberry Pi is NOT powered on
Remove the SD Card from your computer and insert into the Raspberry Pi
Apply power to the Raspberry Pi and wait approximately 1 minute for it to boot
SSH to your raspberry Pi
Open a terminal window and use ssh to connect to your Pi
- On Mac / Linux: ssh firstname.lastname@example.org
- On Windows, use Putty to connect. You will probably have to install Bonjour for Windows for .local addresses to work as well.
From SSH, Enter the following commands
sudo sysctl -w vm.max_map_count=262144 sudo sysctl -w vm.overcommit_memory=1 sudo apt update sudo apt upgrade sudo apt install git -y curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.sh sudo usermod -aG docker $USER newgrp docker sudo apt-get install libffi-dev libssl-dev python3-dev python3 python3-pip -y sudo pip3 install docker-compose git clone https://github.com/OpenC3/cosmos.git cd cosmos ./openc3.sh start
Note: It takes awhile to build COSMOS on a Pi (about an hour). Be patient, and in the future we’ll have precompiled containers that will make first launch way faster.
After about 2 minutes, open a web browswer on your computer, and goto: http://cosmos.local:2900
Congratulations! You now have COSMOS running on a Raspberry Pi!