Creating and configuring a Minecraft server

Creating and configuring a Minecraft server

Minecraft is currently one of the most popular online games. In less than three years (the first official release took place in the autumn of 2011), it has gained millions of fans around the world.

The game developers deliberately draw inspiration from the best examples of two decades ago, when many games were considered primitive by today's standards in terms of graphics and imperfect in usability, yet were truly captivating.

Like all sandbox games, Minecraft offers users immense opportunities for creativity — this, in fact, is the main secret to its popularity.

The organization of game servers in multiplayer mode is handled by the players themselves and their communities. Today, there are tens of thousands of game servers operating on the Internet (see, for example, the list here).

There are many fans of this game among our clients, who rent equipment for gaming projects in our data centers. In this article, we will discuss the technical aspects to consider when choosing a server for
Minecraft.

Choosing a platform

The game Minecraft consists of the following architectural elements:

  1. server — a program that enables players to interact with each other over the network;
  2. client — a program for connecting to the server, installed on the player's computer;
  3. plugins — add-ons for the server that introduce new features or expand existing ones;
  4. mods — additions to the game world (new blocks, items, capabilities).

There are many server platforms for Minecraft. The most common and popular are Vanilla and Bukkit.

Vanilla is the official platform from the game developers. It is available in both graphical and console versions. A new version of Vanilla is always released simultaneously with a new version of Minecraft.

A downside of Vanilla is its excessive memory consumption (about 50 MB per player). Another significant drawback is the lack of plugins.

Bukkit was created by a group of enthusiasts who attempted to improve the official Minecraft server. The attempt was quite successful: Bukkit is much broader in functionality than Vanilla, primarily due to its support for various mods and plugins. Moreover, it consumes less memory per player—approximately 5–10 MB.

The downsides of Bukkit include that it consumes too much RAM during startup. Additionally, the longer the server runs, the more memory it requires (even with few players). When choosing Bukkit as the server platform, it's essential to consider that its new versions often contain bugs; the stable version typically emerges about 2-3 weeks after the official Minecraft release.

Furthermore, recently, other platforms (such as Spout, MCPC, and MCPC+) have been gaining popularity, but they are limited in compatibility with Vanilla and Bukkit and have extremely limited mod support (for example, with Spout, you can only write mods from scratch). If they are used, it should only be for experimentation.

For setting up a game server, we recommend using the Bukkit platform because it offers the greatest flexibility; additionally, there are many diverse mods and plugins available for it. The stable operation of a Minecraft server largely depends on the proper choice of hardware platform. Let's examine this topic in more detail.

Hardware Requirements

Both the server and the Minecraft client are very demanding on system resources.
When choosing a hardware platform, it's crucial to note that a multi-core processor won't offer many advantages: the Minecraft server core can only utilize one processing thread. However, a second core would not be unnecessary: some plugins run on separate threads, and Java also consumes a fair amount of resources...

Therefore, for Minecraft-server it is better to choose a processor that has a higher single-core performance. A more powerful dual-core processor will be more preferable than a multi-core one with lower power. Specialized forums recommend using processors with a clock speed of no less than 3GHz.

For the proper functioning of a Minecraft server, a substantial amount of RAM is required. Bukkit uses approximately 1GB of RAM; furthermore, each player, as mentioned earlier, is allocated between 5 to 10 MB. Plugins and mods also consume quite a bit of memory. Thus, for a server accommodating 30 to 50 players, at least 4GB of RAM will be necessary.

In Minecraft, many factors (such as loading those same plugins) depend on the speed of the file system. Therefore, it is preferable to choose a server with an SSD. Spindle disks are unlikely to be suitable due to their low random read speed.

The speed of the internet connection is also of great importance. A 10 Mbps channel is sufficient for 40–50 players. However, for those planning a more expansive Minecraft project that includes a website, forum, and dynamic map, it is highly desirable to have a channel with greater bandwidth.

What specific configuration is best to choose? From the configurations we offer, we recommend considering the following:

  • Intel Core 2 Duo E8400 3GHz, 6GB RAM, 2×500GB SATA, 3000 rub/month;
  • Intel Core 2 Quad Q8300 2.5GHz, 6GB RAM, 2×500GB SATA, 3500 rub/month — we are using this configuration for our test Minecraft server, on which you can play right now (instructions on how to do so are provided below);
  • Intel Core i3-2120 3.3GHz, 8GB RAM, 2×500GB SATA, 3500 rub/month.

These configurations are quite suitable for creating a Minecraft server for 30-40 players. One downside is the absence of SSDs, but we offer another significant advantage: a guaranteed channel of 100 Mbps with no limitations or ratios. No installation fee is charged when ordering all the configurations listed above.

