You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
4.4 KiB
130 lines
4.4 KiB
#!/bin/bash
|
|
|
|
# Ubuntu默认采用的是 dash,不给力,改成bash
|
|
dpkg-reconfigure dash
|
|
apt-get install vim
|
|
|
|
#先创建用户mmog,以后游戏运营统一使用这个用户名,密码缺省使用一下这个,请勿泄露
|
|
groupadd mmog
|
|
useradd -g mmog mmog
|
|
passwd mmog 修改密码
|
|
mkdir /data
|
|
mkdir /data/mmogrun
|
|
chown mmog:mmog /data/mmogrun
|
|
mkdir /home/mmog
|
|
chown mmog:mmog /home/mmog
|
|
cp ./.bashrc ./.profile /home/mmog/
|
|
chown mmog:mmog /home/mmog/.bashrc
|
|
chown mmog:mmog /home/mmog/.profile
|
|
ln -s /data/mmogrun /home/mmog/mmogrun
|
|
|
|
#修改文件打开数量限制,core文件大小限制,共享内存大小限制
|
|
#修改 /etc/security/limits.conf 添加或修改(直接echo似乎有问题,执行后请检查和确认是否成功)
|
|
sh -c 'echo "@mmog soft nofile 50000" >> /etc/security/limits.conf'
|
|
sh -c 'echo "@mmog hard nofile 65536" >> /etc/security/limits.conf'
|
|
sh -c 'echo "@mmog soft core 1024000" >> /etc/security/limits.conf'
|
|
#修改core文件路径
|
|
mkdir /data/corefile
|
|
chmod 777 /data/corefile
|
|
echo "/data/corefile/core-%e-%p-%t" > /proc/sys/kernel/core_pattern
|
|
|
|
#修改 /etc/ssh/sshd_config #PermitRootLogin yes为no 禁止root直接ssh登录服务器
|
|
#修改ssh默认登录端口为56000,注意iptables是否有限制,别改了登录不上了
|
|
service ssh restart
|
|
|
|
#修改hostname,要改2个地方,改完重启生效,注意hostname不能含有下划线_,可以用连接符-
|
|
/etc/hostname youname
|
|
/etc/hosts 127.0.1.1 youname
|
|
|
|
#如果对外网开放端口的机器需要更新ssh,修补漏洞
|
|
apt-get update
|
|
apt-get upgrade
|
|
|
|
#发布环境需要运行dotnet core 的话需要安装以下依赖
|
|
apt-get install libunwind8 libunwind8-dev gettext libicu-dev liblttng-ust-dev libcurl4-openssl-dev libssl-dev uuid-dev unzip
|
|
#需要进行http访问的机器,请改一下dns
|
|
vi /etc/resolvconf/resolv.conf.d/base
|
|
#添加2行
|
|
nameserver 8.8.8.8
|
|
nameserver 8.8.4.4
|
|
同上,要让dns立即生效,在 /etc/resolv.conf 文件里添加nameserver 8.8.8.8这2行
|
|
|
|
#修改时区,注:土耳其在欧洲 Europe/Istanbul,不要设置土耳其时间(有夏令时问题,直接设置时区+3)
|
|
dpkg-reconfigure tzdata
|
|
|
|
#如果要安装mysql
|
|
apt-get install mysql-server mysql-client
|
|
#修改配置
|
|
[client]
|
|
default-character-set=utf8
|
|
[mysqld]
|
|
innodb_buffer_pool_size = 8G
|
|
innodb_log_file_size = 512M
|
|
max_connections = 500
|
|
character-set-server=utf8
|
|
#安装好后如果用mmog用户无法登录mysql,则可以先su到root用户再登录,应该是可以的,再修改root登录密码
|
|
use mysql;
|
|
update user set authentication_string=PASSWORD("这里输入你要改的密码") where User='root'; #更改密码
|
|
update user set plugin="mysql_native_password"; #如果没这一行可能也会报一个错误,因此需要运行这一行
|
|
|
|
> flush privileges; #更新所有操作权限
|
|
#建立数据库后
|
|
grant all privileges on dbaccount.* to mmog@'localhost' identified by 'mmog';
|
|
grant all privileges on dbaccount.* to mmog@'127.0.0.1' identified by 'mmog';
|
|
grant all privileges on dbgame.* to mmog@'localhost' identified by 'mmog';
|
|
grant all privileges on dbgame.* to mmog@'127.0.0.1' identified by 'mmog';
|
|
|
|
# 如果是开发机,请安装dotnet环境,发布环境不需要装
|
|
sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
|
|
apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
|
|
apt-get update
|
|
apt-get install dotnet-dev-1.0.0-preview2-003121
|
|
|
|
#处理proj dotnet工程
|
|
cd proj
|
|
dotnet restore
|
|
dotnet run
|
|
|
|
|
|
#mysql主从配置,主建立用户slave 25是从,46是主
|
|
#修改mysql配置后重启
|
|
service mysql start
|
|
#主
|
|
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'slave'@'10.135.71.25' IDENTIFIED BY 'slave';
|
|
#主
|
|
server-id=1
|
|
log_bin=xxxx
|
|
#从
|
|
server-id=2
|
|
log_bin =xxxx
|
|
#master-host=10.135.71.46
|
|
#master-user=slave
|
|
#master-password=slave
|
|
#master-password=slave
|
|
#replicate-do-db=mstest
|
|
|
|
#在slave上执行mysql
|
|
stop slave;
|
|
change master to master_host='10.135.71.46',master_user='slave',master_password='slave';
|
|
start slave;
|
|
#验证下是否成功
|
|
show slave status\G;
|
|
#显示 Slave_IO_Running: Yes
|
|
# Slave_SQL_Running: Yes
|
|
#表示成功
|
|
#备份mysql
|
|
#mysqldump -ummog -pmmog dbgame --no-create-db --default-character-set=utf8 > ./dbgame.sql;
|
|
|
|
|
|
|
|
# 卸载apache服务
|
|
apt-get --purge remove apache2
|
|
apt-get --purge remove apache2.2-common
|
|
apt-get autoremove
|
|
##删除apache相关文件
|
|
find /etc -name "*apache*" |xargs rm -rf
|
|
rm -rf /var/www
|
|
rm -rf /etc/libapache2-mod-jk
|
|
|
|
|
|
|
|
|