Skip to content

Instantly share code, notes, and snippets.

@mtijanic
Last active December 5, 2020 12:09
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtijanic/0f9369bb5430f4b31906241f5c6c1ebe to your computer and use it in GitHub Desktop.
Save mtijanic/0f9369bb5430f4b31906241f5c6c1ebe to your computer and use it in GitHub Desktop.
#
# THIS FILE IS OUTDATED. The new version can be found at:
# https://github.com/mtijanic/nwn-misc/blob/master/nwnx-server-setup/nwnx-setup.sh
#
# This file contains the old instructions for 32bit and is only kept for historic reasons.
# If you are not sure which version you want, you want the one linked above, not this one.
#
# On a clean Ubuntu 18.04 Desktop install:
# Install necessary prereqs
sudo dpkg --add-architecture i386
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt upgrade
sudo apt install g++-7 g++-7-multilib gcc-7 gcc-7-multilib cmake git make
sudo apt install mysql-server libmysqlclient20:i386 libmysqlclient-dev:i386
# Download and build NWNX
git clone https://github.com/nwnxee/unified.git nwnx
mkdir nwnx/build && cd nwnx/build
cmake "CC=gcc-7 -m32 CXX=g++-7 -m32" -DCMAKE_BUILD_TYPE=RelWithDebInfo ../
make -j6
# Download NWN dedicated package
mkdir ~/nwn && cd ~/nwn
wget https://nwnx.io/nwnee-dedicated-8166.zip
unzip nwnee-dedicated-8166.zip -d .
# Run it once to create the user directory
cd bin/linux-x86 && ./nwserver-linux
# Link to user directory for easier access
ln -s ~/.local/share/Neverwinter\ Nights/ ~/nwn/userdir
# Copy module/hak/tlk/etc to ~/nwn/userdir
# Edit ~/nwn/userdir/nwnplayer.ini
# Set up version control on the servervault
cd ~/nwn/userdir/servervault
git init
git config --global user.name = "My Name"
git config --global user.email = "my@email.com"
# Set up the Database
sudo mysql
mysql> USE mysql;
mysql> CREATE USER 'nwn'@'localhost' IDENTIFIED BY 'pass';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'nwn'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> CREATE DATABASE mymodulename;
mysql> exit;
# Download the script pack
# mod-start.sh - starts the server unless already running
# mod-stop.sh - kills the server
# mod-disable.sh - disables server auto restart
# mod-enable.sh - enables server auto restart
# mod-savechars.sh - saves servervault/ to git
# mod-status.sh - returns 1 if server is running, 0 if not
cd ~/nwn
wget https://transfer.sh/R0VE/scripts.tar.gz
tar -xvzf scripts.tar.gz
chmod +x *.sh
mkdir ~/logs
nano mod-start.sh #fill in module name
# Set up cronjob for auto server restart every minute
crontab -e
# Add this line to the tab
*/1 * * * * ~/mod-start.sh
# Start server
./mod-start.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment