![]() |
[Tutorial] Sphere Server on Debian stable - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: General Discussion (/Forum-General-Discussion) +--- Forum: Documentation/Tutorials (/Forum-Documentation-Tutorials) +--- Thread: [Tutorial] Sphere Server on Debian stable (/Thread-Tutorial-Sphere-Server-on-Debian-stable) |
[Tutorial] Sphere Server on Debian stable - Lirion - 12-23-2014 02:05 AM work in progress I'll assemble a small tutorial here which covers the installation of sphere on a stable Debian version. Preamble At any point: nothing here is strictly mandatory. You want to use different parameters, folders, ...? Perfect. If you know what to do, feel free to use this only as a very basic and rough guideline. Whenever you are root, which you shouldn't be permanently, you can omit any sudo below and type the commands without it. When I'm finished I'll paste it here (most likely as a link to pastebin). [apt-get]: It depends on you whether you use apt-get or aptitude. Currently, Debians initial installation uses aptitude, but if you used apt-get ever since adding own stuff, fair enough. Don't mix these too often though, decide for either version and keep using it. I'll use [apt-get] as a synonym for both, any command will do fine with either variant. Requirements (32bit) libraries For 64bit systems, this article covers basically anything. Effectively, you'd want to do a Code: sudo dpkg --add-architecture i386 && sudo [apt-get] update Code: sudo [apt-get] install libmysqlclient18:i386 For 32bit systems - well, install anything you need without the :i386 prefix :) Install anything sphere complains about that is missing. Preparing folders and rights User Of course you shouldn't run sphere as root. If you choose to use an init script (we'll get to this later on), that will be launched by root, but sphere itself should never be owned and launched by this. Why? There's tons of tutorials on your chosen OS on the web. We'll create the sphere directory: Code: sudo mkdir -p /opt/sphere Now it's time to add the user: Code: sudo adduser --home /opt/sphere --system --no-create-home --disabled-password \ This will add user and group sphere, the user cannot log in and will have its home directory in /opt/sphere. Whenever we want to be the user sphere from now on, we'll do a sudo su - sphere. Your first sphere installation Let's become root now and go into the sphere folder to make things easier. Code: sudo su First of all, create the basic folder structure: Code: for i in save mul logs accounts; do if [ ! -e $i ]; then mkdir -p $i\ Now let's create the empty world and character files: Code: for i in save/sphereworld.scp save/spherestatics.scp save/spheremultis.scp \ Same for empty account files: Code: for i in accounts/sphereaccu.scp accounts/sphereacct.scp; do \ Now, acquire a Debian sphere binary from here (the Sphere special build page for now) plus the sphere.ini, sphereCrypt.ini and sphere.dic from the nightly builds page (again, for now). Then it's your time: Fill in the mul directory, plow some scripts into scripts/ and change sphere.ini. Do both as root, but where to acquire your mul files and what to put in sphere.ini is covered elsewhere. Now all the stuff is still owned by root and world readable. We will need and want to change that: Code: chown -R sphere:sphere /opt/sphere && chmod -R o-rwx /opt/sphere && \ First execution Now that we've got our base installation, it's time for a test run. You can remain root for that - spheresvr has the setuid bit set for now, so when we execute the binary, it will be executed as user sphere. Code: ./spheresvr Now what? Disable secure mode and exit. If it now throws a truckload of memory messages at you, don't worry: it's a known non-severe bug (see Sphere's Bug Tracker), it doesn't change the stability of a running sphere and will most probably vanish as soon as you have accounts and all that stuff. Get off that root account, grab yourself some tea and call the first step taken. How to run Sphere in the long run 1. Make it terminal-independent. Do NOT background sphere. Sphere's a chatty little fellow, it wants to talk to you and occasionally be poked at. Instead, you might want to use tmux or screen to have something to come back to - give sphere a cozy living room to dwell in and come visit the poor lad every now and then. I'll give you an example with screen: Code: sudo [apt-get] install screen Time to launch sphere again: Code: sudo su - sphere Whenever you want to quit, type CTRL+A followed by D. If you want to get back to the session, type Code: screen -d -r Sphere There are ways to make that session multiuser compatible (if you want to: here's what you need), but it's a matter of taste. 2. Automatic startup Chapter still needs content. I'm currently writing an LSB enhanced SysVinit script which will launch sphere when the server is booted and enables you to restart it. It won't automatically terminate the server, however. Why? All we can do is kill the screen session and/or kill the sphere process - this is far from doing a proper shutdown from INSIDE sphere and should be only done when doing an emergency server shutdown. And well - this will happen anyway on a hardware shutdown, so no need to script gallows upon gallows. If you're impatient: Code: screen -DmS Sphere su - sphere -c /opt/sphere/spheresvr |