🌱 Como Hospedar um Servidor de Minecraft no Android
Quer hospedar um servidor de Minecraft para jogar com seus amigos? Só precisa de um celular Android e a configuração de um servidor Linux. É bem simples, juro.
Etapa 1 — Instalação do Termux e Ubuntu
-
Baixe Termux e AnLinux no seu Android na Google Play Store.
-
Selecione Ubuntu no AnLinux e copie o código.
-
Execute o comando no Termux.
-
Para iniciar o servidor, execute:
./start-ubuntu.sh-
Você pode renomear para
s, executando:mv start-ubuntu.sh sIsso permite entrar no Ubuntu escrevendo apenas
./s.
-
IMPORTANTE: Arraste para baixo na barra de notificações — deve haver uma opção de Wakelock para o Termux. Isso impede que o serviço seja encerrado e permite que continue funcionando em segundo plano.
Etapa 2 — Instalação dos Componentes Necessários
Antes de instalar os componentes necessários, execute:
apt-get update && apt-get upgrade
apt install nano # Programa de edição e adição de arquivos
apt install curl # Usado para instalação do Ngrok, serve para obter URLs
Por algum motivo, o Ubuntu instalado não possui esses dois comandos instalados por padrão.
Em seguida, instale o Java:
apt-get install software-properties-common
add-apt-repository ppa:openjdk-r/ppa
apt-get update
apt-get install openjdk-21-jdk # Instale o mais recente
Certifique-se de que está instalado corretamente:
java -version
Etapa 3 — Configurando o Servidor (Vanilla, mundo comum)
-
Certifique-se de que você está no diretório inicial:
cd ~ -
Crie uma pasta para seu diretório e entre nela:
mkdir mc && cd mc -
Baixe o arquivo
.jardo servidor do Minecraft. Você pode fazer isso a partir do site oficial do Minecraft ou de outro site, como o PaperMC (implementação de Spigot e plugins). Baixe o.jarcorrespondente à versão do seu Minecraft.Servidor oficial (Vanilla):
wget -O minecraft_server.jar https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jarOu PaperMC:
wget -O minecraft_server.jar https://api.papermc.io/v2/projects/paper/versions/1.19.3/builds/448/downloads/paper-1.19.3-448.jar -
Dê permissão de execução:
chmod +x minecraft_server.jar -
Inicie o servidor:
java -Xmx1024M -Xms1024M -jar minecraft_server.jar noguiOs valores em
-Xmxe-Xmsdeterminam, respectivamente, a memória RAM máxima e mínima dedicada ao servidor. Por segurança, deixe pelo menos 1 GB. -
Na primeira execução, ocorrerá um erro pedindo para concordar com o
eula.txt. Você também pode alterar parâmetros noserver.propertiespara modificar as informações do servidor:nano server.propertiesmax-players→ quantidade de jogadoresonline-mode→ permissão para entrada de contas não-legacydifficulty→ dificuldade, entre outros...
-
Edite o arquivo do EULA:
nano eula.txt- Altere
eula=falseparaeula=true Ctrl+Spara salvar,Ctrl+Xpara sair
- Altere
-
Inicie o servidor novamente:
java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui -
Para encerrar o servidor, digite:
stop
Etapa 4 — Configurando o Ngrok (Acesso Externo)
-
Acesse ngrok.com.
-
Crie uma conta e faça login.
-
Na página Dashboard, selecione Linux em Agents.
-
Copie e cole o comando
curlfornecido pelo site para instalar. Caso não funcione, use:apt install ngrok -
Após instalar o programa, copie e cole o comando contendo o Token de Autenticação fornecido pelo site.
-
Gere um link de acesso ao servidor:
ngrok tcp 25565Cada vez que é inicializado, o link gerado é diferente. O site requer o cadastro de um cartão de crédito, mas este serviço não é cobrado — serve apenas para verificar a identidade do usuário como pessoa física (assim como a Oracle faz).
-
Se aparecer "Status da sessão online" em verde, a autenticação foi bem-sucedida. O link de acesso está na linha Forwarding. Copie a parte no formato:
0.tcp.ngrok.io:12345
Etapa 5 — Automatizando a Inicialização
-
Se os dois serviços estiverem funcionando corretamente, é necessário mantê-los ativos simultaneamente. Abra uma nova sessão apertando
Ctrl+Alt+C. -
Alterne entre as sessões com
Ctrl+Alt+↑/↓ouCtrl+Alt+P/N. Você também pode fazer isso pela aba do Termux. -
Para simplificar, crie arquivos sem extensão para iniciar o servidor de Minecraft e o serviço do Ngrok:
Script do servidor:
nano mConteúdo:
#!/bin/bash java -Xmx1024M -Xms1024M -jar minecraft_server.jar noguiSalve (
Ctrl+S), saia (Ctrl+X) e dê permissão:chmod +x mScript do Ngrok:
nano nConteúdo:
#!/bin/bash ngrok tcp 25565Salve (
Ctrl+S), saia (Ctrl+X) e dê permissão:chmod +x n -
Execute cada script em uma sessão separada:
./m./n -
Para encerrar os dois serviços, use
Ctrl+Cnas duas sessões ativas.
Etapa 6 — Conectando ao Servidor
- Entre no Minecraft.
- Selecione Multijogador → Conexão Direta e cole o link de acesso obtido no Ngrok.
- Acesse e divirta-se!
Fontes
- XDA Developers — Run Minecraft Server on Android
- Reddit — Hosting a Minecraft Server on Android — contém mais informações, como conexão via SSH, inserção de mundos criados anteriormente, instalação de Forge, e muito mais.
- Termux Wiki — Hardware Keyboard :::
🌱 How to Host a Minecraft Server on Android
Want to host a Minecraft server to play with your friends? All it requires is an Android phone and the Linux server configuration. It's pretty simple, I swear.
Step 1 — Installing Termux and Ubuntu
-
Download Termux and AnLinux on your Android from the Google Play Store.
-
Select Ubuntu in AnLinux and copy the code.
-
Run the command in Termux.
-
To start the server, run:
./start-ubuntu.sh-
You can rename it to
sby running:mv start-ubuntu.sh sThis lets you enter Ubuntu just by typing
./s.
-
IMPORTANT: Pull down the notification bar — there should be a Wakelock option for Termux. This prevents the service from being killed and lets it keep running in the background.
Step 2 — Installing the Required Components
Before installing the required components, run:
apt-get update && apt-get upgrade
apt install nano # Editing/file-adding program
apt install curl # Used for installing Ngrok, used to get URLs
For some reason, the installed Ubuntu doesn't come with these two commands by default.
Next, install Java:
apt-get install software-properties-common
add-apt-repository ppa:openjdk-r/ppa
apt-get update
apt-get install openjdk-21-jdk # Install the latest version
Confirm it's installed correctly:
java -version
Step 3 — Setting Up the Server (Vanilla, regular world)
-
Make sure you're in your home directory:
cd ~ -
Create a folder for your directory and go into it:
mkdir mc && cd mc -
Download the Minecraft server
.jarfile. You can do this from Minecraft's official site or another site, such as PaperMC (a Spigot/plugin implementation). Download the.jarmatching your Minecraft version.Official server (Vanilla):
wget -O minecraft_server.jar https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jarOr PaperMC:
wget -O minecraft_server.jar https://api.papermc.io/v2/projects/paper/versions/1.19.3/builds/448/downloads/paper-1.19.3-448.jar -
Grant execute permission:
chmod +x minecraft_server.jar -
Start the server:
java -Xmx1024M -Xms1024M -jar minecraft_server.jar noguiThe
-Xmxand-Xmsvalues set, respectively, the maximum and minimum RAM dedicated to the server. For safety, leave at least 1 GB. -
On the first run, an error will occur asking you to agree to
eula.txt. You can also change parameters inserver.propertiesto modify the server's settings:nano server.propertiesmax-players→ number of playersonline-mode→ whether non-legacy accounts are allowed indifficulty→ difficulty, among others...
-
Edit the EULA file:
nano eula.txt- Change
eula=falsetoeula=true Ctrl+Sto save,Ctrl+Xto exit
- Change
-
Start the server again:
java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui -
To stop the server, type:
stop
Step 4 — Setting Up Ngrok (External Access)
-
Go to ngrok.com.
-
Create an account and log in.
-
On the Dashboard page, select Linux under Agents.
-
Copy and paste the
curlinstall command provided by the site. If it doesn't work, use:apt install ngrok -
After installing the program, copy and paste the command containing the Auth Token provided by the site.
-
Generate an access link to the server:
ngrok tcp 25565Each time it's started, the generated link is different. The site requires registering a credit card, but this service is not charged — it's only used to verify the user's identity as a real person (the same way Oracle does).
-
If "Session Status: online" appears in green, authentication was successful. The access link is on the Forwarding line. Copy the part in the format:
0.tcp.ngrok.io:12345
Step 5 — Automating Startup
-
If both services are working correctly, you need to keep them running simultaneously. Open a new session by pressing
Ctrl+Alt+C. -
Switch between sessions with
Ctrl+Alt+↑/↓orCtrl+Alt+P/N. You can also do this from the Termux tab. -
To simplify things, create extensionless files to start the Minecraft server and the Ngrok service:
Server script:
nano mContent:
#!/bin/bash java -Xmx1024M -Xms1024M -jar minecraft_server.jar noguiSave (
Ctrl+S), exit (Ctrl+X), and grant permission:chmod +x mNgrok script:
nano nContent:
#!/bin/bash ngrok tcp 25565Save (
Ctrl+S), exit (Ctrl+X), and grant permission:chmod +x n -
Run each script in a separate session:
./m./n -
To stop both services, use
Ctrl+Cin both active sessions.
Step 6 — Connecting to the Server
- Open Minecraft.
- Select Multiplayer → Direct Connection and paste the access link obtained from Ngrok.
- Connect and have fun!
Sources
- XDA Developers — Run Minecraft Server on Android
- Reddit — Hosting a Minecraft Server on Android — contains more information, such as connecting via SSH, importing previously created worlds, installing Forge, and much more.
- Termux Wiki — Hardware Keyboard
Comments