CentOS7 Setup

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# 进入 screen
screen
#添加用户
adduser deploy
# 修改密码
passwd deploy
# 允许 deploy su 到 root
gpasswd -a deploy wheel
# 添加登录公钥
ssh-copy-id deploy@SERVER_IP_ADDRESS
vi /etc/ssh/sshd_config
# 禁用 root 登录
PermitRootLogin no
# 禁用密码登录
PasswordAuthentication no
# 修改登录端口
Port 2121
# 重启服务
systemctl reload sshd
cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/
vi /etc/firewalld/services/ssh.xml
firewall-cmd --reload
# !!!!! 连接确认
yum -y update
echo "your host name" > /etc/hostname
echo "x.x.x.x your host name" >> /etc/hosts
reboot
timedatectl set-timezone Asia/Shanghai
# 设置 UTC 时间
timedatectl set-local-rtc 0
yum groupinstall 'Development Tools'
# install external release
yum -y install epel-release
yum -y install nginx
# required by pillow
yum -y install freetype-devel libjpeg-devel libpng-devel
# required by sentry
yum install libxslt-devel python-devel
yum -y install npm
# required in bcrypt
yum -y install libffi-devel
# mysqlclient
yum -y install mariadb-devel
# install supervisor
pip install supervisor --pre
#install python3
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
tar xf Python-3.5.2.tgz && cd Python-3.5.2 && ./configure && make && make install
su deploy
cd ~
# 重建 ssh keys (todo)
# 创建虚拟环境
pyvenv venv3
echo_supervisord_conf > supervisord.conf