MineOS-on-FreeBSD

From MineOS Wiki
Jump to navigation Jump to search

Modern Webui Installation Instructions

The instructions below are for a previous iteration of the web user interface and are outdated. For updated instructions, follow the instructions here: installing MineOS on FreeBSD

MineOS on FreeBSD

FreeBSD--unlike the other platforms MineOS is distributed or installed on--is a full operating system, rather than just a kernel and userland combination, as Linux is (i.e., GNU/Linux). (Free)BSD has a rich history and mature codebase, making it arguably the most stable and dependable Unix-like operating system available.

As its own OS rather than a distribution, the utilities and software that run on it are tightly regulated and upkept by the FreeBSD foundation, ensuring its security and stability. Being UNIX, rather than LINUX, many commands familiar to Linux users may not be available, but certainly will always have a comparable--if not more elegant, but also more strict--variation. Again, being UNIX, there are Pros and cons to Linux:

Pros

  1. Utterly stable
  2. Exceptionally well documented
  3. Vast collection of stable, secured ports
  4. Great driver support
  5. Lowest memory footprint of any OS available

Cons

  1. GNU/Linux's GCC has better compilation support than FreeBSD's CLang

Installing FreeBSD

Install FreeBSD using the ISO of your choice (x86/x64) from FreeBSD's download page.

For help installing FreeBSD, refer to the FreeBSD Handbook, accompanied with FreeBSD Installation Walkthrough.

Take note, all of the following commands should be done as root, except crontabs which is indicated to be done as mc.

Youtube Help

I have created Youtube videos to help assist in installing MineOS-on-FreeBSD, but please follow the instructions in this wiki rather than those in the video, as these are guaranteed to be the most recent, error-free commands.

Youtube: Installing FreeBSD from scratch
Youtube: Installing MineOS Scripts on FreeBSD

Configuring FreeBSD

Logging in as root

Once FreeBSD is installed, log into the terminal using PuTTY as your newly-created root username:

<syntaxhighlight> mineos-freebsd# </syntaxhighlight>

Creating the mc user

Create the mc:games user. <syntaxhighlight> wootdot-freebsd# adduser Username: mc Full name: minecraft user Uid (Leave empty for default): Login group [mc]: Login group is mc. Invite mc into other groups? []: games Login class [default]: Shell (sh csh tcsh bash rbash nologin) [sh]: Home directory [/home/mc]: Home directory permissions (Leave empty for default): Use password-based authentication? [yes]: Use an empty password? (yes/no) [no]: Use a random password? (yes/no) [no]: Enter password: Enter password again: Lock out the account after creation? [no]: Username : mc Password : ***** Full Name : minecraft user Uid : 1002 Class : Groups : mc games Home : /home/mc Home Mode : Shell : /bin/sh Locked : no OK? (yes/no): </syntaxhighlight>

Adding the Linux-compatible /proc filesystem

Load the linprocfs module and create the alternate /proc mount point at /usr/compat/linux/proc.

<syntaxhighlight> echo 'linprocfs_load="YES"' >> /boot/loader.conf kldload linprocfs mkdir -p /usr/compat/linux/proc mount -t linprocfs linprocfs /usr/compat/linux/proc </syntaxhighlight>

As root, ensure the Linux Proc filesystem module is loaded on boot.

<syntaxhighlight> echo 'linproc /usr/compat/linux/proc linprocfs rw 0 0' >> /etc/fstab </syntaxhighlight>

Installing required software

General Dependencies

<syntaxhighlight> pkg_add -r python27 pkg_add -r rdiff-backup pkg_add -r rsync pkg_add -r py27-sqlite3 pkg_add -r screen </syntaxhighlight>

Hiawatha Webserver

<syntaxhighlight> pkg_add -r hiawatha echo 'hiawatha_enable="YES"' >> /etc/rc.conf fetch -o /usr/local/etc/hiawatha/hiawatha.conf http://minecraft.codeemo.com/files/freebsd/hiawatha.conf cp /usr/local/etc/hiawatha/mimetype.conf.sample /usr/local/etc/hiawatha/mimetype.conf mkdir -p /usr/local/var/lib/hiawatha mkdir -p /usr/local/var/log/hiawatha </syntaxhighlight>

Install Java

<syntaxhighlight> pkg_add -r openjdk7 </syntaxhighlight>

MineOS scripts

<syntaxhighlight> rehash mkdir -p /usr/games/minecraft mkdir -p /usr/local/www/hiawatha/admin/cgi-bin /usr/local/bin/rsync -r rsync://mineos@codeemo.com/stable_webui /usr/local/www/hiawatha/admin /usr/local/bin/rsync -r rsync://mineos@codeemo.com/stable_scripts /usr/games/minecraft chmod u+x /usr/games/minecraft/*.py chmod u+x /usr/games/minecraft/*.sh chown -R mc:games /usr/games/minecraft chown -R mc:games /usr/local/www/hiawatha/admin ln -s /usr/games/minecraft/server.py /usr/local/www/hiawatha/admin/cgi-bin/server.py </syntaxhighlight>

Edits to mineos.config

Change the following values in /usr/games/minecraft/mineos.config

<syntaxhighlight> admin = /usr/local/www/hiawatha/admin java_path = /usr/local/bin </syntaxhighlight>

Starting MineOS on boot

To instruct FreeBSD to start MineOS servers on boot, add the following contents to a custom startup script. As root:

<syntaxhighlight> fetch -o /usr/local/etc/rc.d/mineos http://minecraft.codeemo.com/files/freebsd/mineos chmod 555 /usr/local/etc/rc.d/mineos echo 'mineos_enable="YES"' >> /etc/rc.conf </syntaxhighlight>

Crontabs

Add in the following contents. Press [escape]:wq [enter] to save and quit.

<syntaxhighlight> PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

  1. 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 </syntaxhighlight>

Starting it up

Finally, restart the server with reboot and it should be up and running!

Securing Hiawatha

Follow the instructions here for: Password-protecting the web-ui

Limitations

  • No iptables (actually, pf) documentation
  • Uses default /bin/sh, not bash. You can install bash with pkg_add -r bash. As the mc user, permanently reassign the shell with chsh