## 2. Install compilation tools
-cmake(>3.0.2)
-g++
## 3. Connect resources
- In the roserver root directory
- ./create_make.sh ~/rores
- Comment out the files that are not found in the code
## 4. Install and compile dependent software
- Install mysql-devel, mysql version
```sh
yum install mysql-devel
yum install mysql-community-server.x86_64
```
## 5. Compile server
- cd to roserver/Build/Debug
- Enter the gameserver, controlserver, masterserver, dbserver, gateserver, loginserver directories respectively.
- Execute make
- Comment out the files that are not found in the code
## 6. Configure mysql
- Start mysql
- Run the .sql files under each folder in roserver/exe once
- Add a piece of server information to the gateinfo table under database login
(Example server_id channel state is_open server_name zone_name ipaddr free_ipaddr register_account online_role open_time full_register_time combine_serverid
11 1 1 1 mzx sywc 10.0.128.138:11110 0 0 2017-05-04 08:00:00 2017-05-04 08:00:00 0)
- **Possible problems:**
- (1) mysql cannot be started
The error message is that there is already a file in a certain folder. Modify the path pointed to by data in /etc/my.cnf.
- (2) mysql query and modify the initial password query and modify
```sh
grep "temporary password" /var/log/mysqld.log
mysqladmin -u root -p oldpasswd password newpasswd
```
- (3) Timestamp default value invalid when running .sql
The most direct way to modify sql_mode
```sh
set sql_mode='';
```
## 7. Generate and modify the server configuration file
- Run conf_create.py under roserver/Build/Debug/bin
- Modify the xml files of each server in roserver/Build/Debug/bin/conf. Fill in the mysql account password database information. Modify the host in the peer.
If you want to start multiple gameservers, copy gamserver.xml and modify the line information in it.
- Modify the information in loginserver.xml in roserver/Build/Debug/bin/conf.template.
## 8. Install screen
## 9. Start the server
```sh
cd ./Build/Debug/bin
./start [any name]
```
screen related commands
```sh
screen -ls //View started servers
screen -r [server name] //Switch to each server window to ensure there are no errors
First ctrl+A and then D to exit the screen
```
- **Possible problems:**
- (1) Connection to database refused
The settings of mysql do not allow connections to external services.
Modify the host list of the user used and add the wildcard character %
## 10. Start loginserver
```sh
./loginserver conf.template/loginserver.xml
```
## 11. Run the client and connect
- **Problems encountered**
- (1) There may be situations where the configuration of each server port is inconsistent, resulting in the connection being refused.
Check whether the port number configured in the login gateinfo table is consistent with the gateserver.xml port.