虚拟化容器,大数据,DBA,中间件,监控。

Installing Multicraft on CentOS 7

10 06月
作者:admin|分类:系统运维

Installing Multicraft on CentOS 7

Over at Nerdcrafteria we’ve recently moved over our server hosting to two dedicated servers at OVH.  We’d previously been using CentOS 5 as our OS, which is still offered at OVH, but I decided the time was ripe for an upgrade and plumped with the latest and greatest CentOS 7.

Not much has changed, apart from MariaDB replacing vanilla MySQL (which has let to a massive performance improvement), and systemd replacing SysV. SystemD was somewhat of a mystery to me at the start, and whilst at the beginning I did slightly resent losing the simplicity of just changing rc.local, the new system is vastly superior and I now find it much more intuitive.

Previous tutorials that cover setting up minecraft and multicraft on earlier versions of CentOS are still fine for the most part, but I thought I’d outline the changes to systemd I’d made to set up auto-starting of the multicraft daemon and therefore the minecraft server on box restart.

Firstly, create a new file in /etc/systemd/system called multicraft.service, with the following contents:

[Unit]
Description=Multicraft server daemon
Requires=mariadb.service

[Service]
Type=forking
ExecStart=/home/minecraft/multicraft/bin/multicraft -v start
PIDFile=/home/minecraft/multicraft/multicraft.pid
User=minecraft

[Install]
WantedBy=multi-user.target

This creates a new unit which requires mariadb (MySQL) to already be running – since all my daemon config is stored there this is necessary for me, if you’re using SQLite then you can just remove this line.

The type is forking, i.e. the process that is run forks to create a new daemon process. ExecStart is the file to run, and PIDFile is the location of the file where the multicraft daemon stores its PID. This is only relevant to the forking type, and means that systemd can keep track of whether or not the daemon is running, which is useful if autostart is specified. Obviously you should replace the locations of the executable and PIDfile with the location on your systems. The User configuration specifies which user to run the executable as, you should also change this to the user which runs multicraft on your system (hopefully not root!).

Finally, the Install section tells systemd which targets require this file when it’s enabled.

After the file is created, two commands need to be run on they system. First, make sure the multicraft daemon is not currently running and then run (as root):

systemctl start multicraft.service
systemctl enable multicraft.service

This will start the multicraft service using the settings in the file you’ve just created, and then enable the service to that it will be started automatically when the box runs in multi-user mode (the normal target).

Overall, a little bit more complex than SysV, but it’s so much clearer when you come back after 4 months and try and work out why you’re running random commands in your rc.local!

浏览2909 评论0
返回
目录
返回
首页
How to Install Multicraft on Centos 6 64bit CentOS7 安装配置Mariadb (Mysql)