bw logo

Chapter 2. Simple Installation

Installing the BigWorld server consists of installing 3 separate components:

  • BigWorld Machine Daemon (BWMachineD)

  • BigWorld Server (BaseApp, CellApp, DbMgr, etc)

  • BigWorld Server Tools (MessageLogger, WebConsole, etc)

BWMachineD is required by both the BigWorld server and the BigWorld server tools, however both the server and server tools can run independantly of one another and are commonly installed on separate machines to avoid load issues of one service interfering with another.

The simplest path to installing the server and tools is to use the pre-generated RPM packages which are tested and known to work on the supported Linux distributions.

2.1. Recommended Setup

The recommended system configuration for a scalable BigWorld server environment is to separate the BigWorld server from the machine that will run the BigWorld server tools.

The isolation of the server tools on a separate machine is recommended in order to ensure that if high load situations occur on any cluster machines, the associated increase in logging and monitoring tasks performed by the server tools do not further degrade performance on any of the active cluster machines.

Due to the potential for log files to grow quite drastically in both a development and a production environment it is recommended that, when creating partitions for the operating system installation, to create a separate partition or have an entirely separate hard disk dedicated for the BigWorld server logs.

For the purposes of an initial installation or small scale development it is perfectly acceptable to install both the server and tools onto the same machine, and this installation guide will assume that the installation is being peformed on a single machine.

2.1.1. Supported Distributions

BigWorld only officially supports the 64-bit CentOS 5.x and RedHat Enterprise Linux 5.x distributions.

BigWorld has previously supported other Linux distributions, however in order to better support customers we have consolidated our support list to have a greater focus and reduce variability when resolving customer issues.

CentOS can be downloaded from the CentOS community portal.

RedHat Enterprise Linux is available from the RedHat website.

2.2. Preparation

As the BigWorld server is a complex set of programs with a number of dependencies, it is important to ensure that all your system has been installed correctly and prepared before continuing with the primary installation. A quick overview of what is required to install the BigWorld server and tools follows:

  • 64 bit x86_64 hardware

  • CentOS[1] 5 64 bit

  • EPEL repository enabled

  • MySQL installed, configured and started

The following sections will outline in more detail how to achieve a functional installation of CentOS ready for an installation of the BigWorld server.

2.2.1. Installing CentOS

A guide on how to install Linux is out of the scope of this documentation as this process will commonly need to be tailored to your circumstances. We have however provided a rough overview of the CentOS installation process which outlines specific packages and configuration options that may be useful for a BigWorld server cluster machine. This overview can be found in Appendix B, Installing CentOS 5.

2.2.1.1. Update System Packages

After any system installation it is a good idea to update all the installed system packages as there may have been important security fixes or other bug fixes which can impact the performance and security of your system since the installation media used for your install was produced.

Run the following command as root:

# yum update

After performing this update it is a good idea to reboot your computer to pick up any system changes such as kernel updates.

2.2.2. Installing the EPEL Repository

In order to fully support the server tools under CentOS it is necessary to install some packages that are not available in the default CentOS installation. In order to facilitate this you must enable the Extra Packages for Enterprise Linux (EPEL) repository which is provided by the Fedora Project. The Fedora project manages this repository as they are the base distribution from which Red Hat and CentOS are forked from.

To enable the EPEL repository use the following command:

Note

The EPEL packages aren't kept as up to date as the official releases. If you have trouble downloading a version, try navigating to the directory and searching for the current version of the EPEL package. For example as of the CentOS 5.6 release the EPEL package still refers to 5.4.

Please modify the following URL as required.

As root, run:

# wget http://download.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
# rpm -Uvh epel-release-5-4.noarch.rpm

This step has now made the packages from the EPEL repository available to your CentOS installation which will be used when the BigWorld server RPMs are installed.

2.2.3. Installing, Configuring and Starting MySQL

Both the BigWorld server and server tools can make use of MySQL for persistent data storage. In order to take advantage of MySQL it must be properly configured for each use case.

To install the MySQL server, run the following command as root:

# yum install mysql-server

This will install the MySQL server only. In order to interact with the MySQL server to create initial databases and set user access privileges we need to install the MySQL client. To do this run the following command as root:

# yum install mysql

DBMgr requires that its tables use the InnoDB storage engine, which is not necessarily the default engine used by MySQL. To make InnoDB the default engine, edit the file /etc/my.cnf, and add the following entry in the [mysqld] section:

default-storage-engine=InnoDB

2.2.3.1. Start the MySQL server

After installing the MySQL server it is quite common to not have the actual MySQL server running or configured to restart after a reboot. As it is a core component in most environments it is important to check the MySQL server is setup correctly before proceeding.

As root run:

# /sbin/chkconfig --levels 345 mysqld on 
# /etc/init.d/mysqld start

