How to Install Minecraft on a VPS?
Do you wish to experience adventure, survival and creativity by building a Minecraft server of your own? The game can easily be set up with a few commands on a VPS.
The following guidelines for set up might be specific for CentOS cPanel servers. However, they can be applied to non cPanel servers too. Also, the below tutorial is keeping in mind that you have worked on your server's command line using SSH. If not, it would help to brush up a few facts.
Additionally, it must be noted that purchasing and installation of standalone Minecraft launcher is not included in the tutorial.
The guidelines are as follows -
Java installation
Since the game, Minecraft, is Java based, the language needs to be installed. Java can run on Tomcat, which is offered by cPanel. But it is better to install it through the command line. Access to server at root level is needed for the installation.
Either java-1.7.0-openjdk or java -1.6.0-openjdk can be installed once you have entered server as root.
yum install java-1.7.0-openjdk
If you prefer, you can substitute with java-1.6.0-openjdk in the yum install command.
Server configuration
The next step involves preparing for the game. These include going to the account where you wish to host Minecraft and use commands to create a Minecraft directory.
mkdir -p /home/account/Minecraft
(Here /account/ refers to name of the account where you want to install Minecraft.)
cd /home/account/Minecraft
Downloading and starting the game
a. The game can be downloaded using the command line -
wget https://s3.amazonaws.com/Minecraft.Download/versions/1.7.2/minecraft_server.1.7.2.jar
b. The file is renamed as follows -
mv minecraft_server.1.7.2.jar minecraft_server.jar
c. Minecraft started in java -
java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
The version of java here is 1.7.2, however with future versions too the process remains the same.
Re-launching Minecraft
The command prompt will roll text indicating starting of the game and generation of the world, confirming that the game has been installed successfully. However before logging in and starting to mine and craft, a few things need to be done. The first is to stop the server of Minecraft and restarting it in a screen. This enables logging out of VPS without having to stop the game.
stop
screen
java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
This above command ensures that Minecraft is running within a screen. Thus the server can be exited without ending the game. This can be done by screen detachment -
[ctrl] + a
[ctrl] + d
If this is successfully done, a message [detached] is received.
If you wish to keep the default settings the same, the work is done, leaving you to play uninterrupted. However, if you wish to change settings then refer to the following guideline.
Minecraft configuration
If you wish, enter the Minecraft set-up deeper, the IP for the server can be added along with name for your world or a message for the day.
Configuration changes can be made by stopping the game and reattaching the screen-
screen -r
stop
Next, you might wish to edit the server.properties file as well as the opts.txt file. Here it must be noted that to edit files via cPanel or FTP, their respective permissions need to be changed using -
chown -R account:account /home/account/Minecraft
The administrator powers in the game are controlled by the ops.txt. Thus, those accounts that you want to add administrator power to must be added in that file. The game options and settings are in the big file server. properties. file. Settings such as those below can be changed:
level-name=ServInt
server-type=LARGEBIOMES
server-ip=207.58.132.171
pvp=false
motd=Welcome to Minecraft
Various other options can be set, such as setting game modes or nether and level-seed that generates a specific map of Minecraft.
The next advisable step post configuring the server is to create init script. This aids easy restart of the game on boot. The init script must be edited and placed in /etc/init.d/, otherwise it won't work with a copy and paste. The fields required to be edited are:
USERNAME=
WORLD=
MCPATH=
The cPanel account where the game is installed will be in the USERNAME field. The name of the directory or world is in WORLD and the place of Minecraft installation is MACPATH. It is like /home/account/Minecraft. The game can then be started, stopped, restarted and set to start on booting using following two commands:
/etc/init.d/minecraft restart
chkconfig minecraft on
Your work can be checked using the command -chkconfig --list.
Post this the server backup can be started, letting you log in to play the game.
Then you can start the server back up and log in to the game.