一.准备环境
#关闭seliunx和防火墙
setenforce 0
systemctl stop firewalld
systemctl disable firewalld
#配置源,并安装常用工
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
yum install -y ntpdate vim lresz net-tools wegt tree psmisc bash-completion unzip epel-release#配置文件修改下述数字,将IP网关修改为自己的
vim /etc/sysconfig/network-scripts/ifcfg-ens33
二.上传源码到根目录执行下述命令
[root@localhost ~]# cd / && tar xvzf zjwy.tar.gz -C /
三.部署nginx
#安装nginx
[root@localhost /]# yum install -y nginx
[root@localhost /]# rm -rf /usr/share/nginx/html/*
[root@localhost /]# cp -r /www/wwwroot/yixiaw/* /usr/share/nginx/html
[root@localhost /]# systemctl start nginx
四.部署mysql
[root@localhost /]# yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm
[root@localhost /]# yum install -y yum-utils
[root@localhost /]# yum-config-manager --disable mysql80-community
[root@localhost /]# yum-config-manager --enable mysql57-community
[root@localhost /]# yum install -y mysql-server mysql-client --nogpgcheck
[root@localhost /]# systemctl start mysqld
# 获取数据库初始化密码,并修改
[root@localhost /]# mysqladmin -p"`awk '/temporary password/{p=$NF}END{print p}' /var/log/mysqld.log`" password 'QianFeng@123'
[root@localhost /]# echo "validate-password=off" >> /etc/my.cnf
[root@localhost /]# systemctl restart mysqld
[root@localhost /]# mysqladmin -p'QianFeng@123' password 'jgirlstest'
[root@localhost /]# mysql -p'jgirlstest' -e "create database jgirls_test"
#关联到数据库
[root@localhost /]# mysql -p'jgirlstest' jgirls_test < /jgirls_test.sql
五.配置java
[root@localhost /]# vim /etc/profile.d/java.sh
#复制粘贴下述内容
JAVA_HOME=/usr/java/jdk1.8.0_121
JRE_HOME=/usr/java/jdk1.8.0_121/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH[root@localhost /]# source /etc/profile #使配置生效
六.安装php5.6
[root@localhost /]# rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
[root@localhost /]# yum -y install yum-utils
[root@localhost /]# yum-config-manager --enable remi-php56
[root@localhost /]# yum -y install php php-opcache
[root@localhost /]# yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel
七.替换配置文件IP
[root@localhost /]# vim /opt/server/100001/Application.properties
43.226.156.92改成自己的[root@localhost /]# vim /usr/share/nginx/html/index.html
218.93.207.238改成自己的#进入数据库里执行的命令 先把这组语句里面的两个IP改成自己的
UPDATE `jgirls_test`.`system` SET `id`='1', `data`='{\"version\":\"1.0.0.0\",\"resVersion\":\"1.0.0.0.0.0.0.0\",\"areas\":[{\"id\":100001,\"name\":\"云计算1\",\"host\":\"10.36.178.74\",\"port\":10090,\"status\":2},{\"id\":100002,\"name\":\"www.QFetu.com\",\"host\":\"10.36.178.74\",\"port\":10100,\"status\":1}],\"globalStatus\":1,\"versionStr\":\"\",\"whiteListWhenMaintenance\":\",\",\"declaration\":[{\"declarationTitle\":\"云计算\",\"declarationCotent\":\"www.QF.com\"},{\"declarationTitle\":\"公告标题2\",\"declarationCotent\":\"公告内容2\"},{\"declarationTitle\":\"公告标题3\",\"declarationCotent\":\"公告内容3\"}]}' WHERE (`id`='1');
八.启动游戏
cd /opt/server/mongodb-linux-x86_64-rhel70-3.2.9 && ./start.sh
cd /opt/server/apache-tomcat-8080/bin && ./startup.sh
cd /opt/server/chatserver && ./start.sh
cd /opt/server/AdminNew && ./restart.sh
cd /opt/server/100001 && ./start.sh restart
管理后台访问地址http://192.168.226.100:8002 账号密码都是admin
游戏页面直接访问IP,当然这里的IP在部署的时候需要修改成你的IP