Difference between revisions of "User:Paxed/HowTo setup dgamelaunch"

From NetHackWiki
Jump to navigation Jump to search
(first info, from when i last set up a server...)
 
(Compile dgamelaunch: fixed dir name)
 
(8 intermediate revisions by one other user not shown)
Line 1: Line 1:
Note: This is still a work-in-progress, and applies to NetHack 3.4.3 and the svn-version of [[dgamelaunch]], on linux.
+
'''Note''': This applies to NetHack 3.4.3 and the git-version of [[dgamelaunch]], on linux. These instructions should be complete, but I haven't tested it lately.
  
 
----
 
----
 
==Setup==
 
==Setup==
  
To set up a public NetHack server using dgamelaunch svn version:
+
To set up a public NetHack server using dgamelaunch git version:
  
 
===Compile NetHack===
 
===Compile NetHack===
*Make sure you can compile NetHack (the Linux TTY version).
+
*Make sure you can [[compile]] NetHack (the Linux TTY version).
  
*Edit include/config.h and change HACKDIR to "/nh343" (Note that there are more than one definition of HACKDIR in there!)
+
*Edit <code>src/cmd.c</code> and change function enter_explore_mode() so users cannot do that.
  
*Edit include/unixconf.h and change VAR_PLAYGROUND to "/nh343/var"
+
*Edit <code>src/topten.c</code>:
 +
**Change <code>NAMSZ</code> if you want to use longer usernames.
 +
**Change <code>ENTRYMAX</code> if you want the highscore list have more entries.
 +
**Comment out <code>#define PERS_IS_UID</code>, so that NetHack distinguishes users by their name, not by their UID.
  
*Edit top Makefile by commenting all lines that reference $SHELLDIR (We don't need to install the shellscript that is usually used to launch NetHack)
+
*If you want watchers to be able to send mail scrolls, get dgamelaunch sources and apply the <code>nh343-simple_mail.diff</code> patch that comes with it.
  
*Edit top Makefile by changing PREFIX to the directory which will be the chroot environment and contain all the files the server needs. We'll be using "/opt/nethack/nethack.alt.org" here as an example.
+
*Edit <code>include/config.h</code> and change <code>HACKDIR</code> to <code>"/nh343"</code> (Note that there are more than one definition of HACKDIR in there!)
  
*Edit top Makefile by changing GAMEDIR to $(PREFIX)/nh343 (This must match HACKDIR in include/config.h)
+
*Edit <code>include/unixconf.h</code> and change <code>VAR_PLAYGROUND</code> to <code>"/nh343/var"</code>
  
*Edit top Makefile by changing VARDIR to $(GAMEDIR)/var (This must match VAR_PLAYGROUND in include/unixconf.h)
+
*Edit top Makefile by commenting all lines that reference <code>$SHELLDIR</code> (We don't need to install the shellscript that is usually used to launch NetHack)
  
*Edit top Makefile by changing GAMEUID and GAMEGRP to the user and group you will run nethack as; by default these are '''games''' and '''games''' in dgl settings.
+
*Edit top Makefile by changing <code>PREFIX</code> to the directory which will be the chroot environment and contain all the files the server needs. We'll be using <code>"/opt/nethack/nethack.alt.org"</code> here as an example.
  
*Create the binaries with "make all". If things went smoothly, do "make install" (or "make update" if you've already installed NetHack once to the chroot dir)
+
*Edit top Makefile by changing <code>GAMEDIR</code> to <code>$(PREFIX)/nh343</code> (This must match HACKDIR in include/config.h)
 +
 
 +
*Edit top Makefile by changing <code>VARDIR</code> to <code>$(GAMEDIR)/var</code> (This must match VAR_PLAYGROUND in include/unixconf.h)
 +
 
 +
*Edit top Makefile by changing <code>GAMEUID</code> and <code>GAMEGRP</code> to the user and group you will run nethack as; by default these are '''games''' and '''games''' in dgl settings.
 +
 
 +
*Create the binaries with "<code>make all</code>". If things went smoothly, do "<code>make install</code>" (or "<code>make update</code>" if you've already installed NetHack once to the chroot dir)
  
 
*Continue on to dgamelaunch compiling.
 
*Continue on to dgamelaunch compiling.
  
 
===Compile dgamelaunch===
 
===Compile dgamelaunch===
*You need subversion and autoconf -packages, plus SQLite development libraries.
+
*You need:
 +
**git to get the dgamelaunch sources
 +
**autoconf -packages
 +
**SQLite development libraries
 +
**bison (or yacc or byacc) (You should already have this if you compiled NetHack)
 +
**flex (or lex) (You should already have this if you compiled NetHack)
 +
**ncurses and ncurses development libraries (You should already have these if you compiled NetHack)
  
 
*get the newest version of dgamelaunch:
 
*get the newest version of dgamelaunch:
**svn co svn://triplehelix.org/dgamelaunch/trunk
+
git clone https://github.com/paxed/dgamelaunch.git
  
 
*Prepare for compilation:
 
*Prepare for compilation:
  cd trunk
+
  cd dgamelaunch
 
  ./autogen.sh --enable-sqlite --enable-shmem --with-config-file=/opt/nethack/nethack.alt.org/etc/dgamelaunch.conf
 
  ./autogen.sh --enable-sqlite --enable-shmem --with-config-file=/opt/nethack/nethack.alt.org/etc/dgamelaunch.conf
  
*Make dgamelaunch with 'make'
+
*Make dgamelaunch with "<code>make</code>"
  
 
*Edit dgl-create-chroot and change the default settings to match your chroot location and so on, then execute dgl-create-chroot. It should copy all the necessary files and put them into the chroot environment.
 
*Edit dgl-create-chroot and change the default settings to match your chroot location and so on, then execute dgl-create-chroot. It should copy all the necessary files and put them into the chroot environment.
Line 46: Line 61:
  
 
*Edit /opt/nethack/nethack.alt.org/etc/dgamelaunch.conf to suit your needs:
 
*Edit /opt/nethack/nethack.alt.org/etc/dgamelaunch.conf to suit your needs:
** 'max_nick_len' should be kept at 10, unless you change NAMSZ in src/topten.c and recompile NetHack.
+
** 'max_nick_len' should be kept at 10, unless you changed NAMSZ in NetHack's src/topten.c.
** 'chroot_path' should be "/opt/nethack/nethack.alt.org/"
+
** 'chroot_path' should be whatever you used as the chroot location in dgl-create-chroot.
 
 
  
 
===Testing the setup===
 
===Testing the setup===
Line 57: Line 71:
 
*If NetHack doesn't start but you get a complaint about missing file or directory:
 
*If NetHack doesn't start but you get a complaint about missing file or directory:
 
  chroot: cannot run command `nh343/nethack': No such file or directory
 
  chroot: cannot run command `nh343/nethack': No such file or directory
That usually means some dynamic library isn't present in the chroot. Use "ldd nethack" to see what dynamic link libraries are needed.
+
That usually means some dynamic library isn't present in the chroot. Use "<code>ldd nethack</code>" to see what dynamic link libraries are needed.
  
*If you get a complaint about unknown terminal type, that means there's some problem with the terminfo files. Check that there is a terminfo file in the chroot that corresponds to your $TERM setting.
+
*If you get a complaint about unknown terminal type, that means there's some problem with the terminfo files. Check that there is a terminfo file in the chroot that corresponds to your <code>$TERM</code> setting.
  
*Set up the telnetd to accept incoming connections, for example if you're using xinetd:
+
*Set up the telnetd to accept incoming connections, for example if you're using xinetd, you might put this in <code>/etc/xinetd.d/dgl</code>:
 
  service telnet
 
  service telnet
 
  {
 
  {
Line 72: Line 86:
 
         rlimit_cpu      = 120
 
         rlimit_cpu      = 120
 
  }
 
  }
 +
Or if you're using inetd, add the following line to <code>/etc/inetd.conf</code>:
 +
telnet stream tcp nowait root.root /usr/sbin/tcpd /usr/sbin/in.telnetd -h -L /opt/nethack/nethack.alt.org/dgamelaunch

Latest revision as of 19:23, 16 September 2014

Note: This applies to NetHack 3.4.3 and the git-version of dgamelaunch, on linux. These instructions should be complete, but I haven't tested it lately.


Setup

To set up a public NetHack server using dgamelaunch git version:

Compile NetHack

  • Make sure you can compile NetHack (the Linux TTY version).
  • Edit src/cmd.c and change function enter_explore_mode() so users cannot do that.
  • Edit src/topten.c:
    • Change NAMSZ if you want to use longer usernames.
    • Change ENTRYMAX if you want the highscore list have more entries.
    • Comment out #define PERS_IS_UID, so that NetHack distinguishes users by their name, not by their UID.
  • If you want watchers to be able to send mail scrolls, get dgamelaunch sources and apply the nh343-simple_mail.diff patch that comes with it.
  • Edit include/config.h and change HACKDIR to "/nh343" (Note that there are more than one definition of HACKDIR in there!)
  • Edit include/unixconf.h and change VAR_PLAYGROUND to "/nh343/var"
  • Edit top Makefile by commenting all lines that reference $SHELLDIR (We don't need to install the shellscript that is usually used to launch NetHack)
  • Edit top Makefile by changing PREFIX to the directory which will be the chroot environment and contain all the files the server needs. We'll be using "/opt/nethack/nethack.alt.org" here as an example.
  • Edit top Makefile by changing GAMEDIR to $(PREFIX)/nh343 (This must match HACKDIR in include/config.h)
  • Edit top Makefile by changing VARDIR to $(GAMEDIR)/var (This must match VAR_PLAYGROUND in include/unixconf.h)
  • Edit top Makefile by changing GAMEUID and GAMEGRP to the user and group you will run nethack as; by default these are games and games in dgl settings.
  • Create the binaries with "make all". If things went smoothly, do "make install" (or "make update" if you've already installed NetHack once to the chroot dir)
  • Continue on to dgamelaunch compiling.

Compile dgamelaunch

  • You need:
    • git to get the dgamelaunch sources
    • autoconf -packages
    • SQLite development libraries
    • bison (or yacc or byacc) (You should already have this if you compiled NetHack)
    • flex (or lex) (You should already have this if you compiled NetHack)
    • ncurses and ncurses development libraries (You should already have these if you compiled NetHack)
  • get the newest version of dgamelaunch:
git clone https://github.com/paxed/dgamelaunch.git
  • Prepare for compilation:
cd dgamelaunch
./autogen.sh --enable-sqlite --enable-shmem --with-config-file=/opt/nethack/nethack.alt.org/etc/dgamelaunch.conf
  • Make dgamelaunch with "make"
  • Edit dgl-create-chroot and change the default settings to match your chroot location and so on, then execute dgl-create-chroot. It should copy all the necessary files and put them into the chroot environment.
  • Test that you can run dgamelaunch (as root):
cd /opt/nethack/nethack.alt.org
./dgamelaunch
  • Edit /opt/nethack/nethack.alt.org/etc/dgamelaunch.conf to suit your needs:
    • 'max_nick_len' should be kept at 10, unless you changed NAMSZ in NetHack's src/topten.c.
    • 'chroot_path' should be whatever you used as the chroot location in dgl-create-chroot.

Testing the setup

  • Test that you can run the nethack inside the chroot environment, by doing the following as root:
cd /opt/nethack/nethack.alt.org
chroot ./ nh343/nethack
  • If NetHack doesn't start but you get a complaint about missing file or directory:
chroot: cannot run command `nh343/nethack': No such file or directory

That usually means some dynamic library isn't present in the chroot. Use "ldd nethack" to see what dynamic link libraries are needed.

  • If you get a complaint about unknown terminal type, that means there's some problem with the terminfo files. Check that there is a terminfo file in the chroot that corresponds to your $TERM setting.
  • Set up the telnetd to accept incoming connections, for example if you're using xinetd, you might put this in /etc/xinetd.d/dgl:
service telnet
{
       socket_type     = stream
       protocol        = tcp
       user            = root
       wait            = no
       server          = /usr/sbin/in.telnetd
       server_args     = -L /opt/nethack/nethack.alt.org/dgamelaunch
       rlimit_cpu      = 120
}

Or if you're using inetd, add the following line to /etc/inetd.conf:

telnet stream tcp nowait root.root /usr/sbin/tcpd /usr/sbin/in.telnetd -h -L /opt/nethack/nethack.alt.org/dgamelaunch