Create and configure a Minecraft server

  • Tutorial
Minecraft selectel

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

Game developers deliberately focus on the best examples of twenty years ago, when many games were primitive in terms of graphics and imperfect in terms of usability by today's standards, but at the same time they were truly exciting.

Like all sandbox games, Minecraft provides the user with great opportunities for creativity - this, in fact, is the main secret of its popularity.

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

There are many fans of this game among our customers, and they rent equipment for game projects in our data centers. In this article, we will talk about what technical points you need to pay attention to when choosing a server for
Minecraft.

Choose a platform


Minecraft includes the following architectural elements:
  1. server - a program with which players interact with each other over the network;
  2. client - a program for connecting to a server installed on a player’s computer;
  3. plugins - add-ons to the server, adding new features or expanding old ones;
  4. mods - additions to the game world (new blocks, items, features).


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

Vanilla is the official platform from the game’s developers. Distributed in both graphical and console versions. The new version of Vanilla always comes out at the same time as the new version of Minecraft.

Vanilla's disadvantage is excessive memory consumption (approximately 50 MB per player). Another significant drawback is the lack of plugins.

Bukkitwas created by a group of enthusiasts who attempted to improve the official Minecraft server. The attempt turned out to be quite successful: Bukkit is much wider in functionality than Vanilla - primarily due to the support of various mods and plugins. At the same time, it consumes less memory for each player - approximately 5-10 MB.

The downsides of Bukkit are that when it starts, it takes up too much RAM. In addition, the longer the server runs, the more memory it requires (even if there are few players). When choosing Bukkit as a server, it should be borne in mind that its new versions, as a rule, contain errors; The stable version usually appears about 2-3 weeks after the official release of Minecraft.

In addition, other platforms (e.g. Spout, MCPC and MCPC +) have recently gained popularity, but they are characterized by limited compatibility with Vanilla and Bukkit and extremely limited support for mods (for example, for Spout you can only write mods from scratch). If they are used, it is only for experimentation.

To organize a game server, we recommend using the Bukkit platform, since it is most flexible; in addition, under it there are many different mods and plugins. The stable operation of the Minecraft server largely depends on the correct choice of the hardware platform. Let's consider this question in more detail.

Hardware requirements


Both the server and the Minecraft client are very demanding on system resources.
When choosing a hardware platform, it should be borne in mind that a multi-core processor will not give big advantages: the Minecraft server core can use only one calculation stream. The second core, however, will not be out of place: some plugins are executed in separate threads, and Java also consumes a lot of resources ...

Therefore, for a Minecraft server it is better to choose a processor that has higher performance of one core. A more powerful dual-core processor will be preferable to a multi-core, but less powerful. In specialized forums, it is recommended to use processors with a clock frequency of at least 3 GHz.

Minecraft requires a large amount of RAM to function properly. Bukkit takes up approximately 1GB of RAM; in addition, for each player, as mentioned above, from 5 to 10 MB is allocated. Plugins and mods also consume quite a lot of memory. For a server with 30 to 50 players, this will require at least 4 GB of RAM.

In Minecraft, a lot (for example, downloading the same plugins) depends on the speed of the file system. Therefore, it is preferable to choose a server with an SSD drive. Spindle drives are unlikely to work because of the low random read speed.

Of great importance is the speed of the Internet connection. For a game of 40-50 people, the 10 Mb / s channel is enough. However, for those planning a larger minecraft project, including a website, forum and dynamic map, it is highly desirable to have a channel with higher bandwidth.

