MineOS on Ubuntu
While MineOS has historically been released as a full, self-contained and configured distribution, the core value of MineOS has typically aimed at Minecraft-related automation, rather than the OS-side; that is, the web-ui and the python scripts.
MineOS Microcore and MineOS CRUX always did come fully configured with regard to the OS (iptables, partitioning, formatting, etc), but the CRUX model in itself laid the kernel building responsibility to the end user. To make CRUX viable as a novice-friendly distribution, I created the kernel for the ultimate end-user, selecting particular hardware based on likeliness of use and usefulness in dedicated server scenarios. Unfortunately, as MineOS grew in popularity, a greater variety of hardware needed to be used than I could satisfactorily anticipate and include in the pre-built kernel provided on the ISO.
MineOS-on-Ubuntu addresses this. By effectively outsourcing the kernel-building process to a far more established and knowledgeable community, I can wield the hugely optimized kernel Ubuntu distributes for their Server suite and focus on the scripts' and web-ui's usability, extensibility, and functionality.
These steps will take a stock-install of Ubuntu server and guide the user in the steps necessary to fully take advantage of MineOS python scripts and web interface. For all intent and purposes, the end result will be strongly comparable to an installed MineOS CRUX installation, with a few pluses and minuses.
- + Wider driver support built-in, OS update automation
- + More heavily documented distribution, more novice-friendly packaging system
- + Larger distribution-community
- - Shields the user from much education that CRUX inherently encourages
- - Higher memory footprint
- - Requires user upfront to do setup tasks
In the end, both approaches will help you successfully learn to be a system administrator of a Minecraft game server. I hope this helps!
The instructions provided here are for archival purposes only. While this writeup is still technically accurate, the old web-ui scripts/hiawatha config are no longer available online (nor per request) as all MineOS development is now exclusively in 0.6.x
Install Ubuntu using the ISO of your choice (x86/x64, LTS/standard) from Ubuntu Server's Website.
From here out, the instructions assume you are using x64. If you wish to use x86, you will need to use the alternate URL for the Hiawatha and Java packages. The URL is provided in each's respective section.
In addition, be sure to install LAMP (linux-apache-mysql-php); Apache will be removed in favor of Hiawatha, but MySQL and PHP will be kept and their configuration/installation will be much easier this way.
Logging in as root
Once Ubuntu is installed, log into the terminal using PuTTY as your newly-created (non-mc) username:
login as: will firstname.lastname@example.org password: Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-generic x86_64) [...] Last login: Sun Nov 18 20:04:12 2012 will@mineos-ubuntu:~$
Next, set the password for linux root and switch to root:
will@mineos-ubuntu:~$ sudo passwd root [sudo] password for will: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully will@mineos-ubuntu:~$ su - Password: root@mineos-ubuntu:~#
Creating the mc user
root@mineos-ubuntu:~# useradd -m -N -s /bin/bash mc root@mineos-ubuntu:~# passwd mc Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully root@mineos-ubuntu:~#
Installing required software
Removing Apache from the startup services
update-rc.d -f apache2 remove /etc/init.d/apache2 stop
Removing any system startup links for /etc/init.d/apache2 ... /etc/rc0.d/K09apache2 /etc/rc1.d/K09apache2 /etc/rc2.d/S91apache2 /etc/rc3.d/S91apache2 /etc/rc4.d/S91apache2 /etc/rc5.d/S91apache2 /etc/rc6.d/K09apache2
Update apt-get repos
Depending on your install media and options, screen may already be installed. If apt-get reports it is installed and up to date, this step can be safely ignored.
apt-get install screen
Install Hiawatha webserver
apt-get install libxslt1.1
mkdir /usr/src/hiawatha cd /usr/src/hiawatha wget http://files.tuxhelp.org/hiawatha/hiawatha_9.2_amd64.debdpkg -i hiawatha_9.2_amd64.deb
For x86 installations, use this url instead: http://files.tuxhelp.org/hiawatha/hiawatha_9.2_i686.deb
As new versions come out relatively frequently, you may instead opt to download from the Official Hiawatha Website.
If an error occurs:
root@mineos-ubuntu:/usr/src/hiawatha# dpkg -i hiawatha_9.2_amd64.deb Selecting previously unselected package hiawatha. (Reading database ... 49886 files and directories currently installed.) Unpacking hiawatha (from hiawatha_9.2_amd64.deb) ... Setting up hiawatha (9.2) ... Starting webserver: Error binding 0.0.0.0:80 error! Processing triggers for man-db ... Processing triggers for ureadahead ... ureadahead will be reprofiled on next reboot root@mineos-ubuntu:/usr/src/hiawatha#
This error occurs because port :80 is still bound to the running Apache2 daemon. You will only see this error if you did not stop the Apache service in the above step. However, it is not a problematic error and you can remedy it by restarting the server or stopping the Apache service as demonstrated above. You will not need to re-install the package and can continue the steps normally.
apt-get -y install rdiff-backup
There is more than one method to install Java.
The first method Installing using recommended Oracle-packaged binaries is for the admin who would like to maintain more than one version of Java. That is, each java version is stored in its own separate directory, allowing the admin to use any version at any time, simply by editing server.config.
The second method, Using Ubuntu-packaged binaries will update to the latest Java version that Ubuntu has prescribed for usage in the stable tree. This may not always be the latest possible version available, but it will be the Ubuntu-supported version, and future apt-get updates will overwrite this version with the most recent, Ubuntu-supported version.
Installing using recommended Oracle-packaged binaries
mkdir /usr/src/java cd /usr/src/java wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/7u15-b03/jre-7u15-linux-x64.tar.gz" tar -xf jre-7u15-linux-x64.tar.gz mv jre1.7.0_15 /usr/java/ln -s /usr/java/jre1.7.0_15/bin /usr/java/java-latest
Available URLs depending on system architecture:
Note, the reason for the --no-cookies --header [...] is because Java's filehosting servers require a cookie to be accepted to show acceptance of the terms and usage policy. If you do not agree to Oracle's terms and usage policy, you should not download Oracle Java7 and instead use the OpenJDK.
Using Ubuntu-packaged binaries (OpenJDK)
apt-get install openjdk-7-jre ln -s /usr/lib/jvm/java-1.7.0-openjdk-i386/bin/java /usr/java/java-latest
Using Third-Party Repositories (SunJDK)
There are third-party repositories which will allow apt-get to download and install the SunJDK (as an alternative to installing it via the official released binaries). These methods work, but are not documented here due to their unofficial nature. You can easily find instructions for "installing oracle java 7 ubuntu" on Google. After, it is essential you create the symlink manually and test java as normal below.
When installed, you can test java works by checking its version:
root@mineos-ubuntu:/usr/java# /usr/java/java-latest/java -version java version "1.7.0_09" Java(TM) SE Runtime Environment (build 1.7.0_09-b05) Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode) root@mineos-ubuntu:/usr/java#
Be sure to test java, as shown above.
If this doesn't work, MineOS won't know where Java is and MineOS won't start up your server.
Your command-line results should indicate the java version, else the symlink is either incorrect or you did not install java properly. In the web-ui, 'Error 32512' (command not found) will appear. This error may also appear if screen is not installed.
The following segments are directed toward shaping Ubuntu server to work with MineOS' python scripts. Be sure to take special note of which user should be committing which actions.
Creating MineOS file structure
Create directories and establish mc ownership.
mkdir -p /var/www/hiawatha/admin/cgi-bin chown -R mc /usr/games/minecraft chown -R mc /var/www/hiawathaln -s /usr/games/minecraft/server.py /var/www/hiawatha/admin/cgi-bin/server.py
Download python scripts and web-ui.
rsync -r rsync://email@example.com/stable_webui /var/www/hiawatha/admin
rsync -r rsync://firstname.lastname@example.org/stable_scripts /usr/games/minecraft/ chmod +x /usr/games/minecraft/*.pychmod +x /usr/games/minecraft/*.sh
Configuring Hiawatha Webserver
mv hiawatha.conf hiawatha.conf.backup wget http://minecraft.codeemo.com/files/ubuntu/hiawatha.confservice hiawatha restart
Configuring iptables (firewall)
Secure all inbound ports and allow ports 22 (SSH), 80 (HTTP) and 25565 (Minecraft). For more information, see Iptables.
iptables -P INPUT ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT iptables -A INPUT -p tcp -m tcp --dport 25565 -j ACCEPT iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -P INPUT DROPiptables-save > /etc/iptables-rules
Add in the following contents. Press [escape]:wq [enter] to save and quit.
#minute hour mday month wday command # 0 * * * * cd /usr/games/minecraft; ./mineos_console.py crontab backup hourly 0 * * * * cd /usr/games/minecraft; ./mineos_console.py crontab archive hourly 0 0 * * * cd /usr/games/minecraft; ./mineos_console.py crontab backup daily 0 0 * * * cd /usr/games/minecraft; ./mineos_console.py crontab archive daily 0 0 * * 0 cd /usr/games/minecraft; ./mineos_console.py crontab backup weekly 0 0 * * 0 cd /usr/games/minecraft; ./mineos_console.py crontab archive weekly
That's it! The python scripts and web-ui are installed. You can now visit your IP in your browser and fully control MineOS-on-Ubuntu!