Difference between revisions of "Installation (CentOS)"

From Hercules Wiki
Jump to: navigation, search
m (Reverted edits by Gmclerk (talk) to last revision by Dastgirpojee)
 
(24 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Incomplete}}
 
 
 
This guide covers how to install [[Hercules]] on [[wikipedia:CentOS|CentOS]] and other [[wikipedia:List_of_Linux_distributions#RPM-based|versions of Linux]] that use [[wikipedia:Yellowdog_Updater,_Modified|yum]].
 
This guide covers how to install [[Hercules]] on [[wikipedia:CentOS|CentOS]] and other [[wikipedia:List_of_Linux_distributions#RPM-based|versions of Linux]] that use [[wikipedia:Yellowdog_Updater,_Modified|yum]].
  
Line 13: Line 11:
 
=== Install Prerequisites ===
 
=== Install Prerequisites ===
 
# Login to your server via [[wikipedia:Secure_Shell|SSH]], or if you are already logged into a [[wikipedia:Graphical_user_interface|GUI]] press Ctrl+Alt+T to open a terminal window.
 
# Login to your server via [[wikipedia:Secure_Shell|SSH]], or if you are already logged into a [[wikipedia:Graphical_user_interface|GUI]] press Ctrl+Alt+T to open a terminal window.
# Type the following command (this will install GCC, Make, MySQL, MySQL header files, MySQL Server, PCRE header files, Subversion, and Zlib header files)  
+
# Type the following command (this will install GCC, Make, MySQL, MySQL header files, MySQL Server, PCRE header files, Git, and Zlib header files)  
#: <pre>yum install gcc make mysql mysql-devel mysql-server pcre-devel subversion zlib-devel</pre>
+
#: <pre>yum install gcc make mysql mysql-devel mysql-server pcre-devel git zlib-devel</pre>
 
# (Optional) type the following command to install some additional packages:  
 
# (Optional) type the following command to install some additional packages:  
 
#: <pre>yum -y install dos2unix gdb nano screen unzip wget zip</pre>
 
#: <pre>yum -y install dos2unix gdb nano screen unzip wget zip</pre>
Line 34: Line 32:
 
The default MySQL Server install creates a MySQL user 'root'@'localhost' with NO password. It is recommended you create a password for the root user.  
 
The default MySQL Server install creates a MySQL user 'root'@'localhost' with NO password. It is recommended you create a password for the root user.  
 
# Run this command and follow the prompts:  
 
# Run this command and follow the prompts:  
 +
#: Firest Start MySQL:
 +
#: <pre>/etc/init.d/mysqld start </pre>
 +
#: Then configure MySQL by:
 
#: <pre>mysql_secure_installation</pre>
 
#: <pre>mysql_secure_installation</pre>
 
# Login to your MySQL Server as root:  
 
# Login to your MySQL Server as root:  
Line 40: Line 41:
 
# Now your prompt should look like this (the MySQL command prompt):  
 
# Now your prompt should look like this (the MySQL command prompt):  
 
#: <pre>mysql> </pre>
 
#: <pre>mysql> </pre>
#: ''In case your mysql server isn't started, you may have to start it with:''
 
#: <pre>/etc/init.d/mysqld start </pre>
 
  
 
==== Create SQL database for Hercules ====
 
==== Create SQL database for Hercules ====
Line 66: Line 65:
 
# Login to your server via SSH as the hercules1234 Linux user.
 
# Login to your server via SSH as the hercules1234 Linux user.
  
=== SVN Checkout ===
+
=== Git Clone ===
{{:SVN Checkout/Unix}}
+
{{:Git Clone/Unix}}
  
 
=== [http://dev.mysql.com/doc/refman/5.5/en/batch-commands.html Import] MySQL Tables ===
 
=== [http://dev.mysql.com/doc/refman/5.5/en/batch-commands.html Import] MySQL Tables ===
 
# Change directory to the '''sql-files''' folder.
 
# Change directory to the '''sql-files''' folder.
#: <pre>cd trunk/sql-files/</pre>
+
#: <pre>cd sql-files/</pre>
 
# Execute these commands:  
 
# Execute these commands:  
 
#: ''When prompted, enter your MySQL root password.''
 
#: ''When prompted, enter your MySQL root password.''
#: <pre>mysql -u root -prootpassword hercules1234_rag < main.sql</pre>
+
#: <pre>mysql -u root -prootpassword hercuser_rodb < main.sql</pre>
#: <pre>mysql -u root -prootpassword hercules1234_rag < item_db.sql</pre>
+
#: <pre>mysql -u root -prootpassword hercuser_rodblog < logs.sql</pre>
#: <pre>mysql -u root -prootpassword hercules1234_rag < item_db2.sql</pre>
+
# If your Control Panel software or website requires it, you may also import the item, monster and monster skill databases (not necessary for the correct operation of Hercules)
#: <pre>mysql -u root -prootpassword hercules1234_rag < mob_db.sql</pre>
+
#: (pre-renewal)
#: <pre>mysql -u root -prootpassword hercules1234_rag < mob_db2.sql</pre>
+
#: <pre>mysql -u root -prootpassword hercuser_rodb < item_db.sql</pre>
#: <pre>mysql -u root -prootpassword hercules1234_rag < mob_skill_db.sql</pre>
+
#: <pre>mysql -u root -prootpassword hercuser_rodb < mob_db.sql</pre>
#: <pre>mysql -u root -prootpassword hercules1234_rag < mob_skill_db2.sql</pre>
+
#: <pre>mysql -u root -prootpassword hercuser_rodb < mob_skill_db.sql</pre>
#: <pre>mysql -u root -prootpassword hercules1234_log < logs.sql</pre>
+
#: (renewal)
# If you are using Renewal you also have to import the following
+
#: <pre>mysql -u root -prootpassword hercuser_rodb < item_db_re.sql</pre>
#: <pre>mysql -u root -prootpassword hercules1234_log < item_db_re.sql</pre>
+
#: <pre>mysql -u root -prootpassword hercuser_rodb < mob_db_re.sql</pre>
#: <pre>mysql -u root -prootpassword hercules1234_log < item_db2_re.sql</pre>
+
#: <pre>mysql -u root -prootpassword hercuser_rodb < mob_skill_db_re.sql</pre>
#: <pre>mysql -u root -prootpassword hercules1234_log < mob_db_re.sql</pre>
+
#: (common to renewal and pre-renewal)
#: <pre>mysql -u root -prootpassword hercules1234_log < mob_skill_db_re.sql</pre>
+
#: <pre>mysql -u root -prootpassword hercuser_rodb < item_db2.sql</pre>
 +
#: <pre>mysql -u root -prootpassword hercuser_rodb < mob_db2.sql</pre>
 +
#: <pre>mysql -u root -prootpassword hercuser_rodb < mob_skill_db2.sql</pre>
  
 
NOTE: if you want to use different SQL DBs for login/char/map servers this is the list of databases each server use:
 
NOTE: if you want to use different SQL DBs for login/char/map servers this is the list of databases each server use:
#login-server: global_reg_value, ipbanlist, login, loginlog
+
#login-server: global_acc_reg_num_db, global_acc_reg_str_db, ipbanlist, login, loginlog
#map-server: mapreg, item_db, item_db2, mob_db, mob_db2
+
#map-server: autotrade_data, autotrade_merchants, mapreg, npc_market_data
#char-server: everything else + global_reg_value once again
+
#char-server: everything else
Note that global_reg_value tables are needed by both login-server and char-server (though it may be different tables)
+
Note that the sql_updates table is needed by all three servers.
  
 
=== [[:Category:Configuration|Configure Hercules]]===
 
=== [[:Category:Configuration|Configure Hercules]]===
  
 
=== Compile Source Code ===
 
=== Compile Source Code ===
  cd trunk
+
  cd Hercules
 
  ./configure
 
  ./configure
 
  make sql
 
  make sql
 
*If you're using CentOS 32-bit please use:
 
./configure --disable-64bit
 
  
 
===== How to Recompile =====
 
===== How to Recompile =====
 
In the future (after you update or edit any file in /src) to recompile, add ''make clean'' before make sql:  
 
In the future (after you update or edit any file in /src) to recompile, add ''make clean'' before make sql:  
  cd trunk
+
  cd Hercules
 
  ./configure
 
  ./configure
 
  '''make clean'''
 
  '''make clean'''

Latest revision as of 18:53, 10 June 2016

This guide covers how to install Hercules on CentOS and other versions of Linux that use yum.

Contents

Requirements


Prerequisites

All of these commands will be typed at the command-line interface.

Install Prerequisites

  1. Login to your server via SSH, or if you are already logged into a GUI press Ctrl+Alt+T to open a terminal window.
  2. Type the following command (this will install GCC, Make, MySQL, MySQL header files, MySQL Server, PCRE header files, Git, and Zlib header files)
    yum install gcc make mysql mysql-devel mysql-server pcre-devel git zlib-devel
  3. (Optional) type the following command to install some additional packages:
    yum -y install dos2unix gdb nano screen unzip wget zip

Create a non-root Linux user

By the principle of least privilege, it is recommended you do NOT run Hercules as root.

  1. Type the following command to create a non-root Linux account:
    useradd --create-home --shell /bin/bash hercules1234
    --create-home = create the user's home directory
    --shell = sets their login shell to Bash
    hercules1234 = the login name of the new Linux account
    1234 = pick your own random numbers to make the username more unique
  2. Set a password for the new user (run this command and follow the prompts):
    passwd hercules1234

Configure MySQL

Set a root password

The default MySQL Server install creates a MySQL user 'root'@'localhost' with NO password. It is recommended you create a password for the root user.

  1. Run this command and follow the prompts:
    Firest Start MySQL:
    /etc/init.d/mysqld start 
    Then configure MySQL by:
    mysql_secure_installation
  2. Login to your MySQL Server as root:
    When prompted, enter your root MySQL password.
    mysql --user=root -p
  3. Now your prompt should look like this (the MySQL command prompt):
    mysql> 

Create SQL database for Hercules

  1. At the MySQL prompt, type this to create a database (replace hercules1234 with the Linux username you created earlier):
    mysql> CREATE DATABASE hercules1234_rag;
  2. Create a separate database for logs:
    mysql> CREATE DATABASE hercules1234_log;

Setup a MySQL user for Hercules

  1. At the MySQL prompt, type something like this to create a new MySQL user:
    mysql> CREATE USER 'hercules1234'@'localhost' IDENTIFIED BY 'secretpassword';
    hercules1234 = the name of the MySQL user (we named it the same as the Linux user to make it easier to identify)
    localhost = the hostname or IP it will connect from
    secretpassword = the password for this MySQL user
  2. Grant privileges to the 'hercules' MySQL user:
    mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON `hercules1234\_rag`.* TO 'hercules1234'@'localhost';
    mysql> GRANT SELECT,INSERT ON `hercules1234\_log`.* TO 'hercules1234'@'localhost';
    (note the escaped underscore)

Install Hercules

Login as your non-root Linux user

The rest of the setup is done as hercules1234 (the Linux user you created in step 2.2)

  1. Logout from root SSH (or minimize the window).
  2. Login to your server via SSH as the hercules1234 Linux user.

Git Clone

Type the following to create a Hercules working copy in your home (~) directory

  git clone https://github.com/HerculesWS/Hercules.git ~/Hercules

Import MySQL Tables

  1. Change directory to the sql-files folder.
    cd sql-files/
  2. Execute these commands:
    When prompted, enter your MySQL root password.
    mysql -u root -prootpassword hercuser_rodb < main.sql
    mysql -u root -prootpassword hercuser_rodblog < logs.sql
  3. If your Control Panel software or website requires it, you may also import the item, monster and monster skill databases (not necessary for the correct operation of Hercules)
    (pre-renewal)
    mysql -u root -prootpassword hercuser_rodb < item_db.sql
    mysql -u root -prootpassword hercuser_rodb < mob_db.sql
    mysql -u root -prootpassword hercuser_rodb < mob_skill_db.sql
    (renewal)
    mysql -u root -prootpassword hercuser_rodb < item_db_re.sql
    mysql -u root -prootpassword hercuser_rodb < mob_db_re.sql
    mysql -u root -prootpassword hercuser_rodb < mob_skill_db_re.sql
    (common to renewal and pre-renewal)
    mysql -u root -prootpassword hercuser_rodb < item_db2.sql
    mysql -u root -prootpassword hercuser_rodb < mob_db2.sql
    mysql -u root -prootpassword hercuser_rodb < mob_skill_db2.sql

NOTE: if you want to use different SQL DBs for login/char/map servers this is the list of databases each server use:

  1. login-server: global_acc_reg_num_db, global_acc_reg_str_db, ipbanlist, login, loginlog
  2. map-server: autotrade_data, autotrade_merchants, mapreg, npc_market_data
  3. char-server: everything else

Note that the sql_updates table is needed by all three servers.

Configure Hercules

Compile Source Code

cd Hercules
./configure
make sql
How to Recompile

In the future (after you update or edit any file in /src) to recompile, add make clean before make sql:

cd Hercules
./configure
make clean
make sql

Start your Hercules Server

//change access mode of athena-start file so that you can execute it.
//Use (dos2unix athena-start) if yo uare getting ^M errors ie. newline errors 
chmod a+x athena-start
//To Start
./athena-start start
//To Stop
./athena-start stop
//To Restart
./athena-start restart

See Also