Creating and setting up a Minecraft server

Creating and setting up a Minecraft server

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

Game developers deliberately focus on the best examples of twenty years ago, when many games by today's standards were primitive in terms of graphics and imperfect in terms of usability, but at the same time they were really 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 playing in multiplayer mode is carried out 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 clients, 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

The Minecraft game includes the following architectural elements:

  1. server - a program with which players interact with each other over a network;
  2. client - a program for connecting to the server, installed on the player's computer;
  3. plugins - additions to the server that add new features or extend 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 This is the official platform from the developers of the game. Distributed in both graphical and console versions. A new version of Vanilla always comes out at the same time as a new version of Minecraft.

Vanilla's downside is its excessive memory consumption (approximately 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 turned out to be quite successful: in terms of functionality, Bukkit is much wider than Vanilla - primarily due to the support for various mods and plugins. At the same time, it consumes less memory per player - about 5-10 MB.

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

In addition, other platforms have recently gained popularity (for example, Spout, MCPC and MCPC +), but they differ in limited compatibility with Vanilla and Bukkit and very limited support for mods (for example, you can only write mods for Spout from scratch). If they are used, then only for experiments.

To organize a game server, we recommend using the Bukkit platform, as it is the 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 great advantages: the Minecraft server core can use only one computation thread. The second core, however, will be useful: 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 single-core performance. A more powerful dual-core processor will be preferred over a less powerful multi-core processor. On specialized forums, it is recommended to use processors with a clock speed of at least 3 GHz.

A large amount of RAM is required for the normal functioning of the Minecraft server. Bukkit takes up approximately 1GB of RAM; in addition, for each player, as mentioned above, from 5 to 10 MB are allocated. Plugins and mods also consume quite a lot of memory. For a server with 30 - 50 players, you will therefore need at least 4 GB of RAM.

In Minecraft, a lot (for example, loading 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 be suitable due to the low random read speed.

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

What specific configuration is best to choose? From configurations we offer We recommend that you pay attention to the following:

  • Intel Core 2 Duo E8400 3GHz, 6GB RAM, 2x500GB SATA, 3000 rub/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 described below);
  • Intel Core i3-2120 3.3GHz, 8GB RAM, 2x500GB SATA, 3500 rub/month

These configurations are quite suitable for creating a Minecraft server for 30-40 players. Some disadvantage is the lack of SSD drives, but we give another important advantage: a guaranteed 100 Mb / s channel without any restrictions and ratios. When ordering all of the configurations listed above, the installation fee is not charged.

We also have more productive, but at the same time, of course, more expensive servers (when ordering these configurations, the setup payment is also not charged):

  • 2x Intel Xeon 5130, 2GHz, 8GB RAM, 4x160GB SATA, 5000 rub/month;
  • 2x IntelXeon 5504, 2GHz, 12GB RAM, 3Γ—1TB SATA, 9000 rub/month.

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

Installing and running the Bukkit server in Ubuntu OC

Before installing the server, let's create a new user and add it 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>

Reconnect to the server under a 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 run the following command:

$ sudo apt-get install default-jdk

To install and run Bukkit, it is also desirable to install a terminal multiplexer - for example, screen (other terminal multiplexers can be used - see our overview):

$ sudo apt-get installscreen

Screen will be 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.

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

$ mkdir bukkit $ cd bukkit

After that, let's go to Bukkit official website download page. In the upper right part of the page, you can see a link to the latest server build recommended for use (recommended build). We recommend downloading it:

$ wget <link to recommended version>

Now let's run screen:

$sudo screen

and run the following command:

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

Let's explain what the parameters used mean:

  • Xmx1024M - maximum amount of RAM per server;
  • jar craftbukkit.jar - key to the server;
  • o false - allows access to the server from pirated clients.

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

Setting up and configuring the server

The server settings are stored in the server.properties configuration file. It contains the following options:

  • generator-settings - sets the template for generating a super flat world;
  • allow-nether - determines the possibility of transition to the Nether. By default, this parameter is set to true. If set to false, then all players from the Nether will be moved to the normal;
  • level-name is the name of the map file folder 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 - when set to true, activates the GameSpy4 protocol to listen to the server;
  • allow-flight - Allows flights in the Minecraft world. The default value is false (no flights);
  • server-port - specifies the port that will be used by the game server. The default port for Minecraft is 25565. We do not recommend changing this setting;
  • level-type - defines the type of the world (DEFAUT/FLAT/LARGEBIOMES);
  • enable-rcon - opens remote access to the server console. It is disabled (false) by default;
  • level-seed - input for the level generator. To be able to create random worlds, this field must be left blank;
  • force-gamemode - sets the players connecting to the server to the standard game mode;
  • server-ip - specifies the IP address that will be used by players to connect to the server;
  • max-build-height - specifies the maximum height of a building on the server. Its value must be a multiple of 16 (64, 96, 256, etc.);
  • spawn-npcs - Allows (if set to true) or disables (if set to false) NPCs to spawn 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 whitelist by adding player nicknames to it manually. If the value is set to false, then any user who knows his IP address and port can access the server;
  • spawn-animals - Allows friendly mobs to spawn automatically if set to true)
  • snooper-enabled - allows the server to send statistics and data to developers;
  • hardcore - turns on the Hardcore mode on the server;
  • texture-pac is the texture file that will be used when the player connects 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 - enables checking the premium accounts of users connecting to the server. If this parameter is set to true, only premium account holders will be able to access the server. If account verification is disabled (set to false), then any users (including, for example, players who forged a nickname) can access the server, which creates additional security risks. With verification disabled, you can play Minecraft over a local network, without access to the Internet;
  • pvp - allows or forbids players to fight each other. If this parameter is set to 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. Can take values ​​from 0 (easiest) to 3 (most difficult);
  • 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 - idle time (in minutes), after which players are automatically disconnected from the server;
  • max-players - the maximum allowed 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 (treasuries, fortresses, villages);
  • view-distance - adjusts the radius of updated chunks to send 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 growing 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 entries in the log to a certain limit.

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

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

Create a text file /etc/logrotate.d/craftbukkit and enter the following parameters into it:

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

Let's consider their meanings in more detail:

  • the rotate parameter specifies the number of rotations before deleting the file;
  • weekly indicates that the rotation will be performed weekly (other parameters can be set: monthly - monthly and daily - daily);
  • compress specifies that the archived logs should be compressed (option is nocompress);
  • missingok specifies that in the absence of a log file, work should continue and no error messages should be displayed;
  • notifempty specifies not to shift the log file if it is empty.

You can read more about log rotation settings. here.

Optimization Tips

Immediately make a reservation that this section will provide tips related only to optimizing the game server. The issues of fine-tuning and optimizing the server on which Minecraft is installed are a separate topic that is beyond the scope of this article; interested readers can easily find the information they need on the Internet.

One of the most common problems that arise when playing Minecraft is the so-called lags - situations when the program does not respond to user input in time. 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 the memory consumption of the server and plugins

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

Stay tuned for plugin updates

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

Try not to use many plugins with similar functionality

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

Limit the map and download it yourself

If you do not limit the map, then the load on the server will increase significantly. You can limit the map using the plugin WorldBorder. To do this, you need to run this plugin and execute 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's better to do it once, closing the server for technical work. If each player draws the map, the server will work slowly.

Replace heavyweight plugins with faster and less resource intensive ones

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

Always clean the drop or install a plugin to automatically remove the drop

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

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

Don't 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 also 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 guarantee of safety and break easily - but this is a topic for a separate discussion) and for the client.

Instead of a conclusion

Any instructions and recommendations are much more effective if they are supported by concrete examples. Based on the installation instructions above, we created our own 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;
  • Plugin WorldBorder - to draw and limit the map;
  • WorldGuard plugin (+WorldEdit as a dependency) - to protect some areas.

We invite everyone to play on 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 of installing, configuring and optimizing MineCraft servers and tell us which mods and plugins you are interested in and why.

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

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

Source: habr.com

Add a comment