While it’s easy enough to share a Minecraft map with other local players on your network, it’s nice to be able to run a dedicated server so people can come and go without the original game host loading up Minecraft. Today we’re looking at how to run a simple local Minecraft server both with and without mods.
Why Run a Minecraft Server?
One of the most frustrating elements of the Minecraft local multiplayer experience (both for the PC and the PE edition) is that the original game host has to be active to access previous creations. If there are two parents and two kids playing Minecraft in a household for example, and they spend a few hours one weekend working on a big structure hosted by Kid #2, then anytime anyone wants to work on that world/structure again they need Kid #2 to fire up their game and share it with everyone else by opening it to the LAN. Factor in that each world resides on each separate computer and suddenly it becomes a real hassle for more than one person to work on a given map.
A much more efficient way to go about doing things is to host a stand-alone server on the local network. This way players can come and go as they please without any one person needing to log in and share their world. Even better, you can host a Minecraft server on a machine that isn’t well suited for actually playing Minecraft (we’ve run modest Minecraft servers off little Raspberry Pi boxes without a problem).
Let’s take a look at how to setup a basic local Minecraft server both with and without mods.
Setting Up a Simple Vanilla Minecraft Server
There are two ways to approach installing the simple vanilla Mojang-supplied Minecraft server. One method is very Windows-centric as you simply download an .EXE file and run it, with a convenient little graphical user window. That method doesn’t necessarily help OS X and Linux users however, so we’re going to use the .JAR based method which will help expand the process across all the platforms with only very minor tweaks necessary to shift between operating systems.
The first order of business is to download the official Minecraft server JAR file. As of this tutorial the version is 1.7.10. You can find it at the bottom of the official Minecraft.net download page. Regardless of your operating system, you want the .JAR file.
After the file has finished downloading, move the .JAR file to a more permanent location. We placed the file in a /HTG Test Server/. You can place it anywhere you want but label it clearly, place it somewhere safe, and be aware that once you run the .JAR file all the server-related stuff will be downloaded/unpacked in folder the .JAR is located in, so don’t place it somewhere like a drive root or a home folder.
Execute the server for the first time by running the following command at the command prompt from the directory the .JAR file is located in, of course:
Windows: java -Xmx1024M -Xms1024M -jar minecraft_server.1.7.10.jar nogui
OS X: java -Xms1G -Xmx1G -jar minecraft_server. 1.7.10.jar nogui
Linux: java -Xms1G -Xmx1G -jar minecraft_server. 1.7.10.jar nogui
The above commands will execute the Minecraft server JAR file. The command runs Java, assigns 1GB of memory/1GB max, indicates the file is a JAR, names the JAR, and indicates no GUI is needed. You can adjust the assigned/max memory values upwards if you find you need to do so for particularly large worlds or servers with many players (say, during a LAN party), but we don’t recommend lowering the memory values.
If you need help installing Java on Linux, creating a shortcut for the launch process on OS X, or any other OS specific issue, we’d encourage you to check out the detailed guide to launching the server JAR file located on the official Minecraft wiki.
The first time you run the server, you’ll see a message like the following:
[Server thread/INFO]: Starting minecraft server version 1.7.10
[Server thread/INFO]: Loading properties
[Server thread/WARN]: server.properties does not exist
[Server thread/INFO]: Generating new properties file
[Server thread/WARN]: Failed to load eula.txt
[Server thread/INFO]: You need to agree to the EULA in order to run the server. Go to eula.txt for more info.
[Server thread/INFO]: Stopping server
This is perfectly normal. Look in the server directory for the EULA.txt file, open it, and edit the entry “eula=false” to “eula=true” to indicate your agreement with the Mojang server user agreement. Save and close the document. Run the server command again. You can run it with or without the “nogui” tag depending on your needs/desire. If you run it with the “nogui” tag, the server output and command interface will remain in the terminal window you launched the command in:
If you remove the “nogui” tag, a GUI window will open and provide a cleaner and easier to manage server experience:
The GUI interface shows you exactly what you would see in the terminal window in the large right-hand pane, as well as a stats window in the upper-left and a list of currently logged-in players in the lower-right. Unless you’re running the server on a resource strapped machine (or a headless device like a media server or Raspberry Pi) we recommend using the GUI.
During the second run of the server, after you accepted the EULA, additional files are downloaded and the default world is generated. The default world is located in /world/ and looks a whole lot like a regular old /.minecraft/saves/[someworldname]/ folder from regular Minecraft (in fact, it is). You can play on the randomly generated world or you can delete the contents of /world/ and replace it with the contents of a saved game from a standalone copy of Minecraft or a world save you’ve downloaded from the Internet.
Let’s join our freshly minted server and see how it looks. In order to join your game you need to be on the same LAN as the host computer and you need to know the IP address of the host computer.
With the IP address in hand, fire up Minecraft, click on Multiplayer from the main menu and add the new server or use the direct connect feature. If you need help with either of these options, see Connecting to Remote Servers section of the Exploring Minecraft Multiplayer Servers lesson from our previous guide.
Here we are on the brand new server. Everything looks great and the world is loading smoothly. One thing you’ll note immediately is that the game is in survival mode. This is the server default, but we’ll show you how to change it in just a moment.
On the server side of things, you’ll see a stream of notices in the console window as things happen on it: players joining, players dying, player communications, and other notices. In addition you can use server commands both in the console window and if you are an OP or “operator” on the server. There are dozens of commands, many of them rather obscure and infrequently used. You can read the entire command list on the Minecraft wiki, but we’ll highlight the ones most relevant to getting your server up and running in the table below.
Note: if you enter the command in the server console window you don’t need the leading “/” but you do if you enter it in the chat window as a player on the server.
|/defaultgamemode [s/c/a]||Switches the server’s default mode for new players between Survival, Creative, and Adventure modes.|
|/difficulty [p/e/n/h]||Switches the difficulty levels between Peaceful, Easy, Normal, and Hard.|
|/gamemode [s/c/a] [player]||The same as /defaultgamemode except applied on a player-by-player basis.|
|/list||Lists all the current players.|
|/(de)op [player]/deop [player]||Gives named player operator privileges (or takes them away).|
|/save-(all/on/off)||“all” immediately saves the world, “on” turns world saving on (this is the default state), and “off” turns automatic saving off. Best to leave this alone unless you wish to force an immediate save to backup your work with the /save-all command.|
|/setworldspawn [ x y z ]||Sets the spawn point for all players entering the world. With no coordinates, it sets the spot the executing operating is standing on, with arguments it assigns the spawn point to those coordinates.|
|/spawnpoint [player] [ x y z]||The same as worldspawn, but for individual players; allows you to set a unique spawnpoint for each player.|
|/stop||Shuts the server down.|
|/time set [value]||Changes the in-game time; will accept “day”, “night” or a value from 0 to 24000 wherein, for reference, 6000 is noon and 18000 is midnight.|
|/tp [target player] [destination]||Teleports player. First argument must always be the target player. The second argument can be another player (send player A to B) or x/y/z coordinates (send player A to location).|
|/weather [clear/rain/thunder]||Changes the weather. Additionally, you can add a second argument to change the weather for X number of seconds (where X can be between 1 and 1,000,00).|
These are the most immediately useful commands for running a small home server. There are additional commands that are useful if you open up your home server for public or semi-public use (such as /kick and /ban) but which are typically unnecessary for private home use.
Now that we’ve successfully launched our private home server, you might be wondering (especially after all the lessons devoted to them) how we can inject some awesome mods into our server. Next stop, server modding.
Setting Up a Simple Modded Minecraft Server
Just like you can easily inject Forge mod loader into a standalone Minecraft installation you can easily inject Forge mod loader into the Minecraft server.
You can reuse the same installer you used for Forge in the previous modding tutorial; simply rerun it (it doesn’t matter if you’re using the .EXE or the .JAR) and adjust the settings as such:
Select “Install server” and point it at a fresh directory. You don’t need to install a server and then install Forge, like you need to install Minecraft and then install Forge like we did in the client-side tutorial.
Note: If you jumped down to this section because you were so excited about mods on your server, we’ll still encourage you to read the previous section as several of the steps are identical, and we’re not repeating them all in detail for this portion of the tutorial.
Give it a minute to download both the server and Forge files, then visit the installation folder. The next steps will look a whole lot like the vanilla Minecraft server setup.
Within the folder, run the “forge.*.universal.jar” file using the exact same command you used, based on your operating system from the vanilla installation portion of this tutorial.
The server will run and then halt, indicating as it did in the previous section that you need to accept the EULA. Open up the freshly created EULA.txt and edit the “false” to “true” just like last time.
Run the server again to confirm everything is installed correctly and just for extra good measure, join the world. Remember, when you join the world you’ll need to join with a modified client (vanilla clients can’t join modded servers). Join a matching version number installation of Minecraft with Forge installed, but without any mods loaded, which will mirror the state of the server.
Everything looks good. We even spawned near a village, which is always fun. Let’s show these villagers how to party by spawning a portal to a magical dimension.
No deal; we just threw a diamond in a puddle and all the villagers are staring at us like we’ve lost our mind. We might have Forge installed, but we’re missing the component that makes the magic happen: the Twilight Forest mod.
Now that we know Forge is installed properly, the next step is to install the mods we want. The process is very simple. You just need to make sure that the mod .JAR file (in this case, the Twilight Forest mod) is located in both the /mods/ folder for your new Forge server and the /mods/ folder for the Minecraft client you’re joining the server with.
Quit your Minecraft client and stop the server with the “stop” command, copy the files, and restart the server. Then, restart your client and join the server.
Words cannot express the disappointment we felt when the villager fell in the freshly spawned Twilight Forest portal and failed to teleport to the Forest. We’ll have to go in his stead.
The portal ended up being right next to a castle. Seriously, this could be the luckiest map seed ever: we started next to a village in the Overworld, made a portal a there, and ended up next to a castle in the Twilight Forest (if you’re playing with Twilight Forest on 1.7.10 (or other 1.7.* versions) the seed is: 1065072168895676632)!
Extra Tweaks and Tricks for Your Server
At this point you’re ready to rock, either with or without mods depending on which flavor you installed. That doesn’t mean, however, you’re done tinkering with your server. Let’s go over a few extra things you can do to improve your server experience.
You can always install more mods. Keep in mind that more mods require more CPU/GPU/RAM resources. Make careful note of the mods you do install, because everyone that joins your server will need to have those mods installed too. Generally speaking the /mod/ folder of the client and the/mod/ folder of the server should be mirrors of each other.
Need ideas for good server mods? Hit up the resources listed in the “Where to Find Mods?” section of our Minecraft modding tutorial.
Opening Your Server to Remote Players
If you want to play with people outside your local network you can set up port forwarding so players outside your home network can access the server. Most home broadband connections can easily support many players. Because the server doesn’t have a password system, you may want to consider creating a whitelist on the server. Use the command and parameters /whitelist [on/off/list/add/remove/reload] [playername] to adjust and view the whitelist.
Fine Tuning with Server.Properties
Inside the server folder you’ll find a file named server.properties. If you open this file in a text editor you’ll find a simple configuration file that can be manually edited. While some of these settings are available via server/in-game commands, many of them are not.
Using simple true/false or numerical toggles it’s possible to allow players to fly during survival mode, turn off The Nether, adjust server timeout settings, and a host of other variables. While many of the settings are fairly self-explanatory, a few require a more in-depth understanding of the variable involved. Check out this detailed breakdown of the server.properties variables.
Armed with a server, modded or otherwise, you now no longer have to worry about making sure the right person is online at the right time in order to access your world (and you can easily share your world across your entire household or with friends across the country).