5.8 KiB
5.8 KiB
Knight Online Login Server - Linux Version
This directory contains the Linux-compatible version of the Knight Online Login Server.
Prerequisites
Before building and running the Login Server on Linux, make sure you have the following dependencies installed:
Ubuntu/Debian
sudo apt-get update
sudo apt-get install build-essential cmake g++ unixodbc-dev
CentOS/RHEL/Fedora
# CentOS/RHEL
sudo yum groupinstall "Development Tools"
sudo yum install cmake unixODBC-devel
# Fedora
sudo dnf groupinstall "Development Tools"
sudo dnf install cmake unixODBC-devel
Building the Server
Quick Start
# Make build script executable
chmod +x build.sh
# Build everything
./build.sh all
Manual Build Steps
# 1. Make scripts executable
chmod +x build.sh loginserver.sh
# 2. Build the project
./build.sh build
# 3. Install binaries
./build.sh install
Build Options
./build.sh clean # Clean build files
./build.sh build # Build project
./build.sh rebuild # Clean and build
./build.sh install # Install binaries
./build.sh all # Full build and install
./build.sh -j 4 build # Build with 4 parallel jobs
Configuration
Database Setup
- Install and configure your ODBC driver for your database
- Edit
LogIn.iniwith your database connection details:
[ODBC]
DSN=KO_MAIN
UID=your_username
PWD=your_password
Server Configuration
Edit LogIn.ini to configure server settings:
[SETTINGS]
PORT=15100
[SERVER_LIST]
COUNT=1
SERVER_00=192.168.1.104
LANIP_00=192.168.1.104
NAME_00=Your Server Name
ID_00=1
Running the Server
Start the Server
./loginserver.sh start
Check Server Status
./loginserver.sh status
View Server Logs
./loginserver.sh logs
Stop the Server
./loginserver.sh stop
Restart the Server
./loginserver.sh restart
Management Commands
The loginserver.sh script provides several management commands:
start- Start the login serverstop- Stop the login serverrestart- Restart the login serverstatus- Show server status and process informationlogs- View server logs in real-timeconfig- Create default configuration file
File Structure
LoginServer/
├── bin/ # Compiled binaries
│ └── LoginServer # Main server executable
├── build/ # CMake build directory
├── Logs/ # Server log files
│ ├── LoginServer.log # Main server log
│ ├── Login_DD_MM_YYYY.log # Daily user login log
│ └── server_output.log # Server console output
├── build.sh # Build script
├── loginserver.sh # Server management script
├── LogIn.ini # Server configuration
├── CMakeLists.txt # CMake configuration
└── README_LINUX.md # This file
Troubleshooting
Common Issues
1. Build Failures
- Make sure all dependencies are installed
- Check that you have sufficient permissions
- Verify CMake version (3.10 or higher required)
2. ODBC Connection Issues
# Test ODBC connection
isql -v DSN_NAME username password
# List available ODBC drivers
odbcinst -q -d
# List configured DSNs
odbcinst -q -s
3. Permission Issues
# Make scripts executable
chmod +x build.sh loginserver.sh
# Check binary permissions
chmod +x bin/LoginServer
4. Port Already in Use
# Check what's using the port
sudo netstat -tlnp | grep :15100
# Kill process using the port
sudo kill -9 PID
Debugging
Enable Debug Mode
Edit CMakeLists.txt and add debug flags:
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DDEBUG")
Run with GDB
gdb ./bin/LoginServer
(gdb) run
Monitor System Resources
# Monitor server process
top -p $(cat loginserver.pid)
# Check memory usage
cat /proc/$(cat loginserver.pid)/status
# Monitor network connections
ss -tlnp | grep LoginServer
Security Considerations
-
Firewall Configuration
# Allow login server port sudo ufw allow 15100/tcp -
User Permissions
- Run the server as a non-root user
- Set appropriate file permissions
- Use a dedicated service user
-
Database Security
- Use strong database passwords
- Limit database user permissions
- Enable database connection encryption
Integration with Gitea
This server is configured to work with the Gitea repository at:
- Local:
http://192.168.1.104:3000/ - SSH:
ssh://gitea@192.168.1.104:2222/leventferrah/knightonline.git
Deployment Workflow
# Pull latest changes
git pull knight main
# Build and deploy
./build.sh all
# Restart server
./loginserver.sh restart
Performance Tuning
System Limits
Edit /etc/security/limits.conf:
username soft nofile 65536
username hard nofile 65536
Network Optimization
Edit /etc/sysctl.conf:
net.core.somaxconn = 1024
net.ipv4.tcp_max_syn_backlog = 1024
Monitoring
Log Monitoring
# Monitor all logs
tail -f Logs/*.log
# Monitor specific log
tail -f Logs/LoginServer.log
Process Monitoring
# Check if server is running
./loginserver.sh status
# Monitor resource usage
watch -n 1 './loginserver.sh status'
Support
For issues and support:
- Check the server logs in
Logs/directory - Verify configuration in
LogIn.ini - Test database connectivity
- Check network connectivity and firewall settings
Version Information
- Server Version: Knight Online Login Server v1.0
- Platform: Linux (Ubuntu/CentOS/Debian compatible)
- Build System: CMake 3.10+
- Compiler: GCC 7+
- Dependencies: ODBC, pthread