Joined: 28 Jul 2006
|Posted: Mon Jun 13, 2011 11:29 Post subject: HOWTO: Compile & run nwnx2-core-2.8 on 64bit Debian/Ubun
|To properly run nwserver with the newest plugins & addons on a 32bit distribution, you need to provide all dynamic linking requirements (like libmysqlclient). This is easy, because you just need to apt-get install them (and the ./install.sh script tells you which ones).
nwnx2 however, does not compile against or run with native 64bit libraries, due to intrinsic details (nwserver being purely 32bit among them).
This "howto" assumes a few crucial things and prequisites:
- You actually want to build nwnx2 yourself and not use the prebuilt binaries.
- You are running Debian or Ubuntu 64bit (will not apply to other distros like RHEL or CentOS). This here is NOT neccessary if you run a 32bit distribution. You can just use ./install.sh there. You can check your distribution by typing uname -m. x86 is 32bit, x86_64 is 64bit respectively.
- You have root access.
- Your nwn server runs as it's own distinct user. This is VERY STRONGLY recommended, alone from a security standpoint.
- You know how to use ssh, edit files and install packages without breaking anything.
The easiest way, on Debian, Ubuntu and similars, is to compile & run nwnx2 inside a chroot. A chroot system is a complete system distribution living inside a subdirectory below your root (/), which you can "change root" into.
This will be a very brief and hopefully useful guide to setting up such a chroot for nearly transparent usage.
As usual, commands pefixed with # are meant to be run as root, $ as the user your NWN runs with.
First, you need to create a chroot:
|# debootstrap --arch i386 squeeze /nwx86 |
Please note the "squeeze", which is the current stable distribution of debian. If you're using Ubuntu server, you'll be using one of the ubuntuified version names (maverick, for example). The above command will install your new chroot into /nwx86 (you can change it, but if you do, change it everywhere).
After downloading and unpacking a few hundred megabytes, your chroot is basically ready. However, you need to make it useable for your nwserver user. There's a little tool called "schroot", which you will install now:
|# apt-get install schroot |
And, after installing, configure schroot by pasting this into the bottom of /etc/schroot/schroot.conf (take care not to add comments in front, and replacing the username with your nwserver user):
Now it's as simple as typing:
To run a command inside the chroot.
However, we're not done yet. We need to somehow map the directory where all your nwn-related files reside into the chroot environ.
|# mount --bind /home /nwx86/home |
This howto assumes that your nwserver code resides inside /home, and the above command will simply mount a "link" to your regular /home inside the chroot.
If you want this done automatically on the next host reboot, add the following to /etc/fstab in a new line (pay particular attention here, breaking this file might render your system non-bootable):
/home /nwx86 none bind 0 0
Now all that is left will be installing all the required dependant libraries. You can do that by using schroot as root, for example:
(and any others ./install.sh will later on moan about).
|# schroot apt-get install autoconf make build-essential gcc g++ zlib1g-dev |
Switch to your nwserver user, and check out the nwnx2 code:
|$ git clone https://github.com/NWNX/nwnx2-linux.git |
$ cd nwnx2-linux
$ schroot ./install.sh
If it complains about your regular user not being allowed to enter the chroot, you didn't adjust the config in /etc/schroot/schroot.conf as directed above.
This should get you started. It will ask a few questions, direct you to install further packages (which you will need to install as root via schroot apt-get install ..) and finally and hopefully build libraries.
When everything is said and done, you will probably have to run the server itself inside a chroot too. This is as simple as doing schroot ./nwstartup.sh.
(Typed down tersely in one go. Comments & improvements welcome, of course)
Last edited by elven on Sun Feb 16, 2014 20:10; edited 3 times in total