Share your repls and programming experiences

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

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 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!

Huge shoutout to @letsrepl for the initial concept.

Remember to upvote if you enjoyed!

Commentshotnewtop
Onetopic (4)

excited villager noises

zhidao (14)

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

zhidao (14)

@zhidao

and plus, I have Minecraft

ThomasHagan (2)

how did you make the .env file? @zhidao

zhidao (14)

@ThomasHagan

bruh

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

ThomasHagan (2)

@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 (14)

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

ThomasHagan (2)

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

Coder100 (4444)

ree not work here

basically whats the ngrok key reee

Scoder12 (676)

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

Coder100 (4444)

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

PokeGirl1024 (1)

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

Scoder12 (676)

@PokeGirl1024 You can use the Student Developer Pack to get hacker for free

DarshanRajpara1 (13)

Does it work for bedrock too?

tussiez (7)

@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 (676)

@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

RossJames (288)

ngrok.com does not load

Scoder12 (676)

@RossJames weird, I don't know how to fix

gg2001 (0)
chmod: changing permissions of 'jre/bin/java': Disk quota exceeded
exit status 1```


It seems to have stopped working.
Scoder12 (676)

@gg2001 exactly what it says: disk quota exceeded. Try a new repl, don't load as many chunks next time

nahu (19)

I dont know bash

nahu (19)

It deos not work do u know to to fix it

Scoder12 (676)

@nahu you have to give more information than that.

nahu (19)

i dont no where the console [email protected]

iPenguin (7)

i can't connect - i keep getting io.netty.channel.abstractchannel$annotatedconnectexceptioon: connection timed out

Scoder12 (676)

@iPenguin weird, what does your IP look like?

iPenguin (7)

@Scoder12 here's an example one: 0.tcp.ngrok.io:12679

Scoder12 (676)

@iPenguin thats completely expected. Are you sure you waited until the server printed out Done! and your internet is fine?

iPenguin (7)

@Scoder12 yeah. i thought it might have been something i messed with in server files, so i tried recreating the server a few times in a new completely new repl but with the same results

iPenguin (7)

@Scoder12 also, the server console never logs that i attempted to join and the motd never appears in the server list

Scoder12 (676)

@iPenguin share the repl with me maybe I can help

Scoder12 (676)

@iPenguin Try running it again, make sure that it prints out "Done" before you join

iPenguin (7)

@Scoder12 just did, doesnt work for me. i could try to get one of my friends to join later today and see if it works for them

gg2001 (0)

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!

MatthewDoan1 (333)

Could you explain what this does?

(by the way everyone, I'm BACK!!!)

iPenguin (7)

Is there a way to use a dedicated IP?

Scoder12 (676)

@iPenguin yeah, pay for ngrok pro plan or use some sort of dynamic dns

APCSPShehadaK (0)

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 (676)

@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 (0)

@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

CarlosRosiles (153)

Java or Bedrock? (Not that I want to do it, I just want to find out) Im pretty sure its Java. :(

Scoder12 (676)

@CarlosRosiles yep java. Bedrock server might happen, stay tuned...

dm89263 (0)

where is the console?

QuintenBuwalda (0)

@dm89263 The console is the normal console you have on the side of your IDE.

lphi71086 (2)

Do you have to run this file on the same computer that you play minecraft on? And is it a different IP address each time you run it, so that you can make multiple servers?

Other than those questions, I think this is totally, completely awesome!!!!!!!

Scoder12 (676)

@lphi71086 No, the repl can be open on any computer as long as it is open. And the IP address is different every time so you can have multiple servers.

QuintenBuwalda (0)

For some reason, it keeps saying that I need to put ngrok_token in my .env file even though it's already there.

QuintenBuwalda (0)

When I run bash mc.sh from the console is comes with the previous error, if I run it from the main.sh on start it comes with a new message:

Environment variable ngrok_region not set. 
In your .env file, add a line with:
ngrok_region=
and then right after the = add your region, one of:
us - United States (Ohio)
eu - Europe (Frankfurt)
ap - Asia/Pacific (Singapore)
au - Australia (Sydney)
sa - South America (Sao Paulo)
jp - Japan (Tokyo)
in - India (Mumbai)
Scoder12 (676)

@QuintenBuwalda you can't run it from the console because if you run it in the console, the .env doesn't work. This new message means that you set the first variable correctly, and now it wants you to add a second one.

QuintenBuwalda (0)

@Scoder12 Is there a problem with my .env now?

ngrok_token=TOKEN
ngrok_reigon=ap

I've run the the script from main.sh and it still comes with the invalid region error.

AyoX2 (1)

how does it run in terms of performance?
does it lag?
how many players can it support?

Scoder12 (676)

@AyoX2 On hacker I played with 3 people with no lag, but I haven't tested with more than that.

ohnayR (0)

I'm confused. Can you show me the steps in pictures along with captions please?

Scoder12 (676)

@ohnayR just follow the post. Also, you need to have hacker plan first or it won't work

ohnayR (0)

@Scoder12
Dang, I really wish I had Hacker for free for a lifetime... What a dream.

nt998302 (173)

Wow! How long did it take you to make this?

Scoder12 (676)

@nt998302 not that long haha. I did get a lot of help from @letsrepl with the server config but writing the script didn't take much time

RaidingShaman (0)

Showing me this in the site:
"Hmmmm.... We Couldn't Reach Your Repl
Make sure your repl has a port open and is ready to receive HTTP traffic."

Scoder12 (676)

@RaidingShaman thats supposed to happen. This is because it thinks the minecraft server is a web site but the minecraft server denies the web requests.

Scoder12 (676)

@RaidingShaman its not a problem. Just ignore the message or press the "X" button on the web view since you don't need it for anything

2009k (11)

THIS ACTUALLY WORKS! I dont have hacker but my freind does. we tested it out and created a new server. Take an upvote!

AmeenShafeeq (5)

Does it work for mcpe?

DarthZygote (0)

@AmeenShafeeq It is for the java edition of minecraft, which is the one on pc. It will not work on mcpe

ManavMalik (3)

I did /stop on the server, but now I can't get it back up. How do I get the server back up?

ManavMalik (3)

@Scoder12 -- I tried to run the mc.bash file again, but the ngrok tunnel was still open (apparently) and things went broke 'cuz I only have a free ngrok account so one tunnel only.

Scoder12 (676)

@ManavMalik Oh weird. Is it still broken?

ManavMalik (3)

@Scoder12 Yea, I used a different account.

JadenGarcia (39)

What about this requires hacker?

PXY (42)

The specific server requirements are only available in a hacker plan @JadenGarcia

JadenGarcia (39)

@PXY I don't see what requires hacker here, anyone can create a Bash Repl and and follow those steps.

Scoder12 (676)

@JadenGarcia Without the additional memory the hacker plan provides, the server can't run/runs poorly.

JadenGarcia (39)

@Scoder12 Now that makes more sense, thank you! You might want to put that in the post itself.

ZeeMan (3)

Great job thx

CodingRobot12 (189)

This is a nice repl (although I don't have hacker plan). Do you want me to add this to my upcoming search engine?