Installation

From Mineserver Wiki

(Difference between revisions)
Jump to: navigation, search
m (Installing prerequisites)
(OS X installation)
Line 64: Line 64:
You can either change it in the mineserver source code - or - move it to the right location.
You can either change it in the mineserver source code - or - move it to the right location.
 +
 +
====OS X====
 +
You can install zlib and libevent using Macports:
 +
 +
sudo port install zlib libevent
 +
 +
You will need to build libnoise yourself. On OS X, this is best done by using qknight's unofficial branch. First install the libnoise prerequisities:
 +
 +
sudo port install cmake doxygen
 +
 +
Now you can get the code:
 +
 +
git clone https://github.com/qknight/libnoise
 +
cd libnoise
 +
mkdir build
 +
cd build
 +
cmake ..
 +
make
 +
sudo make install
 +
 +
Finally, we need to create a symlink so that Mineserver finds the header files where it expects them (this saves us using sed on the source code):
 +
 +
sudo ln -s /usr/local/include/noise /usr/local/include/libnoise
===== Change the source code =====
===== Change the source code =====
Line 114: Line 137:
Ensure that you have all the prerequisites installed. <code>zlib.h</code> is zlib, <code>event.h</code> is libevent and <code>noise.h</code>, <code>interp.h</code> or <code>mathconsts.h</code> are libnoise.
Ensure that you have all the prerequisites installed. <code>zlib.h</code> is zlib, <code>event.h</code> is libevent and <code>noise.h</code>, <code>interp.h</code> or <code>mathconsts.h</code> are libnoise.
 +
 +
====OS X====
 +
 +
Firstly, until batterseapowers patches are merged, you need to change these lines in src/Makefile:
 +
 +
LDFLAGS = -L/usr/local/lib -L/usr/lib -levent -lz -lnoise $(LFLAGS)
 +
CXXFLAGS = $(DFLAGS) -I. -I/usr/Local/include -I/usr/include
 +
 +
To these:
 +
 +
LDFLAGS += -L/usr/local/lib -L/usr/lib -levent -lz -lnoise $(LFLAGS)
 +
CXXFLAGS += $(DFLAGS) -I. -I/usr/Local/include -I/usr/include
 +
 +
This just allows us to supply some extra LDFLAGS and CXXFLAGS on the command line. Now you can build, ensuring that you point the compiler to any Macports-installed headers and libraries:
 +
 +
cd src
 +
CXXFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib make
===Editing the Config===
===Editing the Config===
This part is nice and easy. Grab the default config files from the <code>bin</code> directory in the distribution and view the [[configuration]] article to get accustomed with the options available.
This part is nice and easy. Grab the default config files from the <code>bin</code> directory in the distribution and view the [[configuration]] article to get accustomed with the options available.

Revision as of 10:42, 29 November 2010

Installation of Mineserver is generally trouble-free, but this page should offer a little more detail for those who desire it. Right now only source distributions are available; this will change once there is a stable release.

Contents

Binary Packages

This will be written up when there are binary releases available.

Source Distributions

Prerequisites

Mineserver requires 3 external libraries: zlib, libevent and libnoise. The method of obtaining these libraries may differ system to system, so consult your operating system's manual.

General

Installation is generally very simple and consists of just a few steps.

  1. Obtain source
  2. Install prerequisites
  3. Build Mineserver
  4. Edit config

Obtaining the Source Code

The source code for Mineserver is available from GitHub and in future as tarballs for stable revisions.

Checking out the source from git is straightforward: simply clone the repository from GitHub and it's ready to be compiled. An explanation of how to use git is outside the scope of this article, but there are plentiful resources on the topic to be found with your favourite search engine.

Installing prerequisites

Windows

(needs to be filled in)

Debian and Similar

To build software on Debian, the build-essential package is required. This package will provide you with the basic gcc/g++ toolchain. The prerequisites for Mineserver can be found in the packages zlib1g-dev, libevent-dev and libnoise-dev.

CentOS and Red Hat

