Fast Deployment of Minecraft Server



When playing Minecraft alone, the moment always comes when you want to add friends to your world. Build various buildings with them, go on a journey, kill a dragon together or discover new worlds. And then a logical question arises: how to create your own server? Until now, I have only used linux servers for games. And then I decided to try a ready-made server from the Marketplace on Windows without a graphical interface (pure PowerShell). It seems to me that all the rakes that are possible have been collected, but I emerged victorious from the battle with Windows Server.



We deploy the server



I have some experience in creating Minecraft servers for linux, and generally in linux administration, but I had no idea what to do with Windows. Perhaps I will even tell some of the captain's things, but for me they were a revelation. The biggest revelation for me was PowerShell. I can't even convey all the emotions of using Windows in console mode. Microsoft made everything as inconvenient as possible. Why was it impossible to take the best from * nix systems, implement and improve? Why can't we make support for ssh, a posix-compatible command system, what is this bike for?



But after a while, he even began to get some pleasure from the interface, and even see some kind of logic. In general, moving from Windows to linux was much easier than doing it back.



So, I created the server in ourMarketplace :







After we click on it, there is a small instruction on how to use it. But it turned out to be insufficient and in many ways I had to figure it out myself.







My practice of creating servers has shown that a Minecraft server requires at least two cores, preferably more than 4 GB of RAM. In general, everything can run on one core, even with 2 GB of RAM, but with a large number of objects, there may be brakes and skips.



Personally, I observed this on a chicken farm, when I had more than a few hundred chickens. Then the server really started to slow down.





Battery case



After creating the server, after a few minutes we will have the server's IP address, its username and password.





Then you need to connect via remote access. Since I am a hard-core Linuxoid, I will describe two connection options.



Connecting to a remote server from Windows



Windows is simple. Click "Start" → "Run" and enter mstsc . We enter the parameters of our server.





If we want to copy data to and from the server (and I want to), then go to the "Local resources" tab, and there we press the "More" button.





And then we indicate which hard drives we want to connect. We will need this if we want to copy various mods or some additional software to our server.





After that we can connect to our server and see one single PowerShell window.





The contents of the C: drive of our computer will be available in the network folder:



\\TSCLIENT\c




I think everything is obvious here, and there should be no problems.



Connecting to a remote server from Linux



Connecting from Linux is a little trickier and more complicated, and most importantly, it does not work very stable (especially mounting remote disks). But there is nowhere to go, so we will use it. In order to connect to the remote desktop of a Windows machine, we need to install the Remmina program.



sudo apt-get update
sudo apt-get install libfreerdp-plugins-standard remmina remmina-plugin-rdp


After installation, run remmina and configure the connection to the remote server.







Pay attention to the color depth, if you choose an incorrect color depth (more than the server supports), there will be a connection error. In order for us to exchange files, we need to select a shared folder. In my case, this is rdpfiles . As a result, our folder on the server will be available at:



\\TSCLIENT\rdpfiles






We start the vanilla server



In order to start a basic server, no high matter is required. First, we need to agree to the license agreement. This is done by the team



Approve-MinecraftEULA




Everything, from this moment the server is ready to work. We can run it with the command



Start-Minecraft


And that's it, your server is ready to go, it creates a new world and the download is in progress, but the devil is in the little things. The server itself is very old, version 1.15.2 (whereas at the time of this writing, there was Minecraft version 1.16.4 ).





But, I will demonstrate that the server is actually working. It is only necessary to put the launch of the old version (1.15.2) in the launcher, and indicate the IP address of our server when connecting to the network.





The connection was successful.



How do you update the server, you ask? It turns out to be very simple. The latest version of the server is located at the following URL . There you will need to copy the link to this file.



All files of this Minecraft server (except for the start scripts) live in the folderC:\Minecraft\ . Therefore, we go into it, and we do all the procedures in it.



cd C:\Minecraft\
#  
rm C:\Minecraft\server.jar


To download a file, PowerShell has an analogue of wget.



Invoke-WebRequest -Uri "http://www.contoso.com" -OutFile "C:\path\file"


