Skip to content

Instantly share code, notes, and snippets.

Last active May 2, 2023 18:38
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Step by Step Instructions to create an Open Source Astro-Imaging Computer

Instructions (works on amd64 and arm64)

A copy/paste guide to getting a full working astro-imaging computer running on Ubuntu 20.04 LTS. Installs latest stable versions of gpsd, KStars, INDI, OACapture, SkyChart, ASTAP, and

It uses the lightweight XFCE4 desktop, and allows you to VNC in, running everything locally on the astro-imaging pc.

Install Ubuntu Server 20.04.1

PC (amd64)

Raspberry Pi (arm64)

All commands below are to be run on the astro pc unless otherwise noted.

Set Hostname

Set Hostname (only needed on Raspberry Pi)

The raspberry pi ubuntu distro ships with a default hostname of ubuntu. You will probably want to change it. You will probably want to change astrobuntupi-dev to something more meaningful for you.

sudo hostnamectl set-hostname astrobuntupi-dev
sudo reboot

If you want to change the default ubuntu user name, now is the time.

Enable ssh with no password

Not required, but nice to have. Uses your public key to authenticate so you do not need to type your password when you ssh. Replace astrobuntupi-dev with the hostname you set above.

# from remote pc, not the astro-imaging pc
cat ~/.ssh/ | ssh ubuntu@astrobuntupi-dev 'mkdir -p .ssh && cat >> .ssh/authorized_keys'

Install screen

screen will keep your ssh session running even if you get disconnected.

sudo apt install screen
# auto start screen when you ssh
echo 'if $(screen -ls | grep -q pts); then  screen -x; else screen -R; fi' >> ~/.bash_profile

Configure WiFi

Set Your Timezone

sudo dpkg-reconfigure tzdata

Disable Automatic Upgrades

Ubuntu by default will automatically run apt upgrade periodically for new stable updates. To keep a good working configuration and prevent updates in the middle of imaging, run:

sudo dpkg-reconfigure unattended-upgrades

Install xfce4 and tightvncserver

sudo apt install xubuntu-core^
sudo apt install tightvncserver

Setup tightvncserver

vncserver -kill :1
mv ~/.vnc/xstartup ~/.vnc/xstartup.bak
cat << EOF > ~/.vnc/xstartup

xhost +
xrdb $HOME/.Xresources
startxfce4 &

chmod +x ~/.vnc/xstartup
vncserver -kill :1

Auto-start tightvncserver on boot

You can change geometry below to whatever resolution you'd like your VNC server to use, but depth must be 24 or greater for SkyChart to run.

cat << EOF | sudo tee /etc/systemd/system/vncserver@.service
Description=Start TightVNC server at startup


ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1920x1080 :%i
ExecStop=/usr/bin/vncserver -kill :%i


sudo systemctl daemon-reload
sudo systemctl enable vncserver@1.service
sudo systemctl start vncserver@1
sudo systemctl status vncserver@1
# press q to quit the status viewer

Disable Screensaver

You must disable the screen saver and screen blanking or the vnc server will freeze after a few minutes.

  1. Go to Applications -> Settings -> Screen Saver and disable
  2. Go to Applications -> Settings -> Power Manager -> Display and disable.

xfwm4 bug

In Ubuntu 20.04 Focal, xfwm4 4.14.1 currently has an issue with tightvncserver, so use 4.14.2 from groovy. This bug manifests as all window decorations being missing.

Add groovy to apt

Raspberry Pi

echo 'deb groovy main restricted universe multiverse' | sudo tee -a /etc/apt/sources.list


echo 'deb groovy main restricted universe multiverse' | sudo tee -a /etc/apt/sources.list

Only use groovy for xfwm4

echo 'APT::Default-Release "focal";' | sudo tee -a /etc/apt/apt.conf.d/01-vendor-ubuntu
cat << EOF | sudo tee /etc/apt/preferences.d/xfwm4
Package: xfwm4
Pin: release n=focal
Pin-Priority: -10

Package: xfwm4
Pin: release n=groovy
Pin-Priority: 900

sudo apt update
sudo apt upgrade
sudo reboot

Astro software

# INDI, KStars,, web browser, etc.

# if you want to live on the edge, you can use the nightly builds here
# sudo add-apt-repository ppa:mutlaqja/indinightly

# stable releases
sudo add-apt-repository -y ppa:mutlaqja/ppa
sudo apt install -y ekos-debugger gsc indi-full kstars-bleeding ser-player gpredict gpsd-clients breeze-icon-theme oxygen-icon-theme

# PHD2
sudo add-apt-repository -y ppa:pch/phd2
sudo apt install -y phd2 phdlogview

