Difference between revisions of "Talk:Installation (CentOS)"
Dastgirpojee (Talk | contribs) (Created page with "This guide covers how to install Hercules on CentOS and other versions of Linux that use [[wikiped...") |
Revision as of 05:47, 28 September 2013
This guide covers how to install Hercules on CentOS and other versions of Linux that use yum.
Contents |
Requirements
- CentOS or an RPM-based Linux that has the yum command
- root access or access to an account that has sudo privileges
- an Internet connection to download install packages
Prerequisites
All of these commands will be typed at the command-line interface.
Install Prerequisites
- Login to your server via SSH, or if you are already logged into a 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)
-
yum install gcc make mysql mysql-devel mysql-server pcre-devel git zlib-devel
-
- (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 Herculesas root.
- 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
-
- 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.
- Run this command and follow the prompts:
-
mysql_secure_installation
-
- Login to your MySQL Server as root:
- When prompted, enter your root MySQL password.
-
mysql --user=root -p
- Now your prompt should look like this (the MySQL command prompt):
-
mysql>
- In case your mysql server isn't started, you may have to start it with:
-
/etc/init.d/mysqld start
-
Create SQL database for Hercules
- At the MySQL prompt, type this to create a database (replace
hercules1234
with the Linux username you created earlier):-
mysql> CREATE DATABASE hercules1234_rag;
-
- Create a separate database for logs:
-
mysql> CREATE DATABASE hercules1234_log;
-
Setup a MySQL user for Hercules
- 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
-
- 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)
- Logout from root SSH (or minimize the window).
- Login to your server via SSH as the hercules1234Linux user.
Git Clone
To download Hercules, you need to perform a clone from Git (Git) repository. Checking out from a repository creates a working copy of it on your local machine.
A Git is required to perform a clone. Recommended applications are:
- git for Unix systems
- MSysGit And TortoiseGit for Windows systems (Both Required
Unix
For detailed instructions on how to install subversion, please refer to OS specific installation guides.
Type the following to create a Hercules working copy in your home (~) directory
git clone https://github.com/HerculesWS/Hercules.git ~/Hercules
Windows
Check Obtaining Hercules for info on how to clone in windows
Import MySQL Tables
- Change directory to the sql-files folder.
-
cd trunk/sql-files/
-
- Execute these commands:
- When prompted, enter your MySQL root password.
-
mysql -u root -prootpassword hercules1234_rag < main.sql
-
mysql -u root -prootpassword hercules1234_rag < item_db.sql
-
mysql -u root -prootpassword hercules1234_rag < item_db2.sql
-
mysql -u root -prootpassword hercules1234_rag < mob_db.sql
-
mysql -u root -prootpassword hercules1234_rag < mob_db2.sql
-
mysql -u root -prootpassword hercules1234_rag < mob_skill_db.sql
-
mysql -u root -prootpassword hercules1234_rag < mob_skill_db2.sql
-
mysql -u root -prootpassword hercules1234_log < logs.sql
- If you are using Renewal you also have to import the following
-
mysql -u root -prootpassword hercules1234_log < item_db_re.sql
-
mysql -u root -prootpassword hercules1234_log < item_db2_re.sql
-
mysql -u root -prootpassword hercules1234_log < mob_db_re.sql
-
mysql -u root -prootpassword hercules1234_log < mob_skill_db_re.sql
-
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
- map-server: mapreg, item_db, item_db2, mob_db, mob_db2
- char-server: everything else + global_reg_value once again
Note that global_reg_value tables are needed by both login-server and char-server (though it may be different tables)
Configure Hercules
Compile Source Code
cd trunk ./configure make sql
- If you're using CentOS 32-bit please use:
./configure --disable-64bit
How to Recompile
In the future (after you update or edit any file in /src) to recompile, add make clean before make sql:
cd trunk ./configure make clean make sql
Start your HerculesServer
//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