Therefore, we copy the link to our file and substitute it into this command. I got it like this (note that in your case there will be a different link, since there will probably be a different version of Minecraft).



Invoke-WebRequest -Uri "https://launcher.mojang.com/v1/objects/35139deedbd5182953cf1caa23835da59ca3d7cd/server.jar" -OutFile "./server.jar"


That's it, we've updated our vanilla server and it's ready to go. Trying to run.



Start-Minecraft


And we see that the updated version of the server is working for us.





Install mods



This part drank a monstrous amount of blood from me, and I butted with it for a very long time, trying to figure out what was wrong. For the mods to work, you need to install the Forge add-on. Despite the fact that the script for launching Forge is on this server, Forge itself is not installed! And this is the main problem.



Please note that each mod requires its own version of Forge! Therefore, look for a detailed description of your modification, and select the compatibility of the Forge version and the mod version. Since I did not have the patience for this quest for selecting the appropriate modules, I am telling you the basic principle. No, the forge started up with modules, but not quite as expected.



We need to download the correct version of Minecraft Forge(choose the appropriate version for your mod). To do this, create a temporary folder C: \ tmp:



mkdir c:\tmp 
cd c:\tmp
# forge
Invoke-WebRequest -Uri "https://files.minecraftforge.net/maven/net/minecraftforge/forge/1.16.3-34.1.0/forge-1.16.3-34.1.0-launcher.jar" -OutFile "forge-1.16.3-34.1.0-launcher.jar"
# 
.\forge-installer.jar


Select "Install server" and select the folder where to put (C: \ Minecraft) click OK. And we are waiting for the download.





After the installation is completed, such a window will be displayed.





The success of the installation can be checked by the command.



Start-Minecraft -Type Forge -LogFile "C:\Minecraft\stdout.txt" -MinecraftPath "C:\Minecraft"


If everything starts without errors, that's it, your server is ready to start mods. Then you can copy the mods to your network folder, in my case rdpfiles and then copy all the mods to the C: \ Minecraft \ mods \ folder (after creating it).



mkdir C:\Minecraft\mods\
cd \\TSCLIENT\rdpfiles
cp *.jar C:\Minecraft\mods\


In order to create a new world, do not forget to delete the old one beforehand.



rm C:\Minecraft\world\ 


We agree with everything by pressing the letter "A" on the Latin keyboard. Everything, we can start a new world with mods.



Start-Minecraft -Type Forge -LogFile "C:\Minecraft\stdout.txt" -MinecraftPath "C:\Minecraft"


You can delete mods in the same way by deleting files in the C: \ Minecraft \ mods \ folder .



Whitelisting and other server settings



If you are creating a server for friends, remember to whitelist. Otherwise, there are all sorts of unpleasant guys who somehow find your secret server and dirty it. I had a case when such a bad man was mining our houses. At what several times. The third time, I freaked out and figured out how to whitelist the white masters.



Whitelists can be enabled through the configuration file, but it is much easier to configure them directly in the server console. To do this, write directly in the console:



whitelist on




You can even try to log into the server and make sure that no one will log on to it now.





After that, you can add all the players who will be on this server. I will add only myself for now.



whitelist add dlinyj 




That's it, now I can log into this server.



To configure the server, you need to edit the server.properties file . You can shut down the server with the ctrl-c combination . Then you can open this file with a regular notepad.



.\notepad.exe C:\Minecraft\server.properties




Scheduling all the server configuration fields is beyond the scope of this article, so you can familiarize yourself with it yourself here . Some parameters can be changed directly in the server console, and they are automatically saved in the server.properties file. An example of such a parameter is whitelisting. Something can be changed manually. Experiment.



conclusions



For me, I had an interesting experience with server Windows, after linux. And each time I was faced with the fact that each command had to be searched anew. For example, to restart the server, the command will be:



Restart-Computer 


If you accidentally close the PowerShell window, you can start it by pressing Ctrl-Shift-Esc . Then execute PowerShell there.







In general, the discovery of wonderful Windows concealed us.



There is a lot to tell, and about the installation of the Far-manager, and where the configuration scripts are. But it seems to me that this article will give you an understanding of how to quickly and easily deploy your game server.










All Articles