Sharing how I setup my steam deck to run golang / php / nodejs / redis / mariadb|mysql
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.
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
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
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
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
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