We also have more powerful, but naturally more expensive servers (an installation fee is also not charged for these configurations):

  • 2× Intel Xeon 5130, 2GHz, 8GB RAM, 4×160GB SATA, 5000 rub/month;
  • 2× Intel Xeon 5504, 2GHz, 12GB RAM, 3×1TB SATA, 9000 rub/month.

We also recommend considering a new budget model with an SSD based on the Intel Atom C2758 processor: Intel Atom C2758 2.4GHz, 16GB RAM, 2×240GB SSD, 4000 rub/month, with an installation fee of 3000 rub.

Installing and launching a Bukkit server on Ubuntu OS

Before installing the server, let's create a new user and add them to the sudo group:

$ sudo useradd -m -s /bin/bash 
$ sudo adduser  sudo

Next, let's set the password that the created user will use to connect to the server:

$ sudo passwd

We'll reconnect to the server with the new account and proceed with the installation.
Minecraft is written in Java, so it is essential to install the Java Runtime Environment on the server.

Let's update the list of available packages:

$ sudo apt-get update

Then execute the following command:

$ sudo apt-get install default-jdk

To install and run Bukkit, it is also advisable to set up a terminal multiplexer such as screen (other terminal multiplexers can also be used — see our review):

$ sudo apt-get install screen

Screen will be needed if we connect to the game server via ssh. It allows us to run the Minecraft server in a separate terminal window, and even after closing the ssh client, the server will continue to run.

Let's create a directory where the server files will be stored:

$ mkdir bukkit
$ cd bukkit

After that, we will go to the downloads page of the official Bukkit site. In the upper right corner of the page, you can see a link for the latest recommended server build. We advise downloading that one:

$ wget

Now let's start screen:

$ sudo screen

and execute the following command:

$ java -Xmx1024M -jar craftbukkit.jar -o false

Let's explain what the used parameters mean:

  • Xmx1024M — the maximum amount of RAM allocated to the server;
  • jar craftbukkit.jar — the key to the server;
  • o false — allows access to the server from pirate clients.

The server will be started.
You can stop the server by typing the command stop in the console.

Server Setup and Configuration

Server settings are stored in the configuration file server.properties. It contains the following parameters:

  • generator-settings — specifies the flat world generation template;
  • allow-nether — determines the ability to transition to the Nether world. By default, this parameter is set to true. If false is set, all players from the Nether will be moved to the normal world;
  • level-name — the name of the folder containing the map files that will be used during gameplay. The folder is placed in the same directory as the server files. If such a directory does not exist, the server automatically creates a new world and places it in a directory with the same name;
  • enable-query — when set to true, it activates the GameSpy4 protocol for the server to listen;
  • allow-flight — allows flying in the Minecraft world. By default, this is set to false (flying is not allowed);
  • server-port — specifies the port that will be used by the game server. The standard port for Minecraft is 25565. It is not recommended to change this parameter;
  • level-type — determines the type of world (DEFAULT/FLAT/LARGEBIOMES);
  • enable-rcon — opens remote access to the server console. By default, it is disabled (false);
  • level-seed — input for the level generator. To create random worlds, this field should be left empty;
  • force-gamemode — sets the default game mode for players connecting to the server;
  • server-ip — specifies the IP address that players will use to connect to the server;
  • max-build-height — specifies the maximum build height on the server. Its value must be a number that is a multiple of 16 (64, 96, 256, etc.);
  • spawn-npcs — allows (if set to true) or prevents (if set to false) the spawning of NPCs in villages;
  • white-list — enables and disables the use of a player whitelist on the server. If set to true, the administrator can manually add player usernames to the whitelist. If set to false, any user who knows the server's IP address and port can log in;
  • spawn-animals — allows the automatic spawning of friendly mobs if set to true;
  • snooper-enabled — allows the server to send statistics and data to developers;
  • hardcore — enables hardcore mode on the server;
  • texture-pack — the texture file that will be used when a player connects to the server. The value of this parameter should specify the name of the zip archive with textures, which is stored in the same directory as the server;
  • online mode – checks the premium accounts of users connecting to the server. If this parameter is set to true, only premium account holders can access the server. If account verification is disabled (set to false), any users (including, for instance, players with spoofed usernames) can enter the server, posing additional security risks. With verification turned off, you can play Minecraft over a local network without internet access;
  • pvp – allows or disallows players to fight each other. If this parameter is true, players can damage each other. If set to false, players cannot inflict direct damage to each other;
  • difficulty – sets the level of game difficulty. Can take values from 0 (easiest) to 3 (hardest);
  • gamemode – specifies which game mode will be set for players joining the server. Can take the following values: 0 – Survival, 1 – Creative, 2 – Adventure;
  • player-idle-timeout – the idle time (in minutes) after which players are automatically disconnected from the server;
  • max-players – the maximum allowable number of players on the server (from 0 to 999);
  • spawn-monsters – allows (if set to true) the spawning of hostile mobs;
  • generate-structures – enables (true) / disables (false) the generation of structures (mineshafts, fortresses, villages);
  • view-distance – controls the radius of loaded chunks sent to the player; can take values from 3 to 15.

