diff --git a/_database/auto_update.md b/_database/auto_update.md index a7546cbd..03b9aba5 100644 --- a/_database/auto_update.md +++ b/_database/auto_update.md @@ -15,7 +15,7 @@ We made sure that everything was done automatically. After you have compiled AE build only the INSTALL project, and everything you need for auto db updates will be copied. ### *nix systems -Copy the entire sql folder from the fork from github to the dir where you AE running. +After you have compiled AE with 'make' command build the INSTALL project with 'make install' command, and everything you need for auto db updates will be copied. ## Create base databases You are tired of setting up the databases? No problem, AE will take care of it for you. If you have not applied the base databases AE will set it up for you. diff --git a/_docs/installation/linux.md b/_docs/installation/linux.md index d137ceca..5df89eae 100644 --- a/_docs/installation/linux.md +++ b/_docs/installation/linux.md @@ -5,6 +5,24 @@ category: 2 layout: single_markdown --- +### Requirements + +* [Initial Setup](#initial-setup) +* [MySQL Setup](#mysql-setup) +* [Setup MySQL or MariaDB environment](#setup-mysql-or-mariadb-environment) +* [Security and Accounts](#security-and-accounts) +* [Getting the Files](#getting-the-files) +* [Compiling](#compiling) +* [DBC and Map files](#dbc-and-map-files) +* [Logon Database](#logon-database) +* [World Database](#world-database) +* [Configuration Files](#configuration-files) +* [Prepare the Binaries](#prepare-the-binaries) +* [Using Screen](#using-screen) +* [Sample restart script](#sample-restart-script) +* [Create an Account](#create-an-account) +* [Keeping AscEmu updated](#keeping-ascemu-updated) + ### Linux Guide Please note: this guide has been written with the objective of setting up a Linux server running a generic kernel/OS, like Ubuntu/Debian. @@ -14,61 +32,122 @@ This guide file has been written with strict use of the console in mind so it su ### Initial Setup -First, having presumably installed a fresh copy of Linux, we need to update our server so that we can compile AscEmu. This will require several different packages. +First, having presumably installed a fresh copy of Linux, we need to update our server so that we can compile AscEmu. This will require several different packages.
For the following commands, log in as the Linux root administrator. ```console sudo apt-get update && sudo apt-get dist-upgrade -sudo apt-get install g++ git-core git cmake build-essential zlib1g-dev libssl-dev libpcre3-dev libbz2-dev +sudo apt-get install g++ git-core git cmake build-essential zlib1g-dev libssl-dev libpcre3-dev libbz2-dev unzip screen +``` + +Alternatively if you wish to use Clang instead of gcc compiler. + +```console +sudo apt-get install clang ``` +AscEmu supports Clang 16 and higher. By default Debian 12.8 installs Clang 14 so on Debian you must install clang-16 or higher package. +{: .info } + ### MySQL Setup -First we need to install MySQL into Linux as well as make sure that we have the correct libraries to properly operate it. +You have two options here. -
-Only for Debian.
-echo -e "deb http://repo.mysql.com/apt/debian/ stretch mysql-5.7\ndeb-src http://repo.mysql.com/apt/debian/ stretch mysql-5.7" > /etc/apt/sources.list.d/mysql.list
-wget -O /tmp/RPM-GPG-KEY-mysql https://repo.mysql.com/RPM-GPG-KEY-mysql
-apt-key add /tmp/RPM-GPG-KEY-mysql
-apt update
-
+#### 1. Installing MySQL Server + +MySQL server packages are not available in default APT repositories in Debian so there are couple things to do first. +On other distros skip Debian only commands. + +**Debian only** +Download the latest MySQL repository package. Check for the latest version at [MySQL APT page.](https://dev.mysql.com/downloads/repo/apt/) +```console +wget https://dev.mysql.com/get/mysql-apt-config_0.8.33-1_all.deb -O /tmp/mysql-apt-config.deb +``` + +**Debian only** +Install the release package and update APT. +```console +sudo DEBIAN_FRONTEND=noninteractive dpkg -i /tmp/mysql-apt-config.deb +sudo apt-get update +``` + +First we need to install MySQL into Linux as well as make sure that we have the correct libraries to properly operate it. ```console sudo apt-get install mysql-server mysql-client libmysqlclient-dev ``` -By default Ubuntu 18.04 and later use auth_socket for MySQL root password. Let's set up a strong password for root by logging into MySQL. +#### 2. Installing MariaDB Server + +First we need to install MariaDB into Linux as well as make sure that we have the correct libraries to properly operate it. + +```console +sudo apt-get install mariadb-server mariadb-client libmariadb-dev +``` + +### Setup MySQL or MariaDB environment + +It's best to not run AscEmu with your MySQL / MariaDB root account so let's create a new MySQL user which will only have access to your AscEmu MySQL databases. + +First, login to MySQL terminal with your MySQL / MariaDB root account.
+By default MySQL 8.0 and later / MariaDB 10.4 and later use auth_socket which is a passwordless authentication method for root account. ```console sudo mysql ``` -Create the strong and secure password with the following query. + +Next you will create the MySQL user. Please change the respective usernames and passwords to your own unique variants! ```console -ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password'; +CREATE USER 'your_username'@'%' IDENTIFIED BY 'your_password' +WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; ``` -You can now quit the MySQL terminal by simply entering *quit* or *exit*. -To have access to your new MySQL server from other computers, open up the MySQL configuration file with your favourite text editor. +Let's create the databases. Again replace *your_username* with the username you used in the previous step. ```console -sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf +CREATE DATABASE `ascemu_world`; +GRANT ALL PRIVILEGES ON ascemu_world.* TO 'your_username'@'%'; +CREATE DATABASE `ascemu_char`; +GRANT ALL PRIVILEGES ON ascemu_char.* TO 'your_username'@'%'; +CREATE DATABASE `ascemu_logon`; +GRANT ALL PRIVILEGES ON ascemu_logon.* TO 'your_username'@'%'; +FLUSH PRIVILEGES; +quit +``` + +Optionally if you wish to have remote access to your new MySQL / MariaDB server, open up the MySQL configuration file with your favourite text editor. + +MySQL Server: +```console +sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf ``` -And comment out the following line (by adding the #): +MariaDB Server: +```console +sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf +``` + +And change the bind-address to 0.0.0.0
+If there is no bind-address in the file, your MySQL / MariaDB server should already accept remote connections. ```console -#bind-address = 127.0.0.1 +bind-address = 0.0.0.0 ``` -Then save and exit the file and restart the MySQL service. +Then save and exit the file and restart the MySQL / MariaDB service. +MySQL Server: ```console sudo /etc/init.d/mysql restart ``` -That's it! Setting up MySQL is pretty straight forward. +MariaDB Server: +```console +sudo /etc/init.d/mariadb restart +``` + +That's it! Setting up MySQL / MariaDB and databases is pretty straight forward. ### Security and Accounts @@ -118,26 +197,20 @@ mkdir ~/installer mkdir ~/server ``` -As you may have guessed, the installer directory will contain AscEmu source files, and the server directory will contain the actual compiled files (like the libraries and binaries) to run the server. The next step is to download the source files, so we will change to our installer/ascemu_code directory and use git to get the files. +As you may have guessed, the installer directory will contain AscEmu source files, and the server directory will contain the actual compiled files (like the libraries and binaries) to run the server.
+The next step is to download the source files, so we will change to our installer/ascemu_code directory and use git to get the files. ```console mkdir ~/installer/ascemu_code cd ~/installer/ascemu_code ``` -With the -b required_branch, you can select a branch. +With the -b required_branch, you can select a branch (master / develop). {: .info } ```console git clone -b master https://github.com/AscEmu/AscEmu.git ~/installer/ascemu_code ``` -Update the code to the current version. - -```console -cd ~/installer/ascemu_code -git pull origin master -``` - ### Compiling Once we have the source files we can start compiling AscEmu. The first step is to create a configuration file that will be used to pass the variables to the make file so that AscEmu will compile properly. @@ -154,6 +227,13 @@ cd ~/installer/build cmake -DCMAKE_INSTALL_PREFIX=~/server -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_WARNINGS=0 -DBUILD_TOOLS=0 -DASCEMU_VERSION=WotLK ../ascemu_code ``` +If you chose to use Clang compiler you'll need to add two additional variables to cmake command.
+Also, if you had to install i.e. clang-16 instead of default clang package, replace clang with clang-16 and clang++ with clang++-16 in the command. + +```console +cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_INSTALL_PREFIX=~/server -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_WARNINGS=0 -DBUILD_TOOLS=0 -DASCEMU_VERSION=WotLK ../ascemu_code +``` + Here is a quick view of the variables you can include with cmake command:
@@ -162,7 +242,7 @@ Here is a quick view of the variables you can include with cmake command:
 -DBUILD_WITH_WARNINGS = 0 (disabled) or 1 (enabled)
 -DBUILD_TOOLS = 0 (disabled) or 1 (enabled)
 -DASCEMU_VERSION = choose from Classic, TBC, WotLK, Cata or MoP
