Bonjour,
Voici comment installer Starloco (Emulateur dofus) avec adminer + cdn.
Installer les dépendances :
CentOS / Fedora / RHEL
yum install -y epel-release
yum install -y nginx java-1.8.0-openjdk java-1.8.0-openjdk-devel mariadb-server wget unzip pv
yum install -y php-fpm php-pdo php-mysqlnd php-mysqli php-mbstring php-curl php-json php-opcache php-intl php-gd
systemctl enable --now mariadb
Debian
apt install -y nginx mariadb-server wget unzip pv apt-transport-https
mkdir -p /etc/apt/keyrings
wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc
echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt update && apt install -y temurin-8-jre temurin-8-jdk
apt install -y php-fpm php-pdo php-mysqlnd php-mysqli php-mbstring php-curl php-json php-opcache php-intl php-gd
systemctl enable --now mariadb
Configurer MariaDB :
mysql_secure_installation
mysql -u root -p
CREATE DATABASE starloco_login CHARACTER SET utf8 COLLATE utf8_bin;
CREATE DATABASE starloco_game CHARACTER SET utf8 COLLATE utf8_bin;
CREATE DATABASE starloco_web CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'starloco'@localhost IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON starloco_login.* TO 'starloco'@localhost WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON starloco_game.* TO 'starloco'@localhost WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON starloco_web.* TO 'starloco'@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT
Télécharger les DB :
wget https://github.com/StarLoco/StarLoco-Game/raw/master/game.sql
wget https://raw.githubusercontent.com/liberodark/StarLoco-Login/Fix-DB-for-Website/login.sql
wget https://github.com/liberodark/StarLoco-Web/raw/v2/starloco_web.sql
Importer les DB :
pv login.sql | mysql -u starloco -pmy_password starloco_login
pv game.sql | mysql -u starloco -pmy_password starloco_game
pv starloco_web.sql | mysql -u starloco -pmy_password starloco_web
Désactiver l'IPv6 : (Optionnel)
echo "net.ipv6.conf.all.disable_ipv6 = 1" > /etc/sysctl.d/disable-ipv6.conf
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.d/disable-ipv6.conf
Création des dossiers :
mkdir -p /opt/starloco
mkdir -p /var/www/web
mkdir -p /var/www/dofus
mkdir -p /var/www/adminer
Télécharger Adminer :
wget -O /var/www/adminer/index.php https://github.com/vrana/adminer/releases/download/v4.8.1/adminer-4.8.1-mysql.php
chown -R nginx: /var/www/adminer
Installer Starloco :
mkdir -p /opt/starloco/game
curl -L -o /opt/starloco/game/game.jar https://github.com/StarLoco/StarLoco-Game/releases/download/v1.0.3/game.jar
mkdir -p /opt/starloco/login
curl -L -o /opt/starloco/game/login.jar https://github.com/StarLoco/StarLoco-Login/releases/download/v1.0.0/login.jar
Créer le run.sh :
echo "/usr/bin/java -jar login.jar" > /opt/starloco/login/run.sh
echo "/usr/bin/java -jar game.jar" > /opt/starloco/game/run.sh
Rendre exécutable le run.sh :
chmod +x /opt/starloco/login/run.sh
chmod +x /opt/starloco/game/run.sh
Configurer Game & Login :
Config Game :
nano /opt/starloco/game/game.config.properties
# StarLoco - Game. By Locos.#Auto-Generated Config File
#System
system.server.exchange.ip 0.0.0.0
system.server.exchange.port 666
system.server.exchange.key YOUR_KEY
system.server.encyption false
system.server.debug true
system.server.logs true
#Login database
database.login.host 127.0.0.1
database.login.port 3306
database.login.user starloco
database.login.pass my_password
database.login.name starloco_login
#Game database
database.game.host 127.0.0.1
database.game.port 3306
database.game.user starloco
database.game.pass my_password
database.game.name starloco_game
#Game server
system.server.game.ip YOUR_SERVER_IP
system.server.game.port 5555
system.server.game.id 601
system.server.game.key eratz
system.server.game.version 1.39.8
system.server.game.rate.xp 1
system.server.game.rate.drop 1
system.server.game.rate.dropThreshold 1
system.server.game.rate.honor 1
system.server.game.rate.kamas 1
system.server.game.rate.job 1
system.server.game.rate.fm 1
system.server.game.start.message
system.server.game.start.level 1
system.server.game.start.kamas 0
system.server.game.start.map -1
system.server.game.start.cell -1
system.server.game.limitByIp 8
system.server.game.subscription false
system.server.game.autoReboot false
system.server.game.resetLimit true
system.server.game.maxPets false
system.server.game.allZaap false
system.server.game.allEmotes false
system.server.game.allowMulePvp false
system.server.game.timeByTurn 30
system.server.game.mode.christmas false
system.server.game.mode.halloween false
system.server.game.mode.heroic false
system.server.game.mode.event false
system.server.game.timeBetweenEvent 60
Config Login :
nano /opt/starloco/login/login.config.properties
# StarLoco - Login. By Locos.
#Auto-Generated Config File
#System
system.server.exchange.ip 0.0.0.0
system.server.exchange.port 666
system.server.exchange.key YOUR_KEY
#Login server
system.server.login.ip 0.0.0.0
system.server.login.port 450
system.server.login.version 1.39.8
database.login.host 127.0.0.1
database.login.port 3306
database.login.user starloco
database.login.pass my_password
database.login.name starloco_login
Installer les Services :
Service Game :
nano /etc/systemd/system/starloco-game.service
[Unit]
Description=Starloco 1.0.3
After=network.target
After=mariadb.service
After=starloco-login.service
[Service]
Type=simple
WorkingDirectory=/opt/starloco/game
User=root
Group=root
#LimitNOFILE=65536
ExecStart=/opt/starloco/game/run.sh
ExecStop=/bin/kill $MAINPID
KillMode=process
[Install]
WantedBy=multi-user.target
Service Login :
nano /etc/systemd/system/starloco-login.service
[Unit]
Description=Starloco 1.0.3
After=network.target
After=mariadb.service
[Service]
Type=simple
WorkingDirectory=/opt/starloco/login
User=root
Group=root
#LimitNOFILE=65536
ExecStart=/opt/starloco/login/run.sh
ExecStop=/bin/kill $MAINPID
KillMode=process
[Install]
WantedBy=multi-user.target
systemctl enable --now starloco-login
systemctl enable --now starloco-game
Configurer Nginx :
nano /etc/nginx/conf.d/starloco.conf
server {
listen 80;
location / {
return 301 https://$host$request_uri;
}
location /dofus {
# Path to source
alias /var/www/dofus/;
autoindex off;
error_log /var/log/nginx/dofus_access.log;
access_log /var/log/nginx/dofus_error.log;
}
}
server {
listen 443 ssl http2;
server_name my.domain.com;
# SSL Configuration
ssl_certificate /etc/letsencrypt/live/my.domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/my.domaine.com/privkey.pem;
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384";
ssl_prefer_server_ciphers on;
# See https://hstspreload.org/ before uncommenting the line below.
# add_header Strict-Transport-Security "max-age=15768000; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header Content-Security-Policy "frame-ancestors 'self'";
add_header X-Frame-Options DENY;
add_header Referrer-Policy same-origin;
location / {
# Path to source
alias /var/www/web/;
autoindex off;
# Logs
error_log /var/log/nginx/starloco_access.log;
access_log /var/log/nginx/starloco_error.log;
# Default indexes and catch-all
index index.php;
try_files $uri $uri/ /index.php?$args;
# Prevent useless logs
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny access to hidden files and directories
location ~ ^/(.+/|)\.(?!well-known\/) {
deny all;
}
# Execute and serve PHP files
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_read_timeout 600;
}
}
location /adminer {
# Path to source
alias /var/www/adminer/;
# Logs
error_log /var/log/nginx/adminer_access.log;
access_log /var/log/nginx/adminer_error.log;
# Default indexes and catch-all
index index.php;
try_files $uri $uri/ /index.php?$args;
# Deny access to hidden files and directories
location ~ ^/(.+/|)\.(?!well-known\/) {
deny all;
}
# Upload Size.
client_max_body_size 30m;
# Execute and serve PHP files
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_read_timeout 600;
}
}
}
systemctl enable --now nginx
Installer Gradle 8.4 : (Optionnel)
wget https://downloads.gradle.org/distributions/gradle-8.4-bin.zip
unzip -d /opt/gradle gradle-8.4-bin.zip
rm -f gradle-8.4-bin.zip
Ajouter Gradle à votre profile d’environnement : (Optionnel)
echo 'export GRADLE_HOME=/opt/gradle/gradle-8.4' > /etc/profile.d/gradle.sh
echo 'export PATH=${GRADLE_HOME}/bin:${PATH}' >> /etc/profile.d/gradle.sh
chmod +x /etc/profile.d/gradle.sh
Installer Starloco avec git : (Optionnel)
yum install -y git
cd /opt/starloco
git clone https://github.com/StarLoco/StarLoco-Game
mv StarLoco-Game game
git clone https://github.com/StarLoco/StarLoco-Login
mv StarLoco-Login login
Exemple de run.sh pour un usage avec git : (Optionnel)
Créer le run.sh :
nano /opt/starloco/game/run.sh && chmod +x /opt/starloco/game/run.sh
#!/bin/bash
source /etc/profile.d/gradle.sh
bin="game.jar"
# Move to the game directory
cd "$(dirname "$(realpath "$0")")" || exit
if ! netstat -tnlp | grep 5555 > /dev/null 2>&1; then
echo "Port 5555 is not Used"
else
echo "Port 5555 is Used"
exit 0
fi
# Build game
#/usr/bin/git restore .
/usr/bin/git pull || exit
rm -f ${bin}
gradle jar || exit
cp -a build/libs/${bin} ./${bin} || exit
rm -rf build || exit
# Run the game
exec /usr/bin/java -jar ${bin} "$@"
exit 0
nano /opt/starloco/login/run.sh && chmod +x /opt/starloco/login/run.sh
#!/bin/bash
source /etc/profile.d/gradle.sh
bin="login.jar"
# Move to the game directory
cd "$(dirname "$(realpath "$0")")" || exit
if ! netstat -tnlp | grep 450 > /dev/null 2>&1; then
echo "Port 450 is not Used"
else
echo "Port 450 is Used"
exit 0
fi
# Build game
/usr/bin/git pull || exit
rm -f ${bin}
gradle jar || exit
cp -a build/libs/${bin} ./${bin} || exit
rm -rf build || exit
# Run the game
exec /usr/bin/java -jar ${bin} "$@"
exit 0
En cours de rédaction...