Minecraft server logs are recorded in the server.log file. It is stored in the same folder as the server files. The log continually increases in size, taking up more and more disk space. You can organize the logging mechanism using a process called log rotation. A special utility called logrotate is used for rotation. It limits the number of entries in the log to a specific threshold.

You can configure log rotation so that all entries are removed as soon as the log file reaches a certain size. You can also set a time period after which all old entries will be considered irrelevant and deleted.

The main rotation settings are located in the file /etc/logrotate.conf; additionally, individual settings can be created for each application. Files with individual settings are stored in the directory /etc/logrotate.d.

Let's create a text file /etc/logrotate.d/craftbukkit and write the following parameters into it:

/home/craftbukkit/server.log {
  rotate 2
  weekly
  compress
  missingok
  notifempty
}

Let's take a closer look at their values:

  • The rotate parameter specifies the number of rotations before the file is deleted;
  • weekly indicates that rotation will occur weekly (other parameters can be set: monthly for monthly and daily for daily);
  • compress indicates that archived logs should be compressed (the opposite option is nocompress);
  • missingok indicates that processing should continue even if the log file is missing and no error messages should be displayed;
  • notifempty indicates not to rotate the log file if it is empty.

More details about log rotation settings can be found here.

Optimization Tips

Let’s clarify right away that this section will provide tips only related to optimizing the game server. Issues of fine-tuning and optimization of the server on which Minecraft is installed represent a separate topic, lying beyond the scope of this article; interested readers can easily find the necessary information online.

One of the most common problems encountered while playing Minecraft is what are known as lags — situations when the program does not respond to user input in a timely manner. These can be caused by issues on both the client side and the server side. Below we will provide recommendations to help reduce the likelihood of problems on the server side.

Regularly monitor memory usage by the server and plugins.

Memory consumption can be tracked using specialized administrative plugins — for example, LagMeter.

Keep an eye on plugin updates.

As a rule, developers of new plugins aim to reduce load with each new version.

Try to avoid using multiple plugins with similar functionality.

Large plugins (such as Essentials, AdminCMD, CommandBook) often include the functionality of many smaller plugins. For example, Essentials contains the features of the iConomy, uHome, OpenInv, VanishNoPacket, and Kit plugins. In most cases, smaller plugins whose functionality is fully covered by a large plugin can be removed to avoid overloading the server.

Limit the map and load it yourself

If the map is not limited, the load on the server will significantly increase. You can limit the map using the plugin WorldBorder. To do this, you need to start this plugin and execute the command /wb 200, then render the map using the command /wb fill.

Rendering will certainly take some time, but it's better to do it once while shutting down the server for maintenance. If each player renders the map, the server will operate slowly.

Replace heavy plugins with faster and less resource-intensive ones

Not all plugins for Minecraft can be considered successful: often they contain unnecessary features or consume a lot of memory. It's better to replace unsuccessful plugins with alternatives (there are quite a few). For example, you can replace the LWC plugin with Wgfix+MachineGuard, and the DynMap plugin with Minecraft Overviewer.

Always clean up drops or install a plugin for automatic drop removal

Drops in games are items that fall when a mob dies or when certain blocks are destroyed. Storing and processing drops consume a lot of system resources.

To make the server run faster, it's advisable to remove drops. This is best done using special plugins, such as NoLagg or McClean.

Do not use anti-cheat plugins

Game servers often install so-called anti-cheat programs that block attempts to manipulate the game unfairly.

There are anti-cheat plugins for Minecraft as well. Any anti-cheat server will always add extra load to the server. It's preferable to install protections for the launcher (which, however, do not provide absolute security guarantees and can be easily breached – but that's a topic for another discussion) and for the client.

In conclusion

Any instructions and recommendations are much more effective when backed up by concrete examples. Based on the installation instructions provided above, we created our own MineCraft server and placed something interesting on the map.

Here’s what we ended up with:

  • Bukkit Server – stable recommended version 1.6.4;
  • Statistics Plugin – to collect player statistics;
  • WorldBorder Plugin – to render and limit the map;
  • WorldGuard Plugin (+WorldEdit as a dependency) – to protect certain areas.

We invite everyone interested to play on it: to connect, add a new server and specify the address mncrft.slc.tl.

We would be happy if you share your own experiences in the comments regarding the installation, setup, and optimization of MineCraft servers, and tell us what mods and plugins interest you and why.

Great news: Starting August 1, the installation fee for dedicated servers with fixed configurations has been reduced by 50%. The one-time installation fee is now only 3000 rubles.

Readers who cannot leave comments here are invited to join us at blog.

Source: habr.com

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster