Installing the Servers on Linux

From Multiverse

Jump to: navigation, search

Contents

Overview

This document is a guide to rapid setup of a Multiverse server on Linux. In approximately one hour, it takes you through installing the Multiverse server on CentOS 4.4, including MySQL configuration. CentOS 4.4 is a RedHat derivative freely available from http://www.centos.org.

Follow this document to get your Multiverse server running quickly on an enterprise class operating system with minimal amount of time spent figuring out the logistics of Linux so you can start working quickly on your MMO project!

This article was written by Sgalyen.

Intended audience

This tutorial is for developers who want a standalone Linux-based Multiverse server separate from their development environment.

Caution: This document does not cover best practices for Linux server administration including security, patch remediation and fault tolerance/disaster planning.

Prerequisites

To use this guide you do not need extensive Linux experience, but you must understand some basic things:

  • How to use a Linux command shell.
  • Basic directory and file manipulation.
  • Uploading via sftp and editing text files, with an editor such as vi.

This document makes installation as straightforward as possible, but you need to at least speak the lingo and have a basic understanding of OS principles.

All instructions are from the Linux host command line unless otherwise specified.

Install Multiverse server

Download and extract the Multiverse stand-alone server:

Get the download link for the most recent server build from http://www.multiverse.net/developer/downloadserver.jsp

Right-click on the link to the .tgz file and choose "Copy Link Location" or "Copy Shortcut" (depending on your browser). Then retrieve the most current Multiverse server build with the following command:

> wget http://fully.qualified.domain.name/file.name

For example:

> wget http://update.multiverse.net/server/server_2008-xx-xx_xx-xx-xx.tgz

