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

From NetHackWiki
Jump to navigation Jump to search
m (link to compile)
m (formatting)
Line 9: Line 9:
 
*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>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 include/unixconf.h and change VAR_PLAYGROUND to "/nh343/var"
+
*Edit <code>include/unixconf.h</code> and change <code>VAR_PLAYGROUND</code> to <code>"/nh343/var"</code>
  
*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 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 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 <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.
  
*Edit top Makefile by changing GAMEDIR to $(PREFIX)/nh343 (This must match HACKDIR in include/config.h)
+
*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 VARDIR to $(GAMEDIR)/var (This must match VAR_PLAYGROUND in include/unixconf.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 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>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 "make all". If things went smoothly, do "make install" (or "make update" if you've already installed NetHack once to the chroot dir)
+
*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.
Line 31: Line 31:
  
 
*get the newest version of dgamelaunch:
 
*get the newest version of dgamelaunch:
**svn co svn://triplehelix.org/dgamelaunch/trunk
+
svn co svn://triplehelix.org/dgamelaunch/trunk
  
 
*Prepare for compilation:
 
*Prepare for compilation:
Line 37: Line 37:
 
  ./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 57: Line 57:
 
*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:

Revision as of 13:25, 28 November 2010

Note: This applies to NetHack 3.4.3 and the svn-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 svn version:

Compile NetHack

  • 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 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 subversion and autoconf -packages, plus SQLite development libraries.
  • get the newest version of dgamelaunch:
svn co svn://triplehelix.org/dgamelaunch/trunk
  • Prepare for compilation:
cd trunk
./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 change NAMSZ in src/topten.c and recompile NetHack.
    • 'chroot_path' should be "/opt/nethack/nethack.alt.org/"


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:
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
}