Freqtrade is an open-source crypto trading bot written in Python. It runs fine on a laptop until the lid closes, the Wi-Fi drops or the machine decides to update. Crypto markets never close, so a bot that is supposed to trade around the clock belongs on a server. That is what a Freqtrade VPS is for.
This guide covers a full crypto bot server setup, in the order we would do it ourselves: choose a server, harden
it, install Docker, install Freqtrade the official way, run it in dry-run, connect your exchange safely, then add
monitoring and backups. It assumes Ubuntu 24.04 or 26.04 LTS and basic comfort with a terminal. The same steps work on
22.04. Replace 203.0.113.10 with your server’s IP address.
1. Choose a Linux plan and location
A single Freqtrade bot trading a few dozen pairs on candle-based strategies is light. Our Bot S plan (2 vCPU, 4 GB RAM) is sized for one instance. Optimisation is a different story. Backtesting itself is largely single-threaded, but hyperopt and FreqAI training will use every core you give them, often for hours. If you plan to optimise on the server, look at Bot L (8 vCPU, 16 GB). The crypto trading bot VPS page lists every Linux plan.
Location matters less for most Freqtrade strategies than for forex scalping. A bot that acts on 5-minute or 1-hour candles won’t notice a few milliseconds. It still pays to be reasonably close to the exchange: fewer timeouts, fewer failed order calls during volatile spikes. Several large exchanges run their matching engines in cloud regions such as AWS Tokyo (ap-northeast-1), others in Europe or the US. Check your exchange’s documentation or ask its API support, then compare with our server locations. Our Tokyo location is coming soon.
If your strategy reads on-chain data and you want your own node rather than a public RPC endpoint, that is a separate, storage-heavy server. See blockchain node hosting.
2. Harden the server before anything else
This server will hold exchange API keys. Lock it down before you install anything that touches money.
SSH keys and a normal user
Create a key pair on your own computer if you don’t have one, and log in:
# On your own computer
ssh-keygen -t ed25519
ssh-copy-id [email protected] # asks for the password from your order page
ssh [email protected]
Windows 10 and 11 include the OpenSSH client but not ssh-copy-id. On Windows, log in with the
password from your order page and paste your public key into /root/.ssh/authorized_keys by hand. Then
create a normal user with sudo rights and give it your key:
# On the server, as root
adduser deploy
usermod -aG sudo deploy
rsync --archive --chown=deploy:deploy ~/.ssh /home/deploy
Open a second terminal and check that ssh [email protected] works and that
sudo asks for the new user’s password. Keep the first session open until it does.
Disable password and root login
Logged in as deploy, turn off password logins and direct root access:
sudo tee /etc/ssh/sshd_config.d/10-hardening.conf > /dev/null <<'EOF'
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
EOF
sudo sshd -t && sudo systemctl reload ssh
sudo sshd -T | grep -E 'permitrootlogin|passwordauthentication'
The last command should print permitrootlogin no and passwordauthentication no. Some
cloud images ship a file in the same folder that turns password logins back on. OpenSSH uses the first value it
reads, and files load in name order, so a name starting with 10- wins.
Firewall
Freqtrade only makes outgoing connections to the exchange. It needs no open inbound port, so allow SSH and nothing else:
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status verbose Automatic security updates
sudo apt update && sudo apt full-upgrade -y
sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades
This installs security updates daily. It does not reboot by default. Kernel updates need a reboot, so either
reboot by hand from time to time or enable automatic reboots at a quiet hour in
/etc/apt/apt.conf.d/50unattended-upgrades. The bot comes back on its own (see step 4).
3. Install Docker
Freqtrade’s recommended setup runs in Docker. Follow Docker’s official install instructions for Ubuntu on
docs.docker.com, using the apt repository method. That gives you Docker Engine and the Compose plugin, which
provides the docker compose command used below. Avoid the older docker-compose package.
Then let your user run Docker without sudo, and check it works:
sudo usermod -aG docker $USER
# log out, log back in, then:
docker run --rm hello-world
docker compose version
Membership of the docker group is effectively root access, so only add users you trust with the
whole server.
By default, Docker keeps container logs forever and they can fill the disk. Cap them before you create any
containers. If /etc/docker/daemon.json already exists, merge these keys into it instead:
sudo tee /etc/docker/daemon.json > /dev/null <<'EOF'
{
"log-driver": "json-file",
"log-opts": { "max-size": "10m", "max-file": "3" }
}
EOF
sudo systemctl restart docker 4. Install Freqtrade with Docker Compose
Freqtrade publishes an official docker-compose.yml and documents the steps in its
Docker quickstart. Download the
file, pull the image, create the user_data folder and generate a config:
mkdir ft_userdata && cd ft_userdata
curl -fsSL https://raw.githubusercontent.com/freqtrade/freqtrade/stable/docker-compose.yml -o docker-compose.yml
docker compose pull
docker compose run --rm freqtrade create-userdir --userdir user_data
docker compose run --rm freqtrade new-config --config user_data/config.json new-config asks a series of questions: dry-run, stake currency and amount, maximum open trades,
timeframe, exchange, Telegram and the API server for FreqUI. Answer yes to dry-run. You can leave the exchange keys
empty for now.
Open docker-compose.yml before starting. The command section names the strategy, a sample
one by default. Put your strategy file in user_data/strategies/ and change the name to match. Also
check the ports line: it should bind to 127.0.0.1, which the official file does at the
time of writing. Keep it that way (step 7 explains why). Then start the bot:
docker compose up -d
docker compose ps
docker compose logs -f --tail 100
The compose file sets restart: unless-stopped, and Docker starts at boot. The bot therefore comes
back after a crash or a reboot without you logging in.
5. Run in dry-run first
In dry-run, Freqtrade uses live market data but simulated orders and a simulated wallet (set with
dry_run_wallet in the config). Let it run for at least a couple of weeks, through quiet and volatile
days, and compare the results with your backtests. Large differences usually mean the strategy relies on
something the backtest can’t see: fills, fees or timing.
A good dry-run is not a promise of live results. It only tells you the bot behaves as designed.
6. Create exchange API keys the safe way
When you move to live trading, create a dedicated API key for this bot on the exchange:
- Trade permission only. Enable spot or futures trading as your strategy needs, and nothing else.
- Never enable withdrawals. A bot has no reason to move funds off the exchange. A key without withdrawal rights limits the damage if it leaks.
- Restrict the key to your VPS IP. Most exchanges let you whitelist IP addresses per key. Add the IPv4 address shown on your private order page. A leaked key is then useless anywhere else.
Our servers also have IPv6. If your exchange accepts API connections over IPv6, your requests may leave from that address instead. Either whitelist both, or confirm which one the exchange sees.
Put the key and secret in user_data/config.json, set "dry_run": false, and restart with
docker compose restart. Keep that file out of Git, chat messages and screenshots.
7. Reach FreqUI through an SSH tunnel
FreqUI is Freqtrade’s web dashboard. It can start and stop trades, so it must not be open to the internet. The simplest safe access is an SSH tunnel from your computer:
# On your own computer
ssh -N -L 8080:127.0.0.1:8080 [email protected]
Leave that running, open http://127.0.0.1:8080 in your browser and log in with the API username and
password from your config. Close the tunnel when you are done.
Why the 127.0.0.1 binding matters: Docker publishes ports by writing its own firewall rules, which
bypass ufw. A port mapped as 8080:8080 is reachable from the whole internet even though ufw says
otherwise. If you need access from a phone, put a reverse proxy with HTTPS and authentication in front, or use a
VPN such as WireGuard. Never just remove the binding.
8. Add Telegram notifications
Create a bot with Telegram’s @BotFather to get a token, then find your chat ID. If you skipped
Telegram during new-config, add this block to the config and restart:
"telegram": {
"enabled": true,
"token": "123456789:your-bot-token",
"chat_id": "123456789"
}
Freqtrade then reports entries, exits and errors, and answers commands such as /status,
/profit, /balance and /stop. It only responds to the chat ID in your config.
9. Watch logs and resources
docker compose logs -f --tail 100shows the live log. The compose file also writes it touser_data/logs/.- Freqtrade logs a heartbeat line every minute by default. If it stops, the bot is stuck or down.
docker compose psshows whether the container is running and how often it restarted.df -handfree -hshow disk and memory. Downloaded market data grows fast if you backtest on the server.
Telegram doubles as basic monitoring: if a bot that normally reports trades goes silent for a day, check it.
10. Back up user_data
Everything that matters is in user_data: your config (with API keys), your strategies and the SQLite
database with your trade history. Downloaded candle data in user_data/data can be fetched again, so
leave it out. Stop the bot briefly so the database is copied in a consistent state:
cd ~/ft_userdata
docker compose stop
tar czf ~/ft-backup-$(date +%F).tar.gz --exclude=user_data/data user_data
docker compose start Then pull the archive to your own computer:
# On your own computer
scp [email protected]:ft-backup-*.tar.gz . The archive contains your API keys, so store it encrypted and delete old copies from the server. Open trades stay open on the exchange while the bot is stopped for those few seconds. Stop-losses only protect you during that time if your config places them on the exchange.
Updating Freqtrade
Read the release notes first, then:
cd ~/ft_userdata
docker compose pull
docker compose up -d After a major update, run your strategy in dry-run again for a few days before trusting it with live funds.
Risk warning. A trading bot executes your strategy faster and without breaks. It does not make the strategy profitable, and it can lose money just as quickly. Crypto trading carries a high risk of loss. Only trade with money you can afford to lose. Nothing here is investment advice.
If you also trade MT4 or MT5 alongside your bots, MetaTrader needs Windows. Our forex VPS plans cover that side.