FreeBSD Server

From Diversia wiki

Jump to: navigation, search

Contents

Versions

Check for the most recent list of dependencies: Dependencies Server. FreeBSD 8.0 32 bit is used in this documentation.

Tools

The following tools are used during compiling:

  • boost-build
  • cmake
  • gmake
  • svn (subversion client)
  • unzip

Dependencies

FreeBSD ports

Install the following dependencies from ports:

  • boost-all
  • boost-libs
  • freeimage
  • httpd server of your choice with PHP support (Apache, LightTPD)
  • lua
  • ogre3d (--enable-freeimage in Makefile)
  • postgresql-libpqxx
  • postgresql-server
  • tinyxml

RakNet

Perform the following actions to install RakNet:

cd /usr/src
fetch http://www.jenkinssoftware.com/raknet/downloads/RakNet-3.72.zip
unzip RakNet-3.72.zip
mv RakNet raknet-3.72
cd raknet-3.72
vi Samples/CMakeLists.txt

Remove the line "add_subdirectory(Lobby2Client)" (line 36).

vi Samples/Tests/PacketAndLowLevelTestsTest.cpp

Comment the malloc.h include: //#include "malloc.h" (line 3).

cmake -DDISABLEDEPENDENCIES=TRUE
gmake
cp Lib/LibStatic/libLibStatic.a /usr/local/lib/libRakNet.a
mkdir -p /usr/local/include/raknet
cp -R Source/*.h /usr/local/include/raknet/

Replace the file 'BitStream.h' in /usr/local/include/raknet/ with the following file: BitStream.h

Bullet

Perform the following actions to install Bullet:

cd /usr/src
fetch http://bullet.googlecode.com/files/bullet-2.76.tgz
tar -zxvf bullet-2.76.tgz
cd bullet-2.76
cmake -DBUILD_DEMOS=OFF -DUSE_GLUT=OFF
gmake
gmake install

??? gmake install doesn't work in this version :/ Dirty work-around:

cp src/BulletCollision/*.a /usr/local/lib/
cp src/BulletDynamics/*.a /usr/local/lib/
cp src/BulletSoftBody/*.a /usr/local/lib/
cp src/LinearMath/*.a /usr/local/lib/
mkdir -p /usr/local/include/bullet
cp -r src/Bullet* /usr/local/include/bullet/
cp -r src/btBullet* /usr/local/include/bullet/
cp -r src/LinearMath /usr/local/include/

luabind

Perform the following actions to install luabind:

cd /usr/src
fetch "http://downloads.sourceforge.net/project/luabind/luabind/0.9/luabind-0.9.zip?use_mirror=mesh"
unzip luabind-0.9.zip
cd luabind-0.9
setenv LUA_PATH /usr/local/include/lua51
setenv BOOST_BUILD_PATH /usr/local/share/boost_build
setenv BOOST_ROOT /usr/local/include
bjam
bjam install

Compiling

ln -s /usr/local/include/OGRE /usr/local/include/ogre
mkdir -p /usr/local/src
cd /usr/local/src
svn co http://xmultiverse.svn.sourceforge.net/svnroot/xmultiverse/branches/stable diversia
cd diversia/scripts/CMake
cmake CMakeLists.txt
gmake

Configuration/setup

We assume the path '/home/diversia/server' will be used to install your files to.

mkir -p /home/diversia/server
cd /home/diversia/server
cp /usr/local/src/diveria/scripts/CMake/Server .

ini file

Create a file named diversia.ini and use the following ini as example:

# Diversia config file

[Database]
Hostname = "localhost"
Port = 5432
Database = "diversia"
Username = "user"
Password = "pass"

[Connection]
Listen_terminal_port = 10001 # terminal port should not be exposed the outside
Listen_terminal_password = "l9s8fddf24324jfkjd"
Listen_terminal_max_connections = 10

# Logging
#
# 1 = Info         default info
# 2 = Warning      A Warning has occured
# 3 = Error        An error has occured
# 4 = Debug        Information that helps the user debug a problem.
# 5 = EntryExit    Traces the entries and exits of functions.
# 6 = Everything   Verbose output.
#
# All lower numbers will be logged too

[Log]
Level = 4

# eof

Example media directory

cd /usr/local/src/diversia/server
cp -r media /home/diversia/server/

Web server

  • Install a web server. The webserver can run on Apache or LightTPD
  • Download the package from the following URL: http://grid.diversia.org/files/diversia_resource_package.tar.gz
  • Copy the contents to your web server, so that it is accessible from the URL 'your.web.server/resources/' for example. You will need the URL when you setup the database.

Database server

Install PostgreSQL server. Get the example sql file from svn and create the database:

su - pgsql
createdb diversia
psql diversia
diversia=# create user diversia with password 'diversia';
diversia=# grant all on database diversia to diversia;
diversia=# \q
psql -U diversia -W diversia
diversia=# \i /home/diversia/server.pg.sql
diversia=# insert into serverinfo(id, name, ipaddress, remoteaddress, port, resourceserver,
           description, motd, maxclientconnections, maxlogonconnections) values(1, 'servername', 
           '10.0.0.25', '123.123.123.123', 8500, 'your.web.server/resources/', 'description',
           'motd', 100, 100);

Enter the URL without 'http://' at the begin and with a trailing slash.

Running

When you use a remote server it might be handy to use screen to run your server. Run the following commands to start a server in screen:

screen
Press [Enter]
cd /home/diversia/server
./Server

Press ctrl-a + d to detach your screen session. Use the following command to attach to your screen session.

screen -dr

Running a server in the background:

cd /home/diversia/server
./Server > /dev/null &
Personal tools