Share your repls and programming experiences

← Back to all posts
🔥Minecraft Server on Repl.it!🔥
h
Scoder12 (850)

How to run a minecraft server on repl.it

Hey guys today I'm going to show you how to run a minecraft server on repl.it.

Note: You need hacker plan for this to work right now!

Installation is super simple!

  1. Start a new bash repl
  2. In the console paste this:
wget -O mc.sh https://xpiredl.scoder12.repl.co/mc.sh
  1. In main.sh, paste this:
bash mc.sh

Run the repl and follow the instructions!
Once you see Done! in the console, connect to the ip shown in ip.txt
If you have questions ask in the comments!

How to change minecraft version

  1. If you already have a server, delete the files mc/server.jar and mc.sh
  2. Run the command above that starts with wget again (even if you already have the script)
  3. In mc.sh, find the line that says VERSION=1.16.3 and edit it to your desired version

Huge shoutout to @letsrepl for the initial concept.

Remember to upvote if you enjoyed!

Comments
hotnewtop
gg2001 (7)

Consider putting php -S 0.0.0.0:3000 ip.txt & bash mc.sh in main.sh, instead of just bash mc.sh. This automatically sets up a website for it, making it easier to use with uptime robot.

Once this is setup, go to uptime robot and create a keyword monitor that checks every 5 minutes for the keywords "Server running on". That way the server will stay up all the time.

Don't forget to put the ngrok_token and ngrok_region values in your .env!

Forgiving22 (0)

@gg2001 What IP should I use? How do I forward this ever-changing IP to a domain?

Scoder12 (850)

@Forgiving22 buy ngrok premium if you want to have an IP that doesn't change https://ngrok.com/pricing

astrochampcambr (0)

@Scoder12 are there any free alternatives to ngrok that have a static IP?

mesquite2234 (279)

