The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm6 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tutorial] Sphere Server on Debian stable
Author Message
Lirion
Apprentice
*

Posts: 4
Likes Given: 0
Likes Received: 2 in 1 posts
Joined: Dec 2014
Reputation: 0



Post: #1
[Tutorial] Sphere Server on Debian stable
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
Then you might want to
Code:
sudo [apt-get] install libmysqlclient18:i386
libc6-i386 should automatically be added to your system.

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 \
    --disabled-login --shell /bin/bash --group --gecos "" sphere

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
cd /opt/sphere

First of all, create the basic folder structure:
Code:
for i in save mul logs accounts; do if [ ! -e $i ]; then mkdir -p $i\
    chown -c sphere:sphere $i && chmod 750 $i; fi; done

Now let's create the empty world and character files:
Code:
for i in  save/sphereworld.scp save/spherestatics.scp save/spheremultis.scp \
    save/spheredata.scp save/spherechars.scp; do if [ ! -e $i ]; then \
    echo "[eof]" > $i && chown -c sphere:sphere $i && chmod 640 $i; fi; done

Same for empty account files:
Code:
for i in accounts/sphereaccu.scp accounts/sphereacct.scp; do \
    if [ ! -e $i ]; then echo "[eof]" > $i && chown -c sphere:sphere $i && \
    chmod 640 $i; fi; done

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 && \
    chmod u+s /opt/sphere/spheresvr

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
Sphere will now talk to you - it will probably complain about AGREE=1 that we've forgotten (mind you: we have a nightly build here) and then finally launch.
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
screen -O -S Sphere
You're now inside a screen session which is called "Sphere" and which you can quit and reattach whenever you like.

Time to launch sphere again:
Code:
sudo su - sphere
./spheresvr

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
- as the user who opened up that session! It doesn't matter which user you take for that, you can use your everyday user.

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
is my current way to do this and should give you an idea how you can do that yourself. Look up the manpage of screen and see what the parameters and the rest do.

If you try to please everyone, somebody is not going to like it.
(This post was last modified: 12-23-2014 02:15 AM by Lirion.)
12-23-2014 02:05 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 2 users Like Lirion's post
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)