CentOS, and RHEL do not provide support for libnoise natively. As such we will need to manually compile and install the library.

 wget http://prdownloads.sourceforge.net/libnoise/libnoisesrc-1.0.0.zip?download -O libnoisesrc-1.0.0.zip
 unzip libnoisesrc-1.0.0.zip; cd noise
 less README # Read this 
 make
 cp -R include /usr/local/include/libnoise
 cp lib/* /usr/local/lib
 ln -s /usr/local/lib/libnoise.so.0.3 /usr/local/lib/libnoise.so.0
 ln -s /usr/local/lib/libnoise.so.0.3 /usr/local/lib/libnoise.so
 sudo echo "/usr/local/lib" > /etc/ld.so.conf/user.conf
 sudo /sbin/ldconfig

All other dependancies can be installed with the following commands:

 # Install EPEL (Extra Packages for Enterprise Linux) 
 sudo su -c 'rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm' 
 sudo yum install git libevent libevent-devel zlib zlib-devel

Arch Linux

You can obtain and install the required libnoise package through AUR.

Arch Linux stores the development headers in /usr/local/include/noise and not /usr/local/include/libnoise like the minesever build script thinks it will.

You can either change it in the mineserver source code - or - move it to the right location.

OS X

You can install zlib and libevent using Macports:

sudo port install zlib libevent

You will need to build libnoise yourself. On OS X, this is best done by using qknight's unofficial branch. First install the libnoise prerequisities:

sudo port install cmake doxygen

Now you can get the code:

git clone https://github.com/qknight/libnoise
cd libnoise
mkdir build
cd build
cmake ..
make
sudo make install

Finally, we need to create a symlink so that Mineserver finds the header files where it expects them (this saves us using sed on the source code):

sudo ln -s /usr/local/include/noise /usr/local/include/libnoise
Change the source code

If you want to replace all instances of 'libnoise' with 'noise' in the source code, you can simply run the sed application (it's usually released with all major distributions), like so:

 sed -i 's:libnoise:noise:g' mapgen.{h,cpp}

You can then proceed to run the make command.

Building Mineserver

Windows

(needs to be filled in)

GNU/Linux

To build the mineserver binary, use the following commands. The output should be very similar to that here:

 # Change to the source directory
 user@workstation:~/mineserver$ cd src
 # Run make to build the binary
 user@workstation:~/mineserver/src$ make
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o mineserver.o mineserver.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o map.o map.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o chat.o chat.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o commands.o commands.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o config.o config.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o constants.o constants.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o logger.o logger.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o mapgen.o mapgen.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o nbt.o nbt.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o packets.o packets.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o physics.o physics.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o sockets.o sockets.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o tools.o tools.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o user.o user.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o noiseutils.o noiseutils.cpp
 g++  -I. -I/usr/Local/include -I/usr/include -L/usr/local/lib   -c -o mersenne.o mersenne.cpp
 g++ -L/usr/local/lib -L/usr/lib -lpthread -levent -lz -lnoise  mineserver.o map.o chat.o commands.o
 config.o constants.o logger.o mapgen.o nbt.o packets.o physics.o sockets.o tools.o user.o
 noiseutils.o mersenne.o   -o mineserver
 # Done!
 user@workstation:~/mineserver/src$

If you receive errors referring to missing files like this:

 mineserver.cpp:0:0: error: something.h: No such file or directory
 make: *** [mineserver.o] Error 1

Ensure that you have all the prerequisites installed. zlib.h is zlib, event.h is libevent and noise.h, interp.h or mathconsts.h are libnoise.

OS X

Firstly, until batterseapowers patches are merged, you need to change these lines in src/Makefile:

LDFLAGS = -L/usr/local/lib -L/usr/lib -levent -lz -lnoise $(LFLAGS)
CXXFLAGS = $(DFLAGS) -I. -I/usr/Local/include -I/usr/include

To these:

LDFLAGS += -L/usr/local/lib -L/usr/lib -levent -lz -lnoise $(LFLAGS)
CXXFLAGS += $(DFLAGS) -I. -I/usr/Local/include -I/usr/include

This just allows us to supply some extra LDFLAGS and CXXFLAGS on the command line. Now you can build, ensuring that you point the compiler to any Macports-installed headers and libraries:

cd src
CXXFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib make

Editing the Config

This part is nice and easy. Grab the default config files from the bin directory in the distribution and view the configuration article to get accustomed with the options available.