This has ensured that the MySQL server will be running after the machine is rebooted, and starts up the MySQL server for immediate use. If you are new to Linux and are unfamiliar with the concept of runlevels it would be useful to gain a basic understanding of this concept if you intend to maintain a BigWorld server cluster. More information can be found on the Red Hat Documentation website.

2.2.3.2. MySQL Accounts

Both the BigWorld server and the BigWorld server tools have different requirements of the MySQL server as they are both performing unique tasks. As a result of this, we recommend that a seperate account is created for the BigWorld server tools, and for every user who will be running a BigWorld server.

The default MySQL installation is configured with one user called root. This is not the same as the system root user. In order to create a new MySQL user we log in to MySQL using the MySQL root user account as follows:

$ mysql -u root

This command can be run as any user providing the MySQL root user account has no password set.

Note

For detailed instructions on MySQL account creation and management please refer to the MySQL documentation website, specifically the MySQL Server Administration chapter, section MySQL User Account Management.

2.2.3.2.1. BigWorld Server Tools

The BigWorld Server Tools component StatLogger requires a MySQL server to work, while WebConsole by default will use SQLite but can be configured to use MySQL.

The following example illustrates how to create a MySQL user for the server tools with a username of bwtools and a password of bwtools_passwd and assign the required privileges to allow the server tools to operate normally.

To create a user and grant privileges, run the following command:

$ mysql -u root
 mysql> GRANT ALL PRIVILEGES ON *.* TO 'bwtools'@'localhost' IDENTIFIED BY 'bwtools_passwd';
 mysql> GRANT ALL PRIVILEGES ON *.* TO 'bwtools'@'%' IDENTIFIED BY 'bwtools_passwd';
2.2.3.2.2. BigWorld Server User Account

Every user in the network that will run their own BigWorld server will need to have a MySQL account created for that server instance. For example in a development environment with two server developers, Alice and Bob, and a QA team that runs a single server, three MySQL databases would need to be created and assigned to each server user.

It is considered good practice to limit the privileges of a database user to the tasks they will be required to perform. As the DBMgr process (and related tools) require less privileges than the BigWorld server tools, when we create an account for the server we will be more specific in regards to the privileges that user has.

We will need three pieces of information when creating a database for use with the BigWorld server.

  • Username (set in bw.xml using <dbMgr><username>)

  • Password (set in bw.xml using <dbMgr><password>)

  • Database name (set in bw.xml using <dbMgr><databaseName>)

If you are not yet familiar with the bw.xml file, don't worry as this will be covered in more detail later in this document.

The following SQL commands provide the basic syntax to use when creating a MySQL account for use with the BigWorld server. Specific examples follow.

$ mysql -u root 1
GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP, INDEX ON game_db_name.* TO 'username'@'localhost' IDENTIFIED BY 'password'; 2

GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP, INDEX ON game_db_name.* TO 'username'@'%' IDENTIFIED BY 'password'; 3

GRANT RELOAD ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password'; 4

GRANT RELOAD ON *.* TO 'username'@'%' IDENTIFIED BY 'password'; 5

1

Connect to the MySQL server using the MySQL root account. By default no password is required to use this account.

2

Grant access for the database table operations SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE and INDEX to the database named game_db_name for the user username using the password password when connecting to the MySQL server from the localmachine (ie: localhost).

3

This is the same as the previous GRANT command, however this rule is to give access for the user when connecting to the MySQL server from a remote machine (ie: not connecting from localhost). It is possible to restrict the machines from which the user can connect by specifying a more restrictive pattern after the @ symbol.

4

Grant access for the RELOAD capability on all databases from the local machine.

5

This is the same as the previous GRANT, however as before this rule grants the privilege when connecting from a remote machine.

2.2.3.2.2.1. Use Case

In our use case office there are two server developers, Alice and Bob. Alice is involved in the development on a new game project, Parrot Attack and an existing game project Chickens Fight Back. Bob on the other hand is only involved in the development of the new Parrot Attack game.

Alice will need two databases created for her, one for each project she is working on, and Bob will only need a single database for his own development purposes. The following table outlines the information that will be used by the database administrator in order to create the required MySQL database accounts.

Database Name Username Password
alice_parrot_attack alice 1234567
alice_chickens_fight_back alice 1234567
bob_parrot_attack bob bobs secret password1

You can see from this table that both Alice and Bob have been assigned their own database for each game project they are working on. This is to ensure that the when Alice starts her own BigWorld server, she doesn't impact any work that Bob may be currently involved in.

Using Bob's example above we would create an account for Bob giving him privileges on his own Parrot Attack database as follows:

$ mysql -u root
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP, INDEX ON bob_parrot_attack.* TO 'bob'@'localhost' IDENTIFIED BY 'bobs secret password1'; 
  Query OK, 0 rows affected (0.08 sec)
  
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, DROP, INDEX ON bob_parrot_attack.* TO 'bob'@'%' IDENTIFIED BY 'bobs secret password1'; 
  Query OK, 0 rows affected (0.00 sec)
  