--DUSE_PCH = 0 (disabled) or 1 (enabled) - Precompiled headers are enabled by default
+-DAE_USE_PCH = 0 (disabled) or 1 (enabled) - Precompiled headers are enabled by default
 
Then we now simply invoke make and make install to install to the prefix directory. @@ -171,8 +251,8 @@ Then we now simply invoke make and make install to install to the prefix directo make && make install ``` -If you have a multicore machine, then you can substitute that final command with this one, where x is equal to the number of cores + 1. For example, with 2 cores x would be 3. -If you want to use all your cores just use a large number like 15. +If you have a multicore machine, then you can substitute that final command with this one, where x is equal to the number of cores + 1. For example, with 2 cores x would be 3.
+If you want to use all your cores just use a large number like 32. {: .info } ```console @@ -199,53 +279,34 @@ mkdir ~/server/dbc mkdir ~/server/maps ``` -Place the DBC and map files in their respective directories above. - -### Config Files +Place the DBC and map files in their respective directories above.
+Extracting Vmap and Mmap files is not required but is **highly** recommended. -All that is left to do is to create the /configs/ directory and move the configuration files there, and make the AscEmu binaries executable. - -```console -cd ~/server -mkdir configs -mv ~/installer/ascemu_code/configs/*.conf ~/server/configs -chmod a+x logon -chmod a+x world -``` +### Logon Database -Now your configuration files are in the .../configs folder ready to be edited, and used by the AscEmu server and your AscEmu binaries are executable. +Next you must apply base logon database manually because there is one column you must change before running your server. -### Database Setup - -It's best to not run AscEmu with your MySQL root account. In this step you will create a new MySQL user which will only have access to your AscEmu MySQL databases. - -First, login to MySQL terminal with your MySQL root account. +Login to MySQL. Replace *your_username* with the username you used in "Setup MySQL / MariaDB environment" section. ```console -mysql -u root -p +mysql -u your_username -p ``` -Next you will create the MySQL user. Please change the respective usernames and passwords to your own unique variants! +Select logon database and execute SQL file. ```console -CREATE USER 'your_username'@'%' IDENTIFIED BY 'your_password' -WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0; +use ascemu_logon; +source ~/server/sql/logon/logon_base.sql ``` -Create the databases. Replace *your_username* with the username you used in the previous step. +Now you must set a password for logonserver. This is an unique password that prevents unauthorized worldservers to register with your logonserver.
+Memorize the password because you'll need it later. ```console -CREATE DATABASE `ascemu_world`; -GRANT ALL PRIVILEGES ON ascemu_world.* TO 'your_username'@'%'; -CREATE DATABASE `ascemu_char`; -GRANT ALL PRIVILEGES ON ascemu_char.* TO 'your_username'@'%'; -CREATE DATABASE `ascemu_logon`; -GRANT ALL PRIVILEGES ON ascemu_logon.* TO 'your_username'@'%'; +UPDATE realms SET password="your_password" WHERE id=1; quit ``` -After you have created the databases, it's time to populate them with the SQL files. - ### World Database AscEmu supports only OneDB world database which is maintained by AscEmu team. OneDB, as the name suggests, has all versions (Classic - Mop) packed into a single database. ![github.svg](/Wiki/images/mark-github.svg) [Link to Github](https://github.com/AscEmu/OneDB/). @@ -258,47 +319,30 @@ cd ~/installer git clone https://github.com/AscEmu/OneDB.git onedb ``` -Go into 'fullDB' folder. - -```console -cd ~/installer/onedb/fullDB -``` - -Next run this command to import all SQL files from the folder into the world database. Replace your_username with the username you created in the previous section. - -This can take a while. +Let's copy the world database to server directory and unzip it. ```console -cat *.sql | mysql -u your_username -p ascemu_world +cp onedb/world_base.zip ~/server/sql/world/ +cd ~/server/sql/world +unzip world_base.zip ``` -Now your world database is populated. +World database is now ready to be applied.
+All future world database updates are added to AscEmu base repository so you don't need to update your OneDB repository. -### Logon and Character Databases +### Configuration Files -Let's move the full SQL folder from AscEmu code to the server folder. +All that is left to do is to create the /configs/ directory and move the configuration files there. ```console cd ~/server -cp -r ~/installer/ascemu_code/sql ./ -cd ~/server/sql -``` - -Now, let's populate the databases. Again, replace your_username with the username you created in Database Setup. - -```console -mysql -u your_username -p ascemu_logon < logon/logon_base.sql -mysql -u your_username -p ascemu_char < character/character_base.sql +mkdir configs +mv ~/installer/ascemu_code/configs/*.conf ~/server/configs ``` -The logonserver and worldserver will automatically execute new or missing SQL updates from the SQL folder. +Now your configuration files are in the ~/server/configs folder ready to be edited, and used by the AscEmu server. -Please note that when there are new SQL updates in the future, they will not automatically transfer to your server folder. You will need to copy the SQL folder again from installer/ascemu/code folder, or apply the updates manually into your database one by one. -{: .info } - -### Configuration Files - -Use an editor of your choice, in this example it'll be **nano**. Make sure to read all config files at least once, so you know what configuration is where and you don't end up with an administrator account with default password you didn't know about ;) +Use an editor of your choice. Make sure to read all config files at least once, so you know what configuration is where and you don't end up with an administrator account with default password you didn't know about ;) ```console cd ~/server/configs @@ -306,9 +350,9 @@ nano logon.conf nano world.conf ``` -### Configuring logon.conf +#### Configuring logon.conf -Enter your MySQL information you created in Database Setup at the the following section. +Enter your MySQL information you created in MySQL Setup at the the following section. ```console ``` -### Configuring world.conf +#### Configuring world.conf + +Enter your MySQL information you created in MySQL Setup at the the following section. + +```console + + + +``` + +Make sure RemotePassword matches the password in realms table in logon database that you set in "Logon Database" section. -Enter your MySQL information you created in Database Setup at the the following section. +```console + +``` + +### Prepare the Binaries + +The very last step is to make the AscEmu binaries executable. ```console - - +cd ~/server +chmod a+x logon +chmod a+x world ``` -That's it! You should now have a fully functioning copy of AscEmu. Look at the sections below for handy scripts and how to create an account. +That's it! You should now have a fully functioning copy of AscEmu.
+When you first time run the binaries your databases are automatically populated and updated to latest version. This process is fully automated. You can read about it [more here.](https://ascemu.github.io/Wiki/database/auto_update/) + +Applying especially world database or some large updates can take some time. +{: .info } ### Using Screen -You may also wish to preserve the AscEmu processes once you've logged out of SSH. To do this, you'll need to install Screen if it isn't installed already. +You may also wish to preserve the AscEmu processes once you've logged out of SSH. This can be done using Screen. The syntax is relatively simple. ```console -screen ./world +screen ./logon ``` -This will run the 'world' program in a new session. To leave this screen and keep it running, press "CTRL + A and then D" to detach. +This will run the 'logon' program in a new session. To leave this screen and keep it running, press "CTRL + A and then D" to detach. + +Next you can start worldserver. + +```console +screen ./world +``` -To return to the screen later on use +To return to the screen session later on use ```console screen --list @@ -402,3 +486,18 @@ setaccpermission example: setaccpermission admin az **For further information about access levels, have a look to this page [GM Access Levels](/Wiki/docs/commands/access_levels/ "GM Access Levels")** + +### Keeping AscEmu updated + +Keeping your AscEmu up-to-date is pretty straightforward. You only need to pull new changes from AscEmu repository, compile and start the server. + +Again, replace X in make command with a high number if you have a multicore machine. +```console +cd ~/installer/ascemu_code +git pull +cd ~/installer/build +make -j X && make install +cd ~/server +``` + +Now you are again ready to start server. Automatic database updater will apply new SQL updates automatically. \ No newline at end of file