This article was automatically imported from the previous wiki and may contain inaccurate or outdated information.
pkg update
pkg upgrade
(Technically, you can skip this, and tun all the commands in part 3 directly on the Termux terminal. But you're going to want a keyboard, and the ability to interact with the filesystem over FTP)
pkg install openssh
openssh
passwd
whoami
termux-wake-lock
pkg install nodejs
pkg install wget
cd $HOME
mkdir foundryvtt
mkdir foundrydata
cd foundryvtt
wget -O foundryvtt.zip [the link you copied]
unzip foundryvtt.zip
node $HOME/foundryvtt/resources/app/main.js --dataPath=$HOME/foundrydata
Most of the time, UPnP will take care of the port forwarding for you, allowing you to connect from outside your local network. Sometimes, this won't work. There are guides elsewhere for setting this up.
Also, every time you restart your phone, Termux will lose its wakelock, the ssh server will shut down, and Foundry will close. You can automate this (see below), or run the following commands when you start Termux:
termux-wake-lock
sshd
node $HOME/foundryvtt/resources/app/main.js --dataPath=$HOME/foundrydata
$HOME/.termux/boot/
. This is easiest to do over FTP if you set that up earlier, but can be done within Termux or over SSH.startup.sh
, with the following text:#!/data/data/com.termux/files/usr/bin/sh
termux-wake-lock
node $HOME/foundryvtt/resources/app/main.js --dataPath=$HOME/foundrydata
openssh
(only if you want the SSH server to start on boot)Q: Do I need to root my phone?
A: No! Everything is being done by Termux, in filespace which Termux has access to, so Android is happy to do this with default permissions.
Q: My SFTP session disconnects while transferring stuff!
A: That might happen. Just reconnect, and it will start back up again.
Q: I want to set up SSL for Foundry.
A: There are various guides out there. You’ll need to set up SFTP access to get to move the keys over to the Config folder, but otherwise it works the same.
Q: Foundry isn’t starting with the phone!
A: Give it a couple minutes. It can take a bit of time to actually start.
If it’s working, you should see a notification in the taskbar that termux is running “1 task (wake lock held)”
If you see that and Foundry is not working, you probably mistyped something.
If it’s not working, then fire up SSH, type cd $HOME/.termux/boot
, then bash startup.sh
, and see if it throws any errors. If it’s saying unknown command, and the commands end in \r, then go back and read the note on deleting carriage returns.
Q: You’ve done something in a silly/overcomplicated way!
A: Very probably, this guide was originally made when I (BadIdeasBureau) was new to linux. It's a wiki, edit it to fix it.
Q: Why?
A: Why not?
Also, because it provides a way of turning an old phone that was sat around failing to be recycled into a thing I can stick in a cupboard and use as a dedicated server.
Q: Can I do this on an iPhone?
A: No idea. Probably not. Definitely not with Termux, but there might be an equivalent.
Q: Why aren’t you using the shared internal storage/external storage?
A: I tried this. It went weird. Files created by the terminal didn’t show up when connected via USB (even in folders which were definitely public), and Foundry could make its config file, but then threw an error when trying to access it. Fixing this would be a neat improvement to the guide, but for now you're stuck inside Termux's app space (which isn't much of a limitation, but does mean file transfer has to be via FTP or Foundry's interface, rather than just over USB).