mysql> GRANT RELOAD ON *.* TO 'bob'@'localhost' IDENTIFIED BY 'bobs secret password1'; 
  Query OK, 0 rows affected (0.00 sec)
  
mysql> GRANT RELOAD ON *.* TO 'bob'@'%' IDENTIFIED BY 'bobs secret password1';
  Query OK, 0 rows affected (0.00 sec)

2.3. Installing the BigWorld Technology Server package

Now your system should be ready to install the RPM packages contained in the rpm directory of your downloaded package. This guide will assume that you have copied the RPM files into your root user's home directory /root. If you are uncertain of how to transfer your files from a Windows machine to your newly installed Linux machine please refer to Appendix C, Copying files to Linux.

These instructions assume that you are operating on a Linux command line, either via a text based login, or via a Console or Terminal opened through your Window Manager.

We will start by illustrating a basic office installation

2.3.1. BWMachineD

The BigWorld Machine Daemon is required on all machines in a server cluster that will run BigWorld processes. As such this is the first program we will install.

# cd /root 1
# yum install --nogpgcheck bigworld-bwmachined-2.1.0.x86_64.rpm 2

1

We first change to the directory to which the RPM files were copied. In this section we assume this is the /root directory (adjust this as nescessary).

2

Install the bwmachined package, making sure to replace the package name with the correct filename if the version numbers are different.

2.3.2. BigWorld Server

Installing the BigWorld server is trivial. As root, run:

# cd /root
# yum install --nogpgcheck bigworld-server-2.1.0.x86_64.rpm

Although the BigWorld server should now be successfully installed, there are still a two steps remaining before a BigWorld server instance can be run. The first step requires us to install the BigWorld server tools which provides you with the ability to start, stop, and interact with a BigWorld server instance. Installing the server tools is discussed in more detail in the following section BigWorld Server Tools.

A user account also needs to be correctly configured so the server tools are able to locate the appropriate executables and game resources for when starting a BigWorld server instance. This is discussed in passing in Create a new project, and in more detail in Appendix E, Understanding the BigWorld Machine Daemon (BWMachineD).

2.3.3. BigWorld Server Tools

You should now be able to succesfully install the BigWorld server tools. Perform the following commands as root:

# cd /root
# yum install --nogpgcheck bigworld-tools-2.1.0.x86_64.rpm

With the server tools installed there are two more tasks left to do. Firstly we need to configure StatLogger to use our local MySQL server, and secondly we will test that the WebConsole has been started correctly.

2.3.3.1. Configuring StatLogger

StatLogger currently only works with a MySQL database and as such requires a MySQL account to be configured in order to operate. When installing StatLogger from an RPM the preferences file that StatLogger uses will automatically be placed on your filesystem as /etc/bigworld/stat_logger.xml. To set your account details you will need to edit this file as the root user and change the <dbUser> and <dbPass> elements.

To illustrate how these values would be modified we will use the MySQL account details that were created in BigWorld Server Tools. Using this information we would change the stat_logger.xml file entries as follows:

<?xml version="1.0"?>
<preferences>
        <!--General options-->
        <options>
                <dbHost>localhost</dbHost>
                <dbUser>bwtools</dbUser>
                <dbPass>bwtools_passwd</dbPass>
                <dbPort>3306</dbPort>

After configuring StatLogger with your local database account information you will need to start StatLogger and restart WebConsole as follows:

# /etc/init.d/bw_stat_logger start
Starting bw_stat_logger:                                   [  OK  ]
# /etc/init.d/bw_web_console restart
Stopping web_console:                                      [  OK  ]
Starting bw_web_console:                                   [  OK  ]

2.3.3.2. Confirm tools are running

With the server tools installed on your tools machine it is worthwhile ensuring that they have started correctly so that you can be sure nothing has gone awry in the initial part of your installation. To do this we simply run the startup scripts with a status command to ensure they are working as expected.

As root run the following commands:

# /etc/init.d/bw_stat_logger status
Status of stat_logger: running 
# /etc/init.d/bw_message_logger status
Status of message_logger: running
# /etc/init.d/bw_web_console status
Status of web_console: running

2.3.3.3. Connecting to WebConsole

With the server tools installed you should now be able to see the WebConsole page by simply connecting a web browser to it. The URL of WebConsole is the hostname of the machine on which it has been installed at port 8080. For example:

http://localhost:8080

When connected you should be presented with a page similar to the following:

Creating a WebConsole account will be discussed in more detail in Server First Run.

2.3.4. Customising your installation

As development environments progress or a game starts to reach the release stage of its production cycle it may become nescessary to customise your installation of BigWorld to your own environment. If this is the case, please refer to Appendix D, Creating a custom BigWorld server installation for more information.



[1] Anywhere CentOS is mentioned, Red Hat Enterprise Linux may be substituted.