Mobile devices today have sufficient computing power to run not only games, but also full-fledged game servers. Terraria, the legendary sandbox with RPG elements, is no exception. Many players want to organize their own world for playing with friends, without renting expensive VPS and without leaving the computer turned on at night.
Running a server directly on Androida smartphone or tablet opens up unique opportunities. You get full control over world settings, mods and player lists from anywhere in the world. However, this process requires some preparation of the file system and an understanding of network settings.
In this article we will analyze all the steps: from installing the necessary terminal emulator to setting up port forwarding for an external connection. You will learn how to turn your phone into a reliable host for your friends' adventures.
Preparing the file system and installing the emulator
The operating system Android has restrictions on direct access to system files, so to run server scripts we will need a special terminal emulator. The application Termuxis considered the most stable and functional solution at the moment. It provides a Linux environment without the need for root privileges.
It is extremely important to download the current version of the application. Versions from the Google Play Store are often outdated and not supported by the developers. It is recommended to use the F-Droid repository or GitHub to download the installation package.
โ ๏ธ Attention: After installing Termux, be sure to give it permission to access the repository (Storage), otherwise you will not be able to manage the server configuration files.
After installation, launch the application and run basic package update. This ensures that all dependencies are compatible with the current version of the system. Enter the command pkg update && pkg upgrade and confirm the action by pressing y.
For the convenience of entering long commands, connect a physical keyboard to your smartphone or use the PC input function via Wi-Fi, available in the Termux settings.
Installing Java and downloading server files
The server part Terraria is written in the Java programming language, so having the correct version of the JDK (Java Development Kit) is a prerequisite. In the Termux environment, installation is done through the package manager with one simple command.
Enter pkg install openjdk-17 to install a modern version of Java. After installation is complete, check operation by entering java -version. If you see a version number in response, the system is ready to work.
Next you need to download the server file itself. Official builds are available on the developers' website, but for mobile devices it is often more convenient to use automatic installation scripts. Create a separate directory for the project with the command mkdir terraria-server and go to it.
- ๐ Create a project folder with the command
mkdir. - โฌ๏ธ Download the file
TerrariaServer.exeor use Wine to run it, or find a cross-platform build. - โ๏ธ Configure file access rights via
chmod. - ๐ Check the availability of free disk space (minimum 2 GB).
โ๏ธ Preparing the Java environment
It is worth noting that the native version of the Terraria server is designed for Windows. Running on Linux (which emulates Termux) often requires using a compatibility layer Wine or searching for specialized ports such as tModLoader for Linux, which has better support on mobile platforms.
Setting up the game world configuration
The first start of the server initiates the creation of files configurations. You will be asked to answer a series of questions regarding world size, difficulty level and maximum number of players. These settings determine the foundation of your gaming space.
The main parameters are stored in the file serverconfig.txt. You can edit it with any text editor inside Termux, for example nano or vim. Here you can set the administrator password, disable PvP or change the growth rate of plants.
| Parameter | Description | Recommended value |
|---|---|---|
maxplayers |
Maximum number of players | 8-12 (depending on RAM) |
port |
Network port for connections | 7777 |
worldname |
World file name | MyAndroidWorld |
difficulty |
Difficulty level | 1 (Normal) |
Secret settings in config
B In the configuration file, you can activate the "Godmode" mode for the administrator by adding the disablebuild=false parameter, which will allow you to build anywhere without restrictions.
Pay attention to the parameter maxplayers. Setting the value too high on a weak device will result in a drop in FPS and data desync. For most smartphones, the optimal limit is 10 simultaneous connections.
Starting the server and managing the process
After setting up the configuration, you can proceed to the actual launch. The command depends on the installation method you are using. If you are using Wine, the command will look like wine TerrariaServer.exe. For native assemblies, a direct call to Java is used.
While the server is running, a log of events will be displayed in the terminal window: players entering, saving the world, generating chunks. Interrupting the process with a key combination may damage the world file, so use the command exit inside the server console to complete it correctly.
โ ๏ธ Warning: Never close the Termux application with a swipe or the back button while the server is active. This is equivalent to pulling out the power cord and can destroy the progress of the game.
For convenient control of the process in the background, it is recommended to use the utility tmux or screen. This will allow you to disconnect from the terminal session without stopping the server, and return to control later.
Using tmux allows you to keep the server session active even when closing the smartphone screen or switching to other applications.
Network configuration and opening ports
So that friends can connect to your server not only through Wi-Fi, but also from the Internet, you need to configure routing. By default, mobile networks use NAT technology, which hides your device behind a single external IP address.
The easiest way is to use tunneling services such as ngrok or playit.gg. They create a secure tunnel between your phone and the global network by providing a temporary public address. Installing ngrok in Termux requires downloading a binary file from the official website of the developer.
If you are on a home Wi-Fi network, you will need to go to the router settings and configure port forwarding (Port Forwarding). You need to specify the internal IP address of your smartphone and the port that you set in the configuration (usually 7777).
Remember that when using mobile data (4G/5G), opening ports is often impossible due to carrier restrictions. In such cases, tunnel services remain the only working option.
Optimizing performance and eliminating lags
Starting a server is a resource-intensive task. The smartphone's processor will heat up and the battery will drain at an accelerated rate. To minimize lag, it is recommended to disable background applications and reduce screen brightness.
In the configuration file, you can reduce the frequency of world autosaving. The savefrequency parameter defaults to 600 seconds. Increasing this interval will reduce the load on the drive, but will increase the risk of data loss in the event of a failure.
- ๐ Disable the system's power saving mode.
- ๐ถ Use a USB-Ethernet cable connection for network stability.
- โ๏ธ Provide passive cooling of the device (not cover the phone).
- ๐๏ธ Regularly clear the server logs of old entries.
โ ๏ธ Attention: Router interfaces and telecom operator settings are constantly updated. If you cannot find the "Port Forwarding" item, check the current instructions for your router model on the manufacturer's official website.
The critical factor is the amount of RAM. If the server starts to freeze when players log in, try allocating more memory to Java by adding a flag -Xmx1024M to the startup command if your device allows it.
Place your smartphone on a metal surface or near a fan during long gaming sessions to prevent CPU throttling due to overheating.
Often asked questions (FAQ)
Is it possible to run the Terraria server on Android without root access?
Yes, this is quite possible. Using a terminal emulator Termux allows you to run server processes in user space without the need for superuser rights. It's even safer for the system.
Why can't friends connect by IP address?
Most likely the problem is in the NAT or firewall. Make sure you are using a public IP and not a local one (starting with 192.168...). Also check that port 7777 is open in the router settings and is not blocked by an antivirus.
How to install mods (tModLoader) on a server in Termux?
The process is similar to installation on a PC, but requires downloading the Linux version of tModLoader. Download the archive, unpack it into the server directory and run the file tModLoaderServer instead of the standard executable file.
Will the server work if the phone screen goes dark?
By default, the system can kill the process to save energy. To avoid this, use the command termux-wake-lock in Termux, which prevents the system from putting the device to sleep while the terminal is active.
What is the maximum world size supported on a smartphone?
Technically there are no restrictions, but on mobile devices with limited RAM, Large worlds can cause severe delays in generation new areas. It is recommended to use worlds of size Medium.