Where server_2008-xx-xx_xx-xx-xx.tgz is the actual name of the server download, from the most recent release announcement (see the forums or http://www.multiverse.net/developer/downloadserver.jsp),

If successful you will see messages similar to this:

--14:17:52--  http://update.multiverse.net/server/server_2007-03-05_17-45-44.tgz
           => `server_2007-03-05_17-45-44.tgz'
Resolving update.multiverse.net... 64.13.140.178
Connecting to update.multiverse.net|64.13.140.178|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2,610,881 (2.5M) [application/x-gzip]

100%[=====================================================>] 2,610,881    1.17M/s

14:17:54 (1.16 MB/s) - `server_2007-03-05_17-45-44.tgz' saved [2610881/2610881]

Extract the contents of the file downloaded (change the file name to reflect what you downloaded):

> tar -xzvf server_2007-03-05_17-45-44.tgz

Move the extracted folder into /usr:

> mv multiverse /usr

Security in Fedora Core 5

The Linux distribution on which the Multiverse server has been tested is Fedora Core, so running this distribution is recommended to minimize the chance of encountering obscure or subtle incompatibility issues. If you do this, you will need change a couple things from the default configuration to enable clients to connect. These directions assume you are running the default friendly GNOME setup.

  1. If you are running a default installation, SELinux ("Security-Enhanced Linux") will be active. You will need to go to the SELinux tab (found under System > Administration > Security Level & Firewall) and modify one of the values under "SELinux Service Protection" - make sure Disable SELinux protection for mysqld daemon is checked. Until do this, the mysqld daemon will not start (though you will be able to run mysqld_safe).
  2. Under the "Firewall Options" tab, you will need to add two ports ("Other ports"):
    • Your world_manager port (5040 by default) for TCP
    • Your proxy server port (5050 by default) for UDP

Install MySQL

These instructions are specifically for MySQL version 4.1.20, but they should be generally valid for subsquent versions. If you already have MySQL 4.1.10 or higher installed, skip this section.

To install MySQL, enter this command:

> yum install mysql-server.i386

You will see this response:

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 mysql-server            i386       4.1.20-1.RHEL4.1  base              9.8 M
Installing for dependencies:
 mysql                   i386       4.1.20-1.RHEL4.1  base              2.9 M
 perl-DBD-MySQL          i386       2.9004-3.1       base              111 k
 perl-DBI                i386       1.40-8           base              466 k

Transaction Summary
=============================================================================
Install      4 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 13 M

> Is this ok [y/N]: y

Enter "y" to download and install MySQL.

Start MySQL

To start MySQL, enter this command:

> service mysqld start

As the service starts, you see the following messages:

Initializing MySQL database:                               [  OK  ]
Starting MySQL:                                            [  OK  ]

Configure MySQL startup

To set MySQL to start automatically when the system boots, enter this command:

> ntsysv

Scroll down to mysqld and hit spacebar to put a star in front of it, then tab to Ok and spacebar again to exit.

Secure MySQL

Now you will secure the MySQL service.

  1. Launch the MySQL client by entering this command:
    > mysql -uroot
    

    Notice that that the MySQL client did not prompt you for a password! By default, it is not secure.

  2. MySQL installation creates four accounts by default. To see them, enter this command: mysql> select user,host from mysql.user; You will see this:
    +------+----------------------------+
    | user | host                       |
    +------+----------------------------+
    |      | fully.qualified.host.name  |
    | root | fully.qualified.host.name  |
    |      | localhost                  |
    | root | localhost                  |
    +------+----------------------------+
    4 rows in set (0.00 sec)
    
  3. Set the password for the two accounts root and root@host. Enter this command:
    mysql> update mysql.user set password = password('mypassword') where user = 'root';
    

    Replace 'mypassword' in the command above with your new password. Keep the single quotes. Note the MySQL root account is not the same as the Linux root account. For security, make the MySQL root account password different from the Linux root password.

    You will see the following response:

    Query OK, 2 rows affected (0.00 sec)
    Rows matched: 2  Changed: 2  Warnings: 0
    
  4. Make the password change take effect immediately by entering this command:
    mysql> FLUSH PRIVILEGES;

    You will see this response:

    Query OK, 0 rows affected (0.00 sec)
  5. Remove anonymous user accounts:
    mysql> DELETE FROM mysql.user WHERE User = '';
    

    You will see this response:

    Query OK, 2 rows affected (0.00 sec)
  6. Make the changes take effect immediately by entering this command:
    mysql> FLUSH PRIVILEGES;
  7. Now, view the current databases:
    mysql> show databases;

    You will see this:

    +----------+
    | Database |
    +----------+
    | mysql    |
    | test     |
    +----------+
    2 rows in set (0.00 sec)
    
  8. Delete the sample database TEST by entering this command:
    mysql> drop database test;

    You will see this response:

    Query OK, 0 rows affected (0.00 sec)
  9. Verify that the sample database is gone. Enter this command:
    mysql> show databases;

    You will see this response:

    +----------+
    | Database |
    +----------+
    | mysql    |
    +----------+
    1 row in set (0.00 sec)
    
  10. Exit the MySQL client with this command:
    mysql> quit

To verify that MySQL is secured, enter this command:

> mysql -uroot

You should see this response:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

This command failed because you did not specify a password.

Use the -p flag to be prompted for a password. To verify that the MySQL root user account password is what we set it to:

> mysql -uroot -p 

Note Dated: 11/13/08: if the -p parameter above does not work try --password. Now you'll be prompted to enter the password:

Enter password:

Remember, Linux root and MySQL root are two entirely different accounts. Changing a password on one does not change it for another.

You're done with installing and configuring MySQL.

Install Java

The Sun Java download requires a web browser. So, from your workstation, obtain the JDK from Sun Microsystems by browsing to:

http://developers.sun.com/downloads/

From the list select JDK 5.0 Update 11, scroll down to Linux and download the file under "Linux RPM in self-extracting file":

jdk-1_5_0_11-linux-i586-rpm.bin 

After it has downloaded, upload jdk-1_5_0_11-linux-i586-rpm.bin to the Linux server and move it into the /root directory.

Now, back to the Linux command line, install Java as follows:

  1. Flag the bin file as executable with this command:
    > chmod u+x jdk-1_5_0_11-linux-i586-rpm.bin
  2. Run the newly executable file with this command:
    > ./jdk-1_5_0_11-linux-i586-rpm.bin

    After scrolling through the Sun/Java licensing with spacebar, you will be prompted as follows:

    Do you agree to the above license terms? [yes or no]
    

    Enter "y", and then you will see:

    Unpacking...
    Checksumming...
    0
    0
    Extracting...
    UnZipSFX 5.42 of 14 January 2001, by Info-ZIP (Zip-Bugs@lists.wku.edu).
      inflating: jdk-1_5_0_11-linux-i586.rpm
    Preparing...                ########################################### [100%]
       1:jdk                    ########################################### [100%]
    
    Done.
    
  3. Create symlink for the java executable (because the RPM didn't do so):
    cd /usr/bin
    ln -s /usr/java/jdk1.5.0_11/bin/java java
    
The Java Development Kit is now installed!

Install the MySQL JDBC driver

The JDBC driver enables Java to interoperate with MySQL. Install the JDBC driver by following these steps:

  1. Download the JDBC driver to the /root directory with this command:
    > cd /root
    > wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-3.1.14.tar.gz/from/http://mysql.orst.edu/
    

    You will see this response:

    HTTP request sent, awaiting response... 200 OK
    Length: 28,936,239 (28M) [application/x-gzip]
    
    100%[=====================================================>] 28,936,239     2.27M/s    ETA 00:00
    
    14:06:39 (2.31 MB/s) - `mysql-connector-java-3.1.14.tar.gz' saved [28936239/28936239]
    
  2. Extract the JDBC driver with this command:
    > tar -xzvf mysql-connector-java-3.1.14.tar.gz
  3. Move the JDBC driver to /usr with this command:
    > mv mysql-connector-java-3.1.14 /usr

The JDBC driver is now installed.

Important: The path for JDBC driver is /usr/mysql-connector-java-3.1.14/mysql-connector-java-3.1.14-bin.jar. You will need to use this path in the next section.

If you can't find the driver at the location above go to the same link above for the JDK and click on Database and then download it from Sun.

Configure Multiverse servers

You must configure a few settings for the Multiverse servers to operate properly.

Specify JDBC driver location

You must specify the location of the JDBC driver so the Multiverse server can find and use it. Edit the property file /usr/multiverse/bin/multiverse.properties. Look for the line

multiverse.jdbcJarPath=c:\\mysql-connector-java-3.1.14\\mysql-connector-java-3.1.14-bin.jar

Edit this line so that it looks like this:

multiverse.jdbcJarPath=/usr/mysql-connector-java-3.1.14/mysql-connector-java-3.1.14-bin.jar

Specify IP address for proxy server

NOTE: As of the 1.0 release, the following procedure is optional. Use the ":same" value to set the value of the proxy server address to the IP address to which the Client connected.

Now set the server IP address used by the proxy server. Edit /usr/multiverse/bin/multiverse.properties and change the following line:

multiverse.proxyserver=xxx.xxx.xxx.xxx

Replace xxx.xxx.xxx.xxx with your Linux server IP address.

To find your Linux server IP address run the following command on the Linux console:

> ifconfig

You will see the response:

eth0      Link encap:Ethernet  HWaddr 00:0A:39:29:39:96
          inet addr:xxx.xxx.xxx.xxx  Bcast:yyy.yyy.yyy.yyy  Mask:255.255.255.192
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:598 errors:0 dropped:0 overruns:0 frame:0
          TX packets:230 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:79354 (77.4 KiB)  TX bytes:29410 (28.7 KiB)
          Interrupt:177 Base address:0x1400

Specify MySQL user name and password

By default, the Multiverse servers are configured to use the MySQL user "root" with password "test". In general, it is better to create a Multiverse user account its own password instead. You will create and configure this account later, but you are going to reconfigure the Multiverse server now.

Edit the the file /usr/multiverse/bin/multiverse.properties and look for these two lines:

multiverse.db_user=root
multiverse.db_password=test

Change them as follows:

multiverse.db_user=multiverse
multiverse.db_password=your-password

where your-password is the password you want to use for the MySQL user "multiverse".

NOTE: Although editing the default properties file works, the "best practice" is to create your own properties file (in /usr/multiverse/bin) by copying /multiverse.properties, then setting the environment variable DEFAULT_MV_PROPERTYFILE to refer to that file. Then, when you upgrade your Multiverse server installation, you can just keep your properties file instead of needing to make all the changes again.

Configure MySQL for Multiverse

The Multiverse server installation comes with an SQL script to create the required database. In this section, you will create the database and create a "multiverse" user that the Multiverse servers will use to access it.

Create database

To create the Multiverse database, follow these steps:

  1. Launch the MySQL client with this command:
    >mysql -uroot -p

    The client will prompt you for the root password. Enter it, and you will then see the MySQL prompt:

    mysql>
  2. Create the Multiverse MySQL database using the script with this command:
    mysql> source /usr/multiverse/bin/install.sql

    You will see the response:

    Query OK, 1 row affected (0.00 sec)
    
    Database changed
    Query OK, 0 rows affected (0.01 sec)
    
    Query OK, 0 rows affected (0.00 sec)
    
    Query OK, 0 rows affected (0.01 sec)
    
    Query OK, 1 row affected (0.00 sec)
    
  3. Verify that the new database was created with this command:
    mysql> show databases;

    You will see the response:

    +------------+
    | Database   |
    +------------+
    | multiverse |
    | mysql      |
    +------------+
    2 rows in set (0.00 sec)
    
  4. Verify that the Multiverse database has the right tables populated with this command:
    mysql> show tables from multiverse;

    You will see this response:

    +----------------------+
    | Tables_in_multiverse |
    +----------------------+
    | objstore             |
    | oid_manager          |
    | player_character     |
    +----------------------+
    3 rows in set (0.00 sec)
    

Create multiverse user

Instead of using the MySQL "root" account, as the Multiverse servers are configured to do by default, you are going to create a "multiverse" user account.

  1. Create the MySQL user account for Multiverse with no permissions with this command:
    mysql> grant usage on *.* to multiverse@localhost;

    You will see the response:

    Query OK, 0 rows affected (0.00 sec)
  2. Give the new Multiverse account full permissions to the Multiverse database with this command:
    mysql> grant Select, Insert, Update, Delete, Create, Drop ON `multiverse`.* TO multiverse@localhost;

    You will see the response:

    Query OK, 0 rows affected (0.00 sec)
  3. Set the password for the account with this command:
    mysql> update mysql.user set password = password('password') where user = 'multiverse';

    You will see the response:

    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
  4. Finalize the MySQL settings with this command:
    mysql> flush privileges;

    You will see the response:

    Query OK, 0 rows affected (0.00 sec)
  5. Exit the MySQL client with this command:
    mysql> quit

Start the Multiverse servers

NOTE: If you are using Ubuntu Linux, see Running Multiverse servers on Ubuntu Linux.

To start the Multiverse servers, enter this command:

> cd /usr/multiverse/bin
>./multiverse.sh -v start

And if you followed all the steps successfully, you will see the following (some of the lines below have been wrapped for readability):

*** Starting world sampleworld ***
Enabling JMX mgmt & monitoring
MV_HOME is ..
Using .jar files from the /dist hierarchy
Using property file ../bin/multiverse.properties
Using world file ../config/sampleworld/sampleworld.mvw
Using world script directory ../config/sampleworld
Using log directory ../logs/sampleworld
Using common directory ../config/common, bin directory ../bin
JAVA_FLAGS="-Dcom.sun.management.jmxremote -server -cp ../other/rhino1_5R5/js.ja
r;c:/mysql-jdbc/mysql-connector-java-3.1.14-production-bin.jar;../dist/lib/multi
verse.jar;../dist/lib/mars.jar;../dist/lib/.jar;../other/java-getopt-1.0.11.jar;
../other/jython_2_1.jar;../other/log4j-1.2.14.jar;../other/bcel-5.2.jar;. -Djava
.system.class.loader=multiverse.server.marshalling.MarshallingClassLoader -Dmult
iverse.propertyfile=../bin/multiverse.properties  -Dmultiverse.logs=../logs/samp
leworld"
Starting domain server:         SUCCESS
Starting combat server:         SUCCESS
Starting object manager:        SUCCESS
Starting login manager:         SUCCESS
Starting world manager 1:       SUCCESS
Starting proxy server:          SUCCESS
Starting world reader:          SUCCESS
Starting mob server:            SUCCESS
Wait for finished initializing msg...
*sys-package-mgr*: processing new jar, '/usr/multiverse/other/rhino1_5R5/js.jar'
*sys-package-mgr*: processing new jar, '/usr/mysql-connector-java-3.1.14/mysql-connector-java-3.1.14-bin.jar'
*sys-package-mgr*: processing new jar, '/usr/multiverse/dist/lib/multiverse.jar'
*sys-package-mgr*: processing new jar, '/usr/multiverse/dist/lib/mars.jar'
*sys-package-mgr*: processing new jar, '/usr/multiverse/other/java-getopt-1.0.11.jar'
*sys-package-mgr*: processing new jar, '/usr/multiverse/other/jython_2_1.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jdk1.5.0_11/jre/lib/rt.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jdk1.5.0_11/jre/lib/jsse.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jdk1.5.0_11/jre/lib/jce.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jdk1.5.0_11/jre/lib/charsets.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jdk1.5.0_11/jre/lib/ext/localedata.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jdk1.5.0_11/jre/lib/ext/dnsns.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jdk1.5.0_11/jre/lib/ext/sunjce_provider.jar'
*sys-package-mgr*: processing new jar, '/usr/java/jdk1.5.0_11/jre/lib/ext/sunpkcs11.jar'
DONE INITIALIZING, you can log in now

Note: You will only see the *sys-package-mgr* messages the first time you start the server.

To see if your server is running as expected, check the status with this command:

./multiverse.sh status

If all the servers are running, you will see:

domain server:           RUNNING
login server:            RUNNING
combat server:           RUNNING
object manager:          RUNNING
world manager 1:         RUNNING
proxy server:            RUNNING
world reader:            RUNNING
mob server:              RUNNING

Connecting to your Multiverse server

To connect the Multiverse Client to your servers, you must either turn off any firewall on the Linux server or create exceptions for a Multiverse client to connect.

In general, to enable clients to access your server register your world with the Multiverse Network. NOTE: Use of the world settings file is now deprecated, except in cases when you are working "offline."

Follow the procedure outlined in the Getting Started tutorial.

Personal tools