Deploy Linux
Linux server: SSH, web terminal, apps that stay up, installs that persist.
Just deployed
/data
Deploy and Host Linux on Railway
This template gives you an always-on Ubuntu 24.04 server you can actually host things on. A plain Linux container forgets everything outside its volume on every redeploy and has nothing to keep your programs running. Here apt install sticks, programs you register with svc restart after crashes and redeploys, and whatever listens on port 8080 is served at your Railway domain.
About Hosting Linux
One service, one volume at /data. You reach the box in three ways:
- The Railway domain serves your app on port 8080, or a welcome page until something listens there.
/terminal/on the same domain is a password-protected web terminal.- SSH goes through Railway's TCP proxy.
The terminal and SSH both land in the same tmux session.
What persists:
- Your home directory and
/srvlive on the volume. - Packages you
apt installare recorded on the volume, together with any apt sources and keys you added, and reinstalled on boot. - Services you add with
svcare a script plus a supervisor entry on the volume. They start again after every redeploy. - Your crontab is kept on the volume.
Common Use Cases
- A small VPS for a bot, a scraper, a webhook receiver or a side-project API
- Run a program 24/7 and have it restart after a crash
- Serve a static site or a quick prototype from
/srvwithout writing a Dockerfile - Scheduled jobs with
crontab -e - A persistent Linux workspace reachable from a browser or SSH
Dependencies for Linux Hosting
- None. Single service, no database.
Deployment Dependencies
- ttyd web terminal
- Supervisor process manager
Implementation Details
First use: open https://‹your-domain›/terminal/ and log in with WEB_USER and the generated WEB_PASSWORD, which are in the service's Variables tab.
Run an app:
mkdir -p /srv/site && echo hello > /srv/site/index.html
svc add web --dir /srv/site -- python3 -m http.server 8080
Open your Railway domain and the app is there. Other svc commands:
svc lslists your services.svc logs web -ffollows a service's output.svc edit webchanges its command.svc rm webremoves it.
To serve a different port, change APP_PORT.
Install software: apt install nodejs (or anything else) as usual. The package list is saved after every apt run and replayed on boot, before your services start. The web terminal and SSH come up first, so a long reinstall never fails the deploy. The log is /data/linux/logs/restore.log.
SSH: Railway creates a TCP proxy for port 22 on deploy. Copy the host and port from Settings → Networking and run ssh root@‹host› -p ‹port› with ROOT_PASSWORD. For key-only login, add your public key to AUTHORIZED_KEYS and clear ROOT_PASSWORD.
Notes and limits:
- Only apt packages are replayed. Software installed with
curl | sh,pip install --user,npm -gor a downloaded.debshould go in your home directory or/srv, or be reinstalled from your service's script. - Anything else outside
/rootand/srvresets on redeploy, as in any container. - There is no systemd and no Docker daemon.
svctakes systemd's place. - You are root. The web terminal password guards a root shell, so keep it strong.
- 512 MB of RAM is enough for the box itself (about 50 MB idle). Size up for what you run.
- Just want a shell? The same author publishes a Linux Terminal template.
Why Deploy Linux on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Linux on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
