Run Minecraft Server on Google Colab
As the official FAQ says, colaboratory, or “Colab” for short, is a product from Google Research. Colab allows anybody to write and execute arbitrary python code through the browser, and is especially well suited to machine learning, data analysis and education. More technically, Colab is a hosted Jupyter notebook service that requires no setup to use, while providing free access to computing resources including GPUs. In short, it is a vm provided for learning, running python code, machine learning or for general purpose.
Yes, Colab is free to use. But there are some points which, according to me one should keep in mind:
- Though colab is a free service, it shouldn't be exploited indiscriminately or without any care. One should value that its a resource offered for no cost and can get depleted/restricted if the demand increases out of control.
- If it isn't obvious, one shouldn't run mission-critical services (like large and important servers/databases/python programs) on it. Its resources are not guaranteed and not unlimited, and the usage limits sometimes fluctuate. Also, the notebook has a maximum runtime of 12 hours, after which, it should be manually restarted.
- One should not try to spread it as wildfire (in my opinion), that there's a free service available to every living being out there. If such a sudden boom in user base happens, Google would be forced to close down the free teir of google colab, devoiding many hobbists of the free service. Keep it like a secret, telling it to only those who are worthy and know how to use it.
In the end, it is just my personal opinion and can be ignored safely. Just ask your heart whats right and whats wrong. Also, please try to use it as a once in a while resource and not 24x7 so that others can avail the free resources too.
As Google Colab is a VM running Ubuntu server as base OS, it can be easily used as a Minecraft server. Here are the steps which the notebook performs to setup the server:
- Update the system's apt cache.
- Install Openjdk-15 (Java) through apt-get.
- Mount Google Drive to access the minecraft folder (Drive is used here to provide persistent storage).
- Setup Ngrok (by asking for key by user and opening a tunnel at port 25565).
- Change directory to the minecraft-server folder on google drive (I have here used "Minecraft-server" as the server folder in the root directory of my Google Drive.
- List/Print the file list on the screen to indicate succesful directory change.
- Startup the Minecraft server (with optimized JVM parameters from Aikar's guide)
- Use RaiDrive to manage your server's files