Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save daison12006013/c192e5c017262c90513dffcdd16339c4 to your computer and use it in GitHub Desktop.
Save daison12006013/c192e5c017262c90513dffcdd16339c4 to your computer and use it in GitHub Desktop.
Using Steam Deck as your device for web development

Sharing how I setup my steam deck to run golang / php / nodejs / redis / mariadb|mysql

Index

Notes and Disclaimer

For your info, I didn't cover here how to Switch from desktop, how to use Konsole, how to use Discover (software center) of SteamOS, or to do an introduction about bashrc files.

This tutorial is meant to minimize the time searching how to make them work.

(!) Make sure you know what you're copying, make sure that this path /run/media/mmcblk0p1/.distrobox isn't the same path as what you have in your Steam Deck, or your prefer path to save your distrobox.


How to install DistroBox and PodMan

As of this writing, the tutorial is based from the main git repository https://github.com/89luca89/distrobox

# distrobox
(deck@steamdeck ~)$ curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh -s -- --prefix /run/media/mmcblk0p1/.distrobox

# podman
(deck@steamdeck ~)$ curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/extras/install-podman | sh -s -- --prefix /run/media/mmcblk0p1/.distrobox

After running up above, you then need to include this inside your ~/.bashrc

export PATH=/run/media/mmcblk0p1/.distrobox/bin:$PATH
export PATH=/run/media/mmcblk0p1/.distrobox/podman/bin:$PATH
xhost +si:localuser:$USER

then in your Konsole, type-in source ~/.bashrc OR re-open your Konsole

Alpine as your linux distro

Below, we're building our own container and we named it as "coding", and at the same time the image we're going to use is the stable alpine release.

(deck@steamdeck ~)$ distrobox create --image alpine:latest --name coding

Installing golang / php / nodejs / redis

After creating your alpine container, you can now access it by calling the distrobox enter or distrobox-enter

(deck@steamdeck ~)$ distrobox-enter coding

In ubuntu we're used to apt-get and for mac we're using brew, but for Alpine we'll use apk, don't get wrong about the name, this is not android!

coding:~$ sudo apk add php go nodejs redis

How to install MariaDB

After installing podman, you have the way now to build your own container, if you're familiar with docker, it should be similar.

(deck@steamdeck ~)$ podman create -p 127.0.0.1:3306:3306 --name mariadb -v /run/media/mmcblk0p1/.distrobox/mysqldb:/mnt/distrobox-mysqldb:z -e MARIADB_ROOT_PASSWORD=root docker.io/library/mariadb:10.7

And here's how you're going to start the mariadb and connect to it via ssh

(deck@steamdeck ~)$ podman start mariadb
(deck@steamdeck ~)$ podman exec -it mariadb mariadb -uroot -proot

To stop the service

(deck@steamdeck ~)$ podman stop mariadb

My ~/.bashrc file

Here's my ~/.bashrc file, this contains how I boot up my distrobox and how it automatically stops them.

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

export PATH=/run/media/mmcblk0p1/.distrobox/bin:$PATH
export PATH=/run/media/mmcblk0p1/.distrobox/podman/bin:$PATH
xhost +si:localuser:$USER

# this goes inside the alpine coding environment
# that contains php/go/nodejs
function coding () {
    MARIADB_INIT="start"
    DISTRO_INIT="enter"

    podman ${1:-$MARIADB_INIT} mariadb
    distrobox ${1:-$DISTRO_INIT} coding
}

# this is to act like the visual studio code binary
function code () {
    flatpak run com.visualstudio.code $@
}

# this connects to your mariadb, thru ssh
function connect_sql () {
    podman exec -it mariadb mariadb -uroot -proot
}

To boot up my distrobox and mariadb, just type this

(deck@steamdeck ~)$ coding

To stop it, just type this

(deck@steamdeck ~)$ coding stop

To connect to my mariadb via ssh, just do this

(deck@steamdeck ~)$ connect_sql

To open my visual studio code, just do this

(deck@steamdeck ~)$ code ~/Projects/path/to/my/nodejs/folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment