Please check out the official installation guide here: https://github.com/mark2devel/mark2/blob/master/INSTALL.md
- a
vswap
OpenVZ VPS or a KVM/Xen/VMware VPS with Ubuntu Server 14.04 LTS installed (architecture doesn't matter), or a dedicated server - patience and a willingness to learn
- approximately 10 minutes of time
You can skip this section, but here's some reasoning as for why I chose Ubuntu LTS for this guide:
- It combines the stability of Debian with support from the larger Ubuntu community
- The "milestone" release cycle helps maintain stability and support
- It has updated repositories and easy ways to install software not in them
- It has enterprise support and is easy for newbies to understand
- It has a sensible package manager (for installing software) and startup daemon
- It's fast, has sensible defaults, and is easy to set up Minecraft on
Note: This guide should work for Debian 7.
Note 2: For securing CentOS, follow this guide. You need to install python-pip
, which can be found in EPEL, and python-dev
, which should be in the standard repos.
Your host should have provided details for accessing your server via SSH.
- On Windows, you can use the free Putty SSH client to access your server.
- On a Unix-based OS (e.g. Mac OS X), you can use the SSH client in the terminal as such:
ssh <server address> -l <username, should be root for clean setups> -p <port>
Fill in the details on your respective client, and start the SSH session. You might see something about "the authenticity of the server can't be established", that's normal, and just input "y" or "yes". Now, input the password your host gave you (you won't see it in the client, that's convention). You can paste using the right mouse button on Putty, and otherwise, it depends on your terminal.
If your host didn't give you a root account, (OVH sometimes does this), you can skip this and "securing your server".
Once you're inside, you should see the Ubuntu message of the day, and a line on the bottom saying:
root@<machine hostname>:~$
That is the shell you will be using, and let's get this party started.
The root
account is the superuser of the system, and as such, you should not run non-administrative tasks using this account.
The first things we will be doing are:
- updating your server to the latest packages
- setting up a separate user account on your system for running your server
- disabling the root account, and enabling escalation via
sudo
To update your server, run the following two commands (press enter at each newline):
apt-get update
apt-get dist-upgrade
See, that wasn't too difficult. Next, we'll add an administrative user:
adduser <user name here>
For example, adduser minecraft
. After you've set and verified the password, you don't need to put any more information. Just keep on hitting enter.
Next, we'll be adding the new user to the administrative users list:
usermod -a -G sudo <user name here>
Now, exit your SSH session by running exit
, and follow "accessing your server", this time using the account you just created instead of root.
Once you've gotten into your new account, we need to test if it has root privileges. Run a sudo apt-get update
, input your password, and see if it runs. If it runs, you're on the right track, otherwise, go back a few steps and check your work.
Let's change our SSH login settings. First, let's install nano, the text editor (if it isn't already installed):
sudo apt-get install nano
Run nano
, and take a look. Ctrl+X
, then Y + Enter
closes and saves a file. A blank file isn't saved. Close nano
, and read on.
Now, let's remove some annoyances of nano:
sudo nano /etc/nanorc
Change set historylog
to #set historylog
, and save the file: Ctrl + X
, Y
, and Enter
. Next:
cd ~
sudo rm .nano_history
Now, we need to disable the root account, as we don't need it anymore, and it presents a security risk.
Run sudo passwd -dl root
, and now, we'll edit the SSHd configuration so that root
can't log in either:
sudo nano /etc/ssh/sshd_config
Find the line that says "PermitRootLogin", and change that to no
. Save the file, and then run:
sudo service ssh restart
You should preferably set up public key authentication for proper security, which is outside the scope of this tutorial. See this guide for more information on creating and using public keys.
Now, in case you don't like the spammy Ubuntu message of the day when you log in, you can do:
cd ~
touch .hushlogin
For future reference, ~
is your home directory (a.k.a. folder).
mark2 is a server wrapper with advanced monitoring, scripting, and multiuser capabilities that's point-and-click through the SSH session, and is easy to install on Ubuntu. Let's get started.
First of all, we need to install some dependencies:
sudo apt-get install python-dev libssl-dev python-pip git python-software-properties software-properties-common
We are done with the initial dependencies. Now, it's time to:
- Clone the mark2 repository
- Install mark2 requirements
- Link mark2 to an executable so you can easily run it
This is pretty straightforward, and don't worry if you don't understand the commands:
sudo git clone git://github.com/gsand/mark2.git /usr/local/share/mark2
cd /usr/local/share/mark2
sudo ln -s /usr/local/share/mark2/mark2 /usr/local/bin/mark2
sudo pip install -r /usr/local/share/mark2/requirements.txt
Congratulations! You have now set up mark2. Finally, let's download and install our Minecraft server running Spigot.
Obviously, we need to install Java first (we'll be installing Oracle Java 8):
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer oracle-java8-set-default
If you like your freedoms, or the Oracle installer isn't working for some reason, do:
sudo apt-get install openjdk-7-jre-headless
Next, let's get back to your home directory, and make a folder called spigot
:
cd ~
mkdir spigot
cd spigot
Upload your spigot-xxx-SNAPSHOT.jar
to this directory using your favorite SFTP/SCP client, or run the latest BuildTools on the server (only if your server has more than 1.5GB or so of RAM, otherwise run it locally and upload the JAR, or wget from a precompiled source (be careful)):
mkdir buildtools; cd buildtools
wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
java -jar BuildTools.jar
Wait for that process to complete, and spigot.jar should be in the buildtools
folder. Copy it to the spigot
folder:
cd ..
cp buildtools/spigot*.jar spigot/
Now, let's set up a blank mark2 configuration, so we can start the server:
sudo mkdir /etc/mark2
sudo touch /etc/mark2/mark2.properties
It's easier to use our own mark2.properties
instead of trawling thru the config.
We need to tell mark2 what to do, so:
cd spigot
nano mark2.properties
Paste this into nano
:
java.cli.X.ms=1024M
java.cli.X.mx=1024M
# Use whatever mark2 saved the JAR as here
mark2.jar-path=spigot*.jar
# Saving notifications aren't really useful
plugin.save.warn-message=
plugin.save.message=
# This helps stop GC hangs
java.cli.XX.UseConcMarkSweepGC=true
Save the file, and now, let's start the server:
mark2 start
You should see mark2 starting the server, and congratulations, you have set up a server with mark2. Connect to your Minecraft server using your VPS' address, and bask in the glory of having set up a Minecraft server.
To access your Minecraft console, run mark2 attach
. This is the standard mark2 console, and note that you can click on most things, and control the server that way.
Let's run some sample commands:
version
That gives you the Spigot version you're running. Now, run the following with the tilde to restart the MC server:
~restart
Now, exit mark2 by pressing Ctrl+C. You can reattach using mark2 attach
. You can run either ~stop
in the console or mark2 stop
to stop the MC server. This works for multiple logged on users without any additional configuration, unlike screen
or tmux
.
If you have multiple servers, you can click the server names at the top of the mark2 screen to switch to one of them.
If you're getting special accented characters for mark2, you need to force your SSH client to use UTF-8 encoding.
For Putty, you can go to Window > Translation, and set "received data" to UTF-8
. Restart Putty to see the changes.
This will be the final "tutorial" component, and will cover:
- Automatic restarts
- Periodic saves
- Starting mark2 automatically if your server restarts
mark2 has a powerful scripting mechanism. I recommend that you review it first before continuing, so that you gain a better understanding of the cron
syntax used in mark2 and Linux in general.
Now, let's create the scripts.txt
file:
cd ~
cd spigot
nano scripts.txt
Paste this in nano
, and adjust as necessary:
# Saves the map every 15 minutes
*/15 * * * * ~save
# Restarts Spigot every 24 hours
0 12 * * * ~restart 5s
Save the file, and stop mark2 by running either mark2 stop
or ~stop
in the console. Start mark2 by running mark2 start
.
If you wish to use Spigot's builtin /restart
command, put
#!/bin/sh
mark2 send -n ${PWD##*/} ~restart
in a file named start.sh
in your spigot
folder. Then, make it executable by running chmod +x start.sh
. Now, you can run /restart
in-game to restart your server.
Now, in case you need to restart your VPS, let's set it up so that mark2 starts your server automatically:
sudo nano /etc/crontab
Add this to the end, obviously customizing your server location and username:
@reboot <username> mark2 start /home/<username>/spigot
Save the file, and that should be covered. If you really need to test it, you can attempt to restart the server:
sudo reboot
This covers the general server setup using mark2. Sit back, relax, eat a sandwich, and play some Minecraft.
In case you're not feeling like using wget
and nano
to download plugins and edit configs, or want to easily transfer your existing server, any SCP/SFTP client will do.
WinSCP is a good choice for Windows, CyberDuck works quite well on OS X, and Filezilla is a nice cross-platform solution.
For these clients, just select SCP or SFTP, and use your SSH credentials. Use their respective documentations for usage.
Some plugins, such as Logblock, require an SQL server. Setting up a server that can be accessed only locally is as easy as:
sudo apt-get install mariadb-server
Input your preferred SQL password (preferably different from your server password), and we can create a database.
First, let's login to the MySQL shell:
mysql -u root -p
Type the password you set earlier, and now, inside the shell:
create database minecraft;
exit
That created a database called minecraft
, and exits the shell. SQL queries end with ;
.
Now, to use that database in a plugin, fill in the host as localhost
, username as root
, password as the one you set during the install, and database as minecraft
.
If you want to set up multiple SQL users, or access the database remotely, that is outside the scope of this tutorial. Please use Google for guides.
If you're migrating a server, and you can't connect after the migration, check that server-ip
in server.properties
is either blank or the IP you want it to bind to, and check your Votifier settings (this can cause connection failures).
If you really need a specific version of a JAR, or just want to download files directly, cd
into the directory you want to download to, and then:
wget <file location> -O <output name>
You might need to sudo apt-get install wget
, depending on your Ubuntu image.
For monitoring resource usage, you can run top
, and for monitoring memory usage, you can run free -m
.
Update your system using sudo apt-get update && sudo apt-get dist-upgrade
. Update mark2 using cd /usr/local/share/mark2 && git pull
.
Have fun!
You should review these sometime to learn more about Ubuntu, mark2, and Linux in general (assuming you already know how to administer Minecraft servers)
- Some useful Linux commands
- mark2 configuration samples
- mark2's readme and usage
- Why Linux isn't actually eating your RAM
- Intro to the Linux file system
<LaxWasHere> You could have just made a bash script. "Minecraft in 2 seconds."
<chiisana> 2 seconds*
<chiisana> *: actual time may vary depending on internet connection speed, and server installation time
<vemacs> Coming soon?!
why is my mark2 so ugly a lot of people have straight lines i have some x and q and that stuff http://prntscr.com/giszqr