FreeBSD 10.2 Stable Server Setup Guide edited*3/17/16

KOSMOS
Posts: 67
Joined: Thu Jan 29, 2015 10:36 pm

FreeBSD 10.2 Stable Server Setup Guide edited*3/17/16

Post by KOSMOS » Sat Mar 12, 2016 12:04 am

Building Darkstar on FreeBSD 10.2

This is a work in progress, I get it to build and run the game no problem now, still working out a few issues. Main one I know of right now is that any gm/@ command crashes the game server.

I choose to install everything from ports I like to have full control of source and how programs install.

First log in as root
# su
password:"enter your password"

Second update ports
# portsnap fetch
# portsnap extract


I find it easier to install sudo and add my user to visudo
# cd /usr/ports/security/sudo/ && make install clean
default install
# visudo
add this to file
user ALL=(ALL) ALL

I also like to have bash installed
# cd /usr/ports/shells/bash/ && make install clean
# echo /usr/local/bin/bash >> /etc/shells
# chsh -s /usr/local/bin/bash

Install git from ports
# cd /usr/ports/devel/git/ && make install clean
add subversion to default install

Install libzmq4
# cd /usr/ports/net/libzmq4/ && make install clean

Install czmq
# cd /usr/ports/net/czmq/ && make install clean

Install luajit
# cd /usr/ports/lang/luajit/ && make install clean

Install Autotools
# cd /usr/ports/devel/autotools/ && make install clean
default setup

Install gcc5
# cd /usr/ports/lang/gcc5/ && make install clean
default setup

Install GDB
# cd /usr/ports/devel/gdb/ && make install clean

Install MySQL
# cd /usr/ports/databases/mysql56-server/ && make install clean

Setup to autoboot
# echo 'mysql_enable="YES"' >> /etc/rc.conf

Start MySQL
# /usr/local/etc/rc.d/mysql-server start

Adding exports to .bashrc file
# ee /home/yourusername/.bashrc
*Add these lines
export LD_LIBRARY_PATH="/usr/local/lib/gcc5"
export CPPFLAGS='-I /usr/local/include'
export LDFLAGS='-l /usr/local/lib'

Add zmq.hpp file to includes
This file can be found at https://github.com/zeromq/cppzmq/blob/master/zmq.hpp
The raw of the file is at https://raw.githubusercontent.com/zerom ... er/zmq.hpp
# ee /usr/local/include/zmq.hpp

Download Darkstar Source
# git clone http://github.com/DarkstarProject/darkstar.git/

Get into directory
# cd /darkstar

Setting up MySQL

Setting up MySQL passwords/database
# mysql -u root
SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd-here');
SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd-here');
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd-here');
CREATE USER 'darkstar'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE dspdb;
USE dspdb;
GRANT ALL PRIVILEGES ON dspdb.* TO 'darkstar'@'localhost';
exit

Populate the database
*! If this is a upgrade this will override all of you server information!!!!
cd /darkstar/sql

Make the below into a script

Code: Select all

#!/usr/local/bin/bash
for f in *.sql
  do
     echo -n "Importing $f into the database..."
     mysql dspdb -u darkstar -ppassword < $f && echo "Success"      
  done
Run the script
# chmod 755 ./name_of_script
# ./name_of_script

Set Zone IP
# mysql -u darkstar -ppassword
USE dspdb;
UPDATE zone_settings SET zoneip = '127.0.0.1';
exit

Exit root!
# exit
*Do this till it fully exits root


Compile the Server
# sudo sh autogen.sh
# sudo ./configure --enable-debug=gdb
# sudo make


Configuring Server edit with your database information
# cd /darkstar/conf
# sudo ee login_darkstar.conf
# sudo ee map_darkstar.conf
# sudo ee search_server.conf

Start servers and exit root!
# exit
# cd /darkstar
# ./dsconnect
# ./dsgame
# ./dssearch
Last edited by KOSMOS on Thu Mar 17, 2016 10:25 pm, edited 4 times in total.

KOSMOS
Posts: 67
Joined: Thu Jan 29, 2015 10:36 pm

Re: FreeBSD 10.2 Stable Server Setup Guide

Post by KOSMOS » Sat Mar 12, 2016 8:17 am

Think I have figured out why the gm commands are throwing the error. Think it is calling for the wrong lua library. I can hopefully figure this over the next few days. When I figure out the solution I will post and modify the main post.

KOSMOS
Posts: 67
Joined: Thu Jan 29, 2015 10:36 pm

Re: FreeBSD 10.2 Stable Server Setup Guide edited*3/17/16

Post by KOSMOS » Thu Mar 17, 2016 8:16 am

Ok so figured out what is throwing the error is it the injection of (rc=0) on line 406 of the zmq.hpp file for FreeBSD. Wondering if anyone that has built on any other version of linux/unix besides Ubuntu ever ran into this problem and if they have found a work around?

This is the code that is kicked out when I run a GM command.

Code: Select all

[Warning] Memory manager: Memory leaks found and fixed.
Assertion failed: (rc == 0), function ~context_t, file /usr/local/include/zmq.hpp, line 406.
Abort trap
The zmq.hpp file is not standard when you install libzmq4 or libzmq3 on FreeBSD. I have the file that people are using in my guide above. If anyone has any help or pointers I would greatly appreciate it. Next step will be to use external libraries which is something I would highly like to avoid.

Thanks
Kosmos

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: FreeBSD 10.2 Stable Server Setup Guide edited*3/17/16

Post by kjLotus » Thu Mar 17, 2016 6:16 pm

make sure there isn't a zmq c++ connector package already that you can use

KOSMOS
Posts: 67
Joined: Thu Jan 29, 2015 10:36 pm

Re: FreeBSD 10.2 Stable Server Setup Guide edited*3/17/16

Post by KOSMOS » Thu Mar 17, 2016 9:21 pm

kjLotus wrote:make sure there isn't a zmq c++ connector package already that you can use
Think I found something, not a 100% sure though.

czmq High-level C Binding for ZeroMQ?
https://www.freshports.org/net/czmq/

Had to change to libzmq4 for it, rebuilding now. About to see if that did fix it.

Thanks
Kosmos

KOSMOS
Posts: 67
Joined: Thu Jan 29, 2015 10:36 pm

Re: FreeBSD 10.2 Stable Server Setup Guide edited*3/17/16

Post by KOSMOS » Thu Mar 17, 2016 10:28 pm

KOSMOS wrote:
kjLotus wrote:make sure there isn't a zmq c++ connector package already that you can use
Think I found something, not a 100% sure though.

czmq High-level C Binding for ZeroMQ?
https://www.freshports.org/net/czmq/

Had to change to libzmq4 for it, rebuilding now. About to see if that did fix it.

Thanks
Kosmos
Well that did not seem to fix the issue. Or I need to setup an export to it I am missing maybe? Or if you can think of any possible work around for this I am open to any ideas or suggestions.

Thanks,
Kosmos

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: FreeBSD 10.2 Stable Server Setup Guide edited*3/17/16

Post by kjLotus » Thu Mar 17, 2016 11:42 pm

you need the actual c++ zmq wrapper library, and not any other

actually, you just need the header files (that we use), but you have to use the same libzmq library that we use - pretty sure its version 4

KOSMOS
Posts: 67
Joined: Thu Jan 29, 2015 10:36 pm

Re: FreeBSD 10.2 Stable Server Setup Guide edited*3/17/16

Post by KOSMOS » Fri Mar 18, 2016 7:51 am

kjLotus wrote:you need the actual c++ zmq wrapper library, and not any other

actually, you just need the header files (that we use), but you have to use the same libzmq library that we use - pretty sure its version 4
I have libzmq4 installed and use the header file from here https://github.com/zeromq/cppzmq which I am pretty sure the one that you are using and is current. If it is not can you give me a link to the proper file?

I have searched and looked for something else, but pretty sure this is what is required for this to run correctly. Before I got the zmq.hpp file from github it would not build. Now that it is in my include folder is builds completely fine, all things work expect for GM commands. I have tested near everything on server that uses lua in any fashion the only thing that throws the error are GM commands and it is always that one section of code that throws it.

Or would this maybe work better? https://github.com/zeromq/azmq

KOSMOS
Posts: 67
Joined: Thu Jan 29, 2015 10:36 pm

Re: FreeBSD 10.2 Stable Server Setup Guide edited*3/17/16

Post by KOSMOS » Tue Mar 22, 2016 7:46 pm

While this does build on this and is semi functional, since zeromq is not supported on it yet I am holding off on using FreeBSD. If anyone does want to use this I would be gladly to help out. I decided to use Debian Wheezy for now till either Devuan gets gcc5 or FreeBSD gets zeromq. I just really want to use a system that does not use systemd. I will post a guide for Wheezy if anyone wants though I do not plan to keep using it for long, the only reason I was posting this guide was cause I planned to test against it regularly.

Kosmos

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: FreeBSD 10.2 Stable Server Setup Guide edited*3/17/16

Post by whasf » Wed Mar 23, 2016 6:21 pm

FreeBSD woo! The two VMs I have are quite old, but they're still chugging along..
uname -a
FreeBSD alicia.house.local 4.11-STABLE FreeBSD 4.11-STABLE #1: Tue Oct 4 10:26:02 EDT 2005 root@alicia.home.local:/usr/obj/usr/src/sys/ALICIA i386
6:25PM up 330 days, 15:27, 1 user, load averages: 0.00, 0.00, 0.00
uname -a
FreeBSD lucky.home.local 6.2-RELEASE FreeBSD 6.2-RELEASE #3: Wed Jul 25 13:40:08 EDT 2007 root@lucky.home.local:/usr/obj/usr/src/sys/LUCKY i386
6:17PM up 330 days, 15:13, 1 user, load averages: 0.00, 0.00, 0.00
-- Whasf

Post Reply