@Scoder12 Could you use a Microsoft azure VM? (Not saying they're free, but they have a constant IP)

Scoder12 (850)

@mesquite2234 yes, you could do this on any VPS. Here is a tutorial. The one thing I would do differently from that tutorial is using a high-performance jar from https://papermc.io instead of the vanilla jar.

mesquite2234 (279)

@Scoder12 Thanks, how do I connect it to repl?
Edit: sorry for the unclear question, I meant to say how would I replace the ngrok thing with a VM

Scoder12 (850)

@mesquite2234 I don't know, it would probably require reverse proxies and stuff and would get pretty complicated

mesquite2234 (279)

@Scoder12 I have the code to start it, its the connecting from minecraft thing I needed help with.

mesquite2234 (279)

@Scoder12 I figured out the commands to start and run the server, but I can't connect to a server when I run it on replit, How do I connect?

mesquite2234 (279)

@Scoder12 I dont see one,where is it?

Scoder12 (850)

@mesquite2234 in the file ip.txt in the mc folder once you run the server

mesquite2234 (279)

@Scoder12 I have my own code for running the server, how do I find the IP? (Again, sorry for the unclear questions)

Scoder12 (850)

@mesquite2234 well if its not my code then you can google an ip finder service for the commandline, get your server's IP, and if your azure VM doesn't have any firewalls interfering with it you should be able to connect

mesquite2234 (279)

@Scoder12 I invited you to my repl, I need help connecting to this

LeoXu2 (40)

@gg2001 doesn't work for me. after it starts it just shows this ;-;

Onetopic (5)

excited villager noises

Coder100 (17479)

ree not work here

basically whats the ngrok key reee

Scoder12 (850)

@Coder100 You have to login to the dashboard that it gives you, and then copy the auth token

Coder100 (17479)

ok what do i log in with i don't want to make acc reee @Scoder12

angrydoge (473)

Just set up this server then realized that this is a java server after waiting 5 minutes wondering why it wasnt connecting.

zhidao (13)

I actually made a server!!! You have to make a .env file beforehand and it will work!

zhidao (13)

@zhidao

and plus, I have Minecraft

ThomasHagan (3)

how did you make the .env file? @zhidao

zhidao (13)

@ThomasHagan

bruh

just make a .env file named .env and put ur ngrok token inside

ThomasHagan (3)

@zhidao I tried that. I'll start again and create the .env file first as you mentioned. I was thinking there was something in the naming I may have been missing. Thanks!

zhidao (13)

@ThomasHagan no the .env file is lit named ".env"

ThomasHagan (3)

@zhidao Thanks! Felt a bit dumb to find that out.

JadenTheDev (1)

@ThomasHagan just make a new file and call it .env

JasperLianLian (1)

@Scoder12 How do you do this I couldn't find any .env file

Scoder12 (850)

@JasperLianLian click main.sh then press the add file button and type .env and then press enter

CroxyTheDev (2)

it says "chmod: cannot access 'jre/bin/java': No such file or directory" please help me dude

Scoder12 (850)

@CroxyTheDev sorry, should be fixed now if you try again

yadunandanrocks (1)

When is the minecraft Bedrock server coming out? I can help you test it if required

[deleted]

@yadunandanrocks i also want a minecraft bedrock server on repl

Scoder12 (850)

@yadunandanrocks not sure, I don't know how to set it up tbh

DiveshTheReal (103)

i just create the server and got this Can't keep up! Is the server overloaded? :/

APCSPShehadaK (1)

Hey, any way to keep the server alive? The server closes very quickly even with hacker plan, I even lost ~5min of progress (autosave).
I wasn't able to listen to port 8080 & host the mc server at the same time as the http server would close as soon as the mc server started.

Any suggestions or plans?

Unrelated: Inside of your server.properties, I'd recommend setting sync-chunk-writes=false to improve performance & enable-rcon=false as rcon is not being used.

Scoder12 (850)

@APCSPShehadaK its very tricky to have multiple ports listening on repl.it and have the correct one be forwarded but you might be able to get it to work.

APCSPShehadaK (1)

@Scoder12
Solved with a vanilla php server on port 3000.
index.html is a placeholder, the file can hold anything but should exist.

main.sh:
php -S 0.0.0.0:3000 index.html & bash mc.sh

PokeGirl1024 (2)

Can you do this without Hacker? I'm a random kid wanting to play Minecraft and I've already used my savings for that.

DarshanRajpara1 (13)

Does it work for bedrock too?

tussiez (1565)

@DarshanRajpara1 If you could find low-level access to the Linux host of the Repl servers, yes. I'm still not sure if you can. With third-party hosts like PocketMine that runs on PHP, I bet you could.

Scoder12 (850)

@DarshanRajpara1 Someone was asking for help with a bedrock server using pocketmine, but they were having trouble connecting. I think thats its definitely possible in theory but hasn't been pulled off yet

OverdriveAR (0)

mine won't run...

mc.sh: line 114: 376 Killed

what does this mean?

StinkySlinky (0)

When I do the console command, it downloads "mc.sh" and the "mc" folder, but nothing else.

StinkySlinky (0)

Nevermind. I guess I'd have to get the hacker plan.
WHY DO I HAVE TO PAY FOR GOOD THINGS!?!?!?

LeoXu2 (40)

@Scoder12 I found that playit.gg works really well for me

WolFoxHD (0)

can't create file .env

Scoder12 (850)

@WolFoxHD use the secrets manager instead then

DemonKingSwarn1 (0)

[07:41:34 INFO]: Thread RCON Client /172.18.0.1 shutting down
i am getting this msg in my console

Scoder12 (850)

@DemonKingSwarn1 set enable-rcon=false in server.properties and it should go away. This isn't an error BTW so no need to worry.

LeoXu2 (40)

Is there a way to create an HTTP server that prints the IP? Thanks!

Aquarial (0)

Why did this happen?
mc.sh: line 114: 182 Killed java -Xmx1G -Xms1G -jar server.jar nogui
exit status 137

Scoder12 (850)

@Aquarial because you do not have hacker plan. Get hacker or see the comment here that tells you how to run it without hacker

LeoXu2 (40)

Hello how to make a website that says the IP so that ppl can see what the IP is even if it changes thx

AlexIsOK1 (0)

Can't make .env files anymore, now what?

LeoXu2 (40)

CANT CHANGE VERSION HALP

Scoder12 (850)

@LeoXu2 what happens when you follow the steps in the post that tell you how to change the version?

LeoXu2 (40)

@Scoder12 o shoot i only did the 3rd step no I have 10 repls ;-;

Scoder12 (850)

@LeoXu2 the first two steps are important lol

HuguitisYT (0)

how i can add mods

Scoder12 (850)

@HuguitisYT idk but the server is called "Paper" so look that up

AarushPande (0)

put it in the plugins folder. I would advise getting a client like lunar or badlion, enabling MumbleLink, then downloading, installing, and creating a server with Mumble. the repl server just can't handle that many mods

mesquite2234 (279)

Is it possible to do this with an azure VM, if so how? thanks!

patricklabayd (0)

Why does this mean?

> mc.sh: line 114: 96 Killed java -Xmx500M -Xms500M -jar server.jar nogui

Scoder12 (850)

@patricklabayd Read the post please. You need hacker plan. That means that your repl ran out of memory.

gomgo (0)

@patricklabayd I haven't got the hacker plan, so i do this:

I changed the "java -Xmx1G -Xms1G -jar server.jar nogui" to "java -Xmx200M -Xms200M -jar server.jar nogui" Without the "

And now it works, and i can play with my friends, you can change the 200M to 500M or somethingh like

JadenTheDev (1)

clickabait when u join for a little u will get kicked

Scoder12 (850)

@JadenTheDev if you put python3 -m http.server 8080 & at the top of main.sh and then put always on it should stay open 24/7

JadenTheDev (1)

wait for real! is it 24/7 and how many gb r there