# Note that oacapture doesn't have an arm64 distro for 20.04 yet, so if you want it, you'll need to compile it. See to get the source and installation instructions.
sudo apt install -y libhidapi-libusb0
sudo dpkg -i oacapture_1.8.0-1_amd64.deb

# ASTAP and supporting database
wget$(dpkg --print-architecture).deb

sudo dpkg -i astap*.deb h17*.deb

# SkyChart and a stand-alone INDI client
sudo apt-key adv --keyserver --recv-keys 8B8B57C1AA716FC2
sudo sh -c "echo deb stable main > /etc/apt/sources.list.d/skychart.list"
sudo apt update
sudo apt install -y skychart indistarter

# Stellarium
sudo add-apt-repository -y ppa:stellarium/stellarium-releases
sudo apt install -y stellarium Data

Download the info you need from


sudo apt install gpsd

I keep my GPS plugged into the same USB port, and use udev to assign a symlink name so it is always consistent. I find this easier to deal with than using vendor, product and serial ids, since many of the devices I use all use cheap USB serial chips that all have the same values, so the only difference between them is what USB port they are plugged into, especially since I just leave everything plugged in all the time.

First, unplug your GPS receiver. Then plug it in to the USB port you will use. Now find the port number using dmesg.


Example Output:

[42198.265988] usb 1-2: new full-speed USB device number 10 using xhci_hcd
[42198.415307] usb 1-2: New USB device found, idVendor=1546, idProduct=01a7, bcdDevice= 1.00
[42198.415310] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[42198.415312] usb 1-2: Product: u-blox 7 - GPS/GNSS Receiver
[42198.415314] usb 1-2: Manufacturer: u-blox AG -
[42198.417465] cdc_acm 1-2:1.0: ttyACM1: USB ACM device

This shows my GPS is using a device kernels path of 1-2:1.0, so we can write a udev rule to assign it a static name:

cat << EOF | sudo tee -a /etc/udev/rules.d/99-serial.rules
ACTION=="add", SUBSYSTEM=="tty", KERNELS=="1-2:1.0", SYMLINK+="gps0"

Now we can edit our gpsd config to specify this device.

cat << EOF | sudo tee /etc/default/gpsd
# should match the symlink you defined in the udev rules

# do not wait for a client to connect to initialize the gps

sudo systemctl enable gpsd
sudo systemctl restart gpsd

You can check that your gps is working correctly using cgps.


GPS Data in Screen Status Line

sudo apt install python3-pip
pip3 install gpsd-py3

cat << EOF > ~/

import gpsd
import time

# Connect to the local gpsd
    print("gpsd not running")

pkt = gpsd.get_current()

if pkt.mode < 2:
    print("no fix")
elif pkt.mode == 2:
    print(f"{} {pkt.lon:.2f}")
    print(f"{} {pkt.lon:.2f} {pkt.alt:.1f}m")

chmod +x

# screenrc
cat << 'EOF' > ~/.screenrc
backtick 2 30 30 python3 ${HOME}/

hardstatus alwayslastline
hardstatus string '%{= kG}[%{G}%H%? %1`%?%{g}][%= %{= kw}%-w%{+b yk} %n*%t%?(%u)%? %{-}%+w %=%{g}][%{B}%Y-%m-%d %{W}%c:%s%{g}][%{B}%2`%{g}]'

defscrollback 5000

startup_message off

Now when I ssh into my astro-imaging pc, I see the following:


[astrobuntu-dev][              0*bash              ][2020-08-08  9:13:30][34.70 -80.54 155.1m]


sudo apt install foxtrotgps

Astro Live Stacker


sudo apt update && sudo apt install -y git gcc python3-dev python3-venv libraw-dev
git clone
cd als

If you are running on a raspberry pi, run this:

patch < ci/rpi4_requirements.patch
source ./venv/bin/activate
python3 develop


cd als
source ./venv/bin/activate


cd als
git pull

Remote GPSD

For my setup, I have a couple of mounts running, so I built a dedicated Raspberry Pi Zero W GPSD server. Since the indi-gpsd driver will only connect to localhost, this is a decent workaround that forwards any tcp connections for localhost:2947 to another machine.

cat << EOF | sudo tee /etc/default/remote-gpsd
# hostname that actually runs gpsd

cat << 'EOF' | sudo tee /etc/systemd/system/remote-gpsd.service
Description=Remote GPSD Service remote-gpsd.socket

ExecStart=/usr/lib/systemd/systemd-socket-proxyd ${REMOTE_HOST}:2947


cat << EOF | sudo tee /etc/systemd/system/remote-gpsd.socket
Description=Remote GPSD Socket



sudo systemctl daemon-reload
sudo systemctl enable --now remote-gpsd.socket


You should now have a fully functional, open source astro-imaging pc, running a modern 64-bit OS, with a lightweight desktop environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment