This article is outdated and may not work correctly for current operating systems or software.
This article assumes you have a Vultr VPS with 2 CPU and 2GB of ram. Please change any settings accordingly to your VPS type. This article also uses Minecraft 1.8, so please change accordingly if you wish to use something different.
You may want to install
screen by running the following command:
pkg install screen nano wget
Install OpenJDK 7 by running the following command:
pkg install java/openjdk7
Once it is done, run the following command to verify the installation of OpenJDK 7:
If you see the following, then you can proceed to the next step:
openjdk version "1.7.0_71" OpenJDK Runtime Environment (build 1.7.0_71-b14) OpenJDK 64-Bit Server VM (build 24.71-b01, mixed mode)
Run the following commands to download Minecraft:
cd ~ mkdir mcserver cd mcserver wget https://s3.amazonaws.com/Minecraft.Download/versions/1.8/minecraft_server.1.8.jar –no-check-certificate
Once it is downloaded, you will want to create a file called
eula.txt and populate it with
eula=true. This is applicable to any server after version 1.7.9. By creating this file, you agree with the Mojang EULA which can be found here.
Next, create a file called
startup.sh and populate it with the following:
java -Xmx1500M -Xms750M -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalPacing -XX:ParallelGCThreads=4 -XX:+AggressiveOpts -jar minecraft_server.1.8.jar nogui
Save the file and run the following command to start the server:
screen sh startup.sh
If all is successful, you will be able to connect to the IP address of your VPS with the Minecraft game client. You have just setup Minecraft on FreeBSD 10.
It is recommended to create a new user specifically for your server to make sure that the Minecraft server does not have root access. Giving a server or application root access poses a security risk. To create a new user, run
adduser and follow everything being prompted, but make sure that when it asks about the shell, to choose
nologin as a security measure for this user. Once completed, enter into your server directory and run the following command (Change "minecraft" with the username and group you have created):
chown -R minecraft:minecraft .
This will change the owner of the content of that directory to
minecraft. Next, run the following command to start the server:
screen su -m minecraft -c "sh startup.sh"
This will start your server as the user
minecraft. If everything is successful, the server will be running.