L2JMobius

Start database installer in Linux with .sh

Mobius · 3 · 2996

Online Mobius

  • Distinguished King
  • *****
    • Posts: 16032
I do not use Linux, I need help from someone that does.
The idea is to start Database_Installer_GS.jar via an .sh file.
So with the Database_Installer_GS.exe it will be included a Database_Installer_GS.sh

Based on the source Database_Installer_GS.jar MUST run with parameters.
Code: [Select]
/**
 * Contains main class for Database Installer If system doesn't support the graphical UI, start the installer in console mode.
 * @author mrTJO
 */
public class LauncherGS extends AbstractDBLauncher
{
public static void main(String[] args) throws Exception
{
final String defDatabase = "l2jmobiusc6";
final String dir = "sql/game/";

if ((args != null) && (args.length > 0))
{
new DBInstallerConsole(defDatabase, dir, getArg("-h", args), getArg("-p", args), getArg("-u", args), getArg("-pw", args), getArg("-d", args), getArg("-m", args));
return;
}

try
{
// Set OS Look And Feel
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception e)
{
// Ignore.
}

try
{
new DBConfigGUI(defDatabase, dir);
}
catch (HeadlessException e)
{
new DBInstallerConsole(defDatabase, dir);
}
}
}

and
Code: [Select]
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode)So the parameters are: host, port, user, pass, database, mode

Mode based on
if ((mode != null) && ("c".equalsIgnoreCase(mode) || "u".equalsIgnoreCase(mode)))
is either c or u


Offline Trance

  • Elder
  • ****
    • Posts: 126
Running Mobius on Linux/CentOS 7/8.
This is what I'm personally using every time I reinstall and configure CentOS 8.

Code: [Select]
sudo yum update
OpenJDK 14:

Code: [Select]
sudo yum -y install curl

curl -O https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_linux-x64_bin.tar.gz

tar xvf openjdk-14_linux-x64_bin.tar.gz

sudo mv jdk-14 /opt/

sudo tee /etc/profile.d/jdk14.sh <<EOF
export JAVA_HOME=/opt/jdk-14
export PATH=\$PATH:\$JAVA_HOME/bin
EOF

source /etc/profile.d/jdk14.sh

Checking it:

Code: [Select]
echo $JAVA_HOME
java -version



MariaDB

Code: [Select]
sudo yum install mariadb-server

sudo systemctl enable mariadb
sudo systemctl start mariadb

Setting the default root password and a few other settings:

Code: [Select]
sudo mysql_secure_installation
Db, users, etc.

Code: [Select]
mysql -u root -p
CREATE DATABASE l2jmobiusclassicinterlude;
CREATE USER 'dbuser123'@'localhost' IDENTIFIED BY 'ThisIsAPasswordChangeMe';
GRANT ALL ON l2jmobiusclassicinterlude.* to 'dbuser123'@'localhost' IDENTIFIED BY 'ThisIsAPasswordChangeMe' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;




Useful commands:

---
Privileges to LS/GS - only once is needed

Code: [Select]
cd server/login/
chmod +x LoginServer.sh LoginServerTask.sh
cd
cd server/game/
chmod +x GameServer.sh GameServerTask.sh
chmod +x start.sh start_loop.sh
---
Start LS/GS

Code: [Select]
cd server/login/
./LoginServer.sh
cd
cd server/game/
./GameServer.sh
tail -f log/stdout.log
"tail -f log/stdout.log" will show you the console, so you can also run it inside the LS folder to see it.

---
Kill LS/GS

Code: [Select]
ps aux | grep java
Code: [Select]
kill -9 47111 (process number)


FTP Server:

If you install CentOS 8 you usually get to choose to have it preinstalled.

Code: [Select]
sudo yum install ftp vsftpd

sudo nano /etc/vsftpd/vsftpd.conf
Code: [Select]
anonymous_enable=NO
ascii_upload_enable=YES
ascii_download_enable=YES
ftpd_banner=Welcome to UNIXMEN FTP service.
use_localtime=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
file_open_mode=0777

Code: [Select]
sudo systemctl enable vsftpd
sudo systemctl start vsftpd

You save a .conf file with CTRL+X then (Y)Yes.


Offline DebiaN

  • Vassal
  • *
    • Posts: 9
If you'll put a live server dont forget to edit:

1.: Limits. https://rtcamp.com/tutorials/linux/increase-open-files-limit/
2.: Tune database server. (i think only increasing max_connections and raise a bit innodb_buffer_pool_size)
3.: Network Stack and kernel. https://github.com/klaver/sysctl
4.: Secure restrictions access, iptables. https://www.ipfire.org