====== Information ====== * PvPGN-PRO * Git ((https://github.com/pvpgn/pvpgn-server)) * [[Information:Realm of Espionage]] * classic.realmofespionage.xyz ((Battle.net)) ===== Prerequisites ===== * [[distros:fedora_server | Fedora Server]] * [[servers;linux;mariadb | MariaDB]] ===== Notes ===== * Does not support Diablo II patch 1.14d yet * Notes unfinished ====== Create Group and User ====== **** sudo groupadd 'pvpgn' && sudo useradd -c 'PvPGN system account' -d '/var/lib/pvpgn' -g 'pvpgn' -m -r 'pvpgn' ====== Dependencies ====== **** sudo dnf install git cmake gcc-c++ compat-lua-devel ====== Firewall ====== * 6112/tcp is ? * 6200/tcp is ? sudo firewall-cmd --add-port='6112'/'tcp' --permanent && sudo firewall-cmd --add-port='6200'/'tcp' --permanent && sudo firewall-cmd --reload ====== Download Source ====== **** sudo git clone -b 'master' 'https://github.com/pvpgn/pvpgn-server.git' '/srv/pvpgn/src' && sudo chown -R 'pvpgn':'pvpgn' '/srv/pvpgn' && sync ====== Database ====== mysql -u root -p CREATE DATABASE pvpgn; GRANT ALL PRIVILEGES ON pvpgn.* to 'pvpgn'@'localhost' IDENTIFIED BY 'x'; FLUSH PRIVILEGES; ====== Compile ====== * The sed command solves https://github.com/pvpgn/pvpgn-server/issues/265 sudo su 'pvpgn' -s '/usr/bin/bash' sed -i 's#'{SHARE_INSTALL_PREFIX}/man'#'{CMAKE_INSTALL_PREFIX}/man'#g' '/srv/pvpgn/src/cmake/Modules/DefineInstallationPaths.cmake' rm -Rf '/srv/pvpgn/build' '/srv/pvpgn/run' && mkdir -p '/srv/pvpgn/build' '/srv/pvpgn/run' && cd '/srv/pvpgn/build' && cmake '/srv/pvpgn/src' -DCMAKE_INSTALL_PREFIX='/srv/pvpgn/run' -DWITH_MYSQL='1' -DWITH_LUA='1' -DCMAKE_CXX_FLAGS='-O3 -pipe -march=native' -DCMAKE_C_FLAGS='-O3 -pipe -march=native' && sync && make -j3 install && sync ====== Settings ====== ===== bnetd ===== sudo su 'pvpgn' -s '/usr/bin/bash' cp '/srv/pvpgn/run/etc/pvpgn/bnetd.conf' '/srv/pvpgn/run/etc/pvpgn/bnetd-live.conf' nano '/srv/pvpgn/run/etc/pvpgn/bnetd-live.conf' storage_path = "sql:mode=mysql;host=localhost;name=pvpgn;user=pvpgn;pass=x;default=0;prefix=pvpgn_" kick_old_login = false hide_addr = true passfail_count = 5 sync_on_logoff = true location = "Pennsylvania" description = "Realm of Espionage PvPGN Server" url = "https://realmofespionage.xyz" contact_name = "Espionage724" contact_email = "espionage724@x.x" servername = "RoE | PvPGN" use_keepalive = false ===== worldserver ===== sudo su 'trinity' -s '/usr/bin/bash' cp '/srv/trinity/run/etc/worldserver.conf.dist' '/srv/trinity/run/etc/worldserver.conf' nano '/srv/trinity/run/etc/worldserver.conf' TODO ====== Create GM Account ====== sudo su 'trinity' -s '/usr/bin/bash' cd '/srv/trinity/run/bin' && '/srv/trinity/run/bin/worldserver' account create Espionage724 x account set gmlevel Espionage724 3 -1 server shutdown (TODO: Fix this; I'm pretty sure there's more to this command) ====== Other Settings ====== ===== Disable Console ===== * To be done after creating the initial GM account * Future console use should be done over telnet * If worldserver is started as a systemd service, the console being enabled will cause logging spam sudo su 'trinity' -s '/usr/bin/bash' nano '/srv/trinity/run/etc/worldserver.conf' Console.Enable = 0 ===== Realm Information ===== * To be done after databases are initialized * Applies to first realm mysql -u root -p UPDATE `auth`.`realmlist` SET `name` = 'RoE (WotLK)', `address` = 'wow.realmofespionage.xyz' WHERE `realmlist`.`id` = 1; ===== Two-Factor Authentication ===== * To be done after databases are initialized * Applies to first account * token_key must not exceed 16 characters and cannot contain an 8 or a 9 ((this note came from older notes, no idea where these limitations came from or if they're still applicable TODO: Figure this out)) * Add key to Authenticator app mysql -u root -p UPDATE `auth`.`account` SET `token_key` = 'x' WHERE `account`.`id` = 1 ====== Services ====== ===== PvPGN ===== ==== Service ==== sudo -e '/etc/systemd/system/pvpgn.service' && sudo systemctl daemon-reload && sudo systemctl enable 'pvpgn' --now && sudo systemctl status 'pvpgn' -l [Unit] Description=PvPGN Wants=network-online.target After=network-online.target mariadb.service [Service] Type=simple User=pvpgn Group=pvpgn WorkingDirectory=/srv/pvpgn/run/bin ExecStart='/srv/trinity/run/bin/authserver' -c '/srv/trinity/run/etc/authserver.conf' Restart=always RestartSec=5 [Install] WantedBy=multi-user.target ===== Updater ===== ==== Service ==== sudo -e '/etc/systemd/system/pvpgn-up.service' [Service] User=pvpgn Group=pvpgn Type=oneshot WorkingDirectory=/srv/pvpgn/build ExecStart='/usr/bin/git' -C '/srv/pvpgn/src' pull origin 'master' ExecStart='/usr/bin/sed' -i 's#'{SHARE_INSTALL_PREFIX}/man'#'{CMAKE_INSTALL_PREFIX}/man'#g' '/srv/pvpgn/src/cmake/Modules/DefineInstallationPaths.cmake' ExecStart='/usr/bin/cmake' '/srv/pvpgn/src' -DCMAKE_INSTALL_PREFIX='/srv/pvpgn/run' -DWITH_MYSQL='1' -DWITH_LUA='1' -DCMAKE_CXX_FLAGS='-O3 -pipe -march=native' -DCMAKE_C_FLAGS='-O3 -pipe -march=native' ExecStart='/usr/bin/make' -j2 install ExecStart='/usr/bin/sync' ==== Timer ==== sudo -e '/etc/systemd/system/pvpgn-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'pvpgn-up.timer' --now && sudo systemctl start 'pvpgn-up' && sudo systemctl status 'pvpgn-up' -l [Unit] Description=PvPGN Git Updater and Compiler Wants=network-online.target After=network-online.target [Timer] OnCalendar=*-*-* 01:35:00 Persistent=true [Install] WantedBy=timers.target ===== Restarter ===== ==== Service ==== sudo -e '/etc/systemd/system/pvpgn-re.service' [Service] Type=oneshot ExecStart='/usr/bin/systemctl' stop 'pvpgn' ExecStart='/usr/bin/sync' ExecStart='/usr/bin/systemctl' start 'pvpgn' ==== Timer ==== sudo -e '/etc/systemd/system/pvpgn-re.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'pvpgn-re.timer' --now && sudo systemctl start 'pvpgn-re' && sudo systemctl status 'pvpgn-re' -l [Unit] Description=PvPGN Restarter Wants=network-online.target After=network-online.target [Timer] OnCalendar=*-*-* 02:05:00 Persistent=true [Install] WantedBy=timers.target ===== Backup ===== ==== Database Auth ==== sudo -e '/var/lib/mysqlauth/pvpgn' && sudo chmod '600' '/var/lib/mysqlauth/pvpgn' [mysqldump] user=pvpgn password=x ==== Service ==== mkdir -p ~/'backups' && sudo mkdir -p '/var/lib/mysqltmp' && sudo -e '/etc/systemd/system/pvpgn-b.service' && sudo sed -i 's/'CHANGEME'/'$USER'/g' '/etc/systemd/system/pvpgn-b.service' [Service] Type=oneshot WorkingDirectory=/var/lib/mysqltmp ExecStart='/usr/bin/mysqldump' --defaults-extra-file='/var/lib/mysqlauth/pvpgn' --single-transaction 'pvpgn' -r '/var/lib/mysqltmp/pvpgn.sql' ExecStart='/usr/bin/gzip' -f '/var/lib/mysqltmp/pvpgn.sql' ExecStart='/usr/bin/bash' -c '"/usr/bin/mv" "/var/lib/mysqltmp/pvpgn.sql.gz" "/home/CHANGEME/backups/pvpgn-"$$(date +%%Y-%%m-%%d)".sql.gz"' ExecStart='/usr/bin/sync' ==== Timer ==== sudo -e '/etc/systemd/system/pvpgn-b.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'pvpgn-b.timer' --now && sudo systemctl start 'pvpgn-b' && sudo systemctl status 'pvpgn-b' -l [Unit] Description=PvPGN Database Backup After=mariadb.service [Timer] OnCalendar=*-*-* 02:10:00 Persistent=true [Install] WantedBy=timers.target ====== Backup ====== ===== Server ===== ==== Stop Service ==== **** sudo systemctl stop 'pvpgn' ==== Backup Database ==== mysqldump --defaults-extra-file='/var/lib/mysqlauth/pvpgn' --single-transaction 'pvpgn' -r '~/'pvpgn-manual.sql' && sync ===== Client ===== ==== Transfer File To Client ==== **** scp espionage724@192.168.1.154:~/'pvpgn-manual.sql' ~/'Downloads' && sync' ====== Restore ====== ===== Client ===== ==== Transfer File To Server ==== **** scp ~/'Downloads/pvpgn-manual.sql' espionage724@192.168.1.154:~ ==== Remove File ==== **** rm ~/'Downloads/pvpgn-manual.sql' && sync ===== Server ===== ==== Stop Service ==== **** sudo systemctl stop 'pvpgn' ==== Drop Previous Database ==== mysql -u 'root' -p DROP DATABASE pvpgn; FLUSH TABLES; ==== Re-create Database ==== mysql -u 'root' -p CREATE DATABASE pvpgn; ==== Restore Database ==== **** mysql -u 'root' -p 'pvpgn' < ~/'pvpgn-manual.sql' && sync ==== Reapply Permissions ==== mysql -u root -p GRANT ALL PRIVILEGES ON pvpgn.* to 'pvpgn'@'localhost' IDENTIFIED BY 'x'; FLUSH PRIVILEGES; ==== Start Service ==== **** sudo systemctl start 'pvpgn' ==== Remove Backup ==== * Verify that PvPGN-PRO works before running rm ~/'pvpgn-manual.sql' && sync