Which specific configuration is best to choose? Of the  configurations we offer, we recommend that you pay attention to the following:
  • Intel Core 2 Duo E8400 3GHz, 6GB RAM, 2 × 500GB SATA, 3000 rubles / month;
  • Intel Core 2 Quad Q8300 2.5GHz, 6GB RAM, 2 × 500GB SATA, 3500 rub / month - we use this configuration for our MineCraft test server, on which you can play right now (how to do this is written 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. Some disadvantage is the lack of SSDs, but we give another important advantage: a guaranteed channel of 100 Mb / s without any restrictions and ratios. When ordering all the above configurations, installation payment is not charged.

We have more productive, but at the same time, of course, more expensive servers (when ordering these configurations, the installation payment is also not charged):
  • 2x Intel Xeon 5130, 2GHz, 8GB RAM, 4 × 160GB SATA, 5000 rubles / month;
  • 2x IntelXeon 5504, 2GHz, 12GB RAM, 3 × 1TB SATA, 9000 rub / month

We also recommend that you pay attention to the new budget model with an SSD-drive based on the Intel Atom C2758 processor: Intel Atom C2758 2.4GHz, 16 GB RAM, 2 × 240GB SSD, 4000 rubles / month, installation payment - 3000 rubles.

Installing and starting the Bukkit server in Ubuntu OC


Before installing the server, create a new user and add him to the sudo group:
$ sudo useradd -m -s / bin / bash <username>
$ sudo adduser <username> sudo

Next, set the password under which the created user will connect to the server:
$ sudo passwd <username>

We will reconnect to the server under the new account and proceed with the installation.
Minecraft is written in Java, so the Java Runtime Environment must be installed on the server.

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 install a terminal multiplexer - for example, screen (you can use other terminal multiplexers - see our review ):
$ sudo apt-get install screen

Screen is needed if we connect to the game server via ssh. With it, it will be possible to launch the Minecraft server in a separate terminal window, and even after closing the ssh client, the server will work.

Create a directory where the server files will be stored:
$ mkdir bukkit
$ cd bukkit

After that, we’ll go to  the download page of the official Bukkit website . In the upper right part of the page you can see a link to the latest recommended build of the server (recommended build). We recommend downloading it:
$ wget <recommended version link>

Now run screen:
$ sudo screen

and execute the following command:
$ java -Xmx1024M -jar craftbukkit.jar -o false

Let us explain what the parameters used mean:
  • Xmx1024M - the maximum amount of RAM per server;
  • jar craftbukkit.jar - the key to the server;
  • o false - allows access to the server from pirated clients.


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

Server setup and configuration


Server settings are stored in the server.properties configuration file. It contains the following parameters:
  • generator-settings - sets the pattern for generating a super flat world;
  • allow-nether - defines the possibility of transition to the lower world. By default, this parameter is set to true. If set to false, then all players from the Lower World will be moved to normal;
  • level-name - the name of the folder with map files that will be used during the game. The folder is located in the same directory as the server files. If there is no such directory, the server automatically creates a new world and places it in a directory with the same name;
  • enable-query - if set to true, activates the GameSpy4 protocol to listen on the server;
  • allow-flight - allows flights around the world of Minecraft. The default value is false (flights are prohibited);
  • server-port - indicates the port that will be used by the game server. The default port for Minecraft is 25565. The value of this parameter is not recommended;
  • level-type - defines the type of world (DEFAUT / 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 be able to create random worlds, this field must be left blank;
  • force-gamemode - sets the standard game mode for players connecting to the server;
  • server-ip - indicates the IP address that players will use to connect to the server;
  • max-build-height - indicates the maximum build height on the server. Its value should be a multiple of 16 (64, 96, 256, etc.);
  • spawn-npcs - allows (if set to true) or prohibits (if set to false) the emergence of NPCs in villages;
  • white-list - enables and disables the use of a white list of players on the server. If set to true, then the administrator will be able to create a white list by adding player nicknames to it manually. If set to false, then any user who knows his IP address and port can enter the server;
  • spawn-animals - allows the appearance of friendly mobs if set to true);
  • snooper-enabled - allows the server to send statistics and data to developers;
  • hardcore - turns on Hardcore mode on the server;
  • texture-pac - texture file that will be used when connecting the player to the server. The value of this parameter is the name of the zip archive with textures, which is stored in the same directory as the server;
  • online-mode - includes checking premium accounts of users connecting to the server. If this parameter is set to true, but only premium account owners can access the server. If account verification is disabled (set to false), then any users (including, for example, players who have forged a nickname) can log into the server, which creates additional security risks. If the scan is disabled, you can play Minecraft on a local network, without access to the Internet;
  • pvp - allows or forbids players to fight with each other. If this parameter is true, then players can destroy each other. If set to false, then players cannot deal direct damage to each other;
  • difficulty - sets the difficulty level of the game. It can take values ​​from 0 (the easiest) to 3 (the most complex);
  • gamemode - indicates which game mode will be set for players entering the server. It can take the following values: 0 - Survival, 1-Creative, 2-Adventure;
  • player-idle-timeout - idle time (in minutes), after which the players automatically disconnect 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 generation of hostile mobs;
  • generate-structures - enables (true) / disables (false) the generation of structures (treasuries, fortresses, villages);
  • view-distance - adjusts the radius of the updated chunks for sending to the player; can take values ​​from 3 to 15.


Minecraft server logs are written to the server.log file. It is stored in the same folder as the server files. The log is constantly increasing in size, taking up more and more disk space. You can streamline the operation of the logging mechanism using the so-called log rotation. For rotation, a special utility is used - logrotate. It limits the number of log entries to a specific limit.

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

The basic rotation settings are in the /etc/logrotate.conf file; in addition, for each application, you can create individual settings. Files with individual settings are stored in the /etc/logrotate.d directory.

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
}

Consider their values ​​in more detail:
  • the rotate parameter indicates the number of rotations before deleting the file;
  • weekly indicates that the rotation will be performed weekly (you can set other parameters: monthly - monthly and daily - daily);
  • compress indicates that archived logs should be compressed (the reverse option is nocompress);
  • missingok indicates that if there is no log file, you need to continue working and not display error messages;
  • notifempty instructs not to move the log file if it is empty.

You can read more about log rotation settings here .

Optimization Tips


Immediately make a reservation that in this section tips will be given regarding only the optimization of the game server. Questions of fine tuning and optimizing the server on which Minecraft is installed represent a separate topic that is beyond the scope of this article; interested readers can easily find the information they need online.

One of the most common problems that arise when playing Minecraft is the so-called lags - situations where the program does not respond on time to user input. They can be caused by problems both on the client side and on the server side. Below we will give recommendations that will help reduce the likelihood of problems on the server side.

Regularly monitor memory consumption by the server and plugins


Memory consumption can be monitored using specialized administrative plugins - for example, LagMeter .

Stay tuned for plugins


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

Try not to use many plugins with similar functionality.


Large plugins (e.g. Essentials, AdminCMD, CommandBook) very often include the functionality of many small plugins. For example, the same Essential contains the functions of the plugins iConomy, uHome, OpenInv, VanishNoPacket, Kit. Small plugins, the functionality of which is fully covered by the functionality of one large one, can be removed in most cases so as not to overload the server.

Limit the map and upload it yourself


If you do not limit the card, then the load on the server will increase significantly. You can limit the map using the WorldBorder plugin . To do this, run this plugin and run the / wb 200 command, and then draw the map using the / wb fill command.

Drawing, of course, will take a lot of time, but it is better to do this once, closing the server for technical work. If each player draws a map, the server will work slowly.

Replace heavyweight plugins with faster and less resource intensive ones


Not all plugins for Minecraft can be called successful: they often contain many unnecessary and unnecessary functions, and sometimes also consume a lot of memory. Unsuccessful plugins are best replaced with alternative ones (there are quite a lot of them). For example, you can replace the LWC plugin with Wgfix + MachineGuard, and the DynMap plugin with Minecraft Overviewer.

Always clear the drop or install the plugin to automatically remove the drop


Drop in games are objects that drop out when a mob dies or some blocks are destroyed. Storage and processing of drops take up a lot of system resources.

To make the server work faster, it is advisable to delete the drop. This is best done using special plugins - for example, NoLagg or McClean.

Do not use anti-cheats


So-called anti-cheats are often installed on game servers - programs that block attempts to influence the game in dishonest ways.

There are anti-cheats for Minecraft. Any anti-cheat is always an additional load on the server. It is preferable to install protections for the launcher (which, however, do not give an absolute security guarantee and break easily - but this is already a topic for another discussion) and for the client.

Instead of a conclusion


Any instructions and recommendations are much more effective if they are supported by specific examples. Based on the installation instructions above, we created our MineCraft server and put something interesting on the map.

Here's what we got:
  • Bukkit Server - stable recommended version 1.6.4;
  • Statistics plugin - to collect statistics about players;
  • WorldBorder plugin - to draw and limit the map;
  • WorldGuard plugin (+ WorldEdit as a dependency) - to protect some areas.


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

We will be glad if in the comments you share your own experience in installing, configuring and optimizing MineCraft servers and tell us which mods and plugins are of interest to you and why.

Cool news: Starting August 1, the installation payment to dedicated fixed-configuration servers has been reduced by 50%. Now a one-time installation payment is only 3000 rubles.

Readers who cannot post comments here are welcome to join us on the blog .

Also popular now: