Skip to content

Commit 59d2cde

Browse files
committed
Update
1 parent 54e2eca commit 59d2cde

File tree

5 files changed

+85
-32
lines changed

5 files changed

+85
-32
lines changed

base/centos.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,18 @@ firewall-cmd --get-active-zones
8686
firewall-cmd --set-default-zone=dmz
8787
8888
# 允许对外开放的服务。执行 ls /usr/lib/firewalld/services/ 以查看支持的服务列表
89-
firewall-cmd --permanent --zone=dmz --add-service=http
90-
firewall-cmd --permanent --zone=dmz --add-service=https
91-
firewall-cmd --permanent --zone=dmz --add-service=ssh
89+
firewall-cmd --permanent --add-service=http
90+
firewall-cmd --permanent --add-service=https
91+
firewall-cmd --permanent --add-service=ssh
9292
9393
# 允许对外开放的端口
94-
# firewall-cmd --permanent --zone=dmz --add-port=3306/tcp
94+
# firewall-cmd --permanent --add-port=3306/tcp
9595
9696
# 重载配置以生效
9797
firewall-cmd --reload
9898
9999
# 查看配置
100-
firewall-cmd --zone=dmz --list-all
100+
firewall-cmd --list-all
101101
```
102102

103103
__注意:__
@@ -202,7 +202,7 @@ swapon -s
202202
free -m
203203
204204
# 创建交换空间文件
205-
dd if=/dev/zero of=/swapfile bs=1M count=2048
205+
dd if=/dev/zero of=/swapfile bs=1M count=2048 status=progress
206206
chmod 600 /swapfile
207207
mkswap /swapfile
208208

base/nginx.md

+13-16
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ enabled=1
1818
EOF
1919
2020
sudo yum makecache
21-
sudo yum install nginx
21+
sudo yum install -y nginx
2222
2323
sudo systemctl enable nginx
2424
sudo systemctl start nginx
@@ -108,13 +108,11 @@ minsize 300M
108108
```
109109
# 默认是 1024 位,不够安全
110110
sudo openssl dhparam -out /etc/ssl/dhparam.pem 2048
111-
```
112-
113-
添加以下配置文件
114111
115-
`/etc/nginx/includes/https.conf`:
112+
sudo mkdir -p /etc/nginx/includes
116113
117-
```
114+
# 添加配置文件
115+
sudo tee /etc/nginx/includes/https.conf <<-'EOF'
118116
# certs
119117
#ssl_certificate /path/to/fullchain.pem;
120118
#ssl_certificate_key /path/to/private_key;
@@ -127,9 +125,9 @@ ssl_session_tickets off;
127125
# Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
128126
ssl_dhparam /etc/ssl/dhparam.pem;
129127
130-
# intermediate configuration. tweak to your needs.
131-
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
132-
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
128+
# modern configuration. tweak to your needs.
129+
ssl_protocols TLSv1.2;
130+
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
133131
ssl_prefer_server_ciphers on;
134132
135133
# OCSP Stapling ---
@@ -141,19 +139,18 @@ ssl_stapling_verify on;
141139
# 国内使用 DNSPod Public DNS, 阿里 DNS
142140
resolver 119.29.29.29 182.254.116.116 223.5.5.5 223.6.6.6;
143141
# resolver 8.8.8.8 8.8.4.4;
144-
```
145-
146-
`/etc/nginx/includes/https-hsts.conf`:
142+
EOF
147143
148-
```
144+
sudo tee /etc/nginx/includes/https-hsts.conf <<-'EOF'
149145
include /etc/nginx/includes/https.conf;
150146
151147
# HSTS
152148
# 15768000 seconds = 6 months
153149
add_header Strict-Transport-Security max-age=15768000;
150+
EOF
154151
```
155152

156-
网站配置
153+
网站配置示例
157154

158155
```
159156
server {
@@ -185,5 +182,5 @@ server {
185182

186183
## 参考资料
187184

188-
* http://nginx.org/en/linux_packages.html
189-
* https://mozilla.github.io/server-side-tls/ssl-config-generator/
185+
* [Nginx Linux packages](http://nginx.org/en/linux_packages.html)
186+
* [Mozilla SSL Configuration Generator](https://mozilla.github.io/server-side-tls/ssl-config-generator/)

base/postgresql.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# PostgreSQL
2+
3+
The world's most advanced open source database.
4+
5+
## 安装
6+
7+
官方源中版本过旧,使用 PostgreSQL 官方源
8+
9+
```
10+
sudo yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-1.noarch.rpm
11+
sudo yum install postgresql10 postgresql10-server
12+
13+
# Initialize the database
14+
sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
15+
16+
sudo systemctl enable postgresql-10
17+
sudo systemctl start postgresql-10
18+
```
19+
20+
## 创建用户
21+
22+
默认只有一个 `postgres` 用户,为方便使用,可添加一个与系统用户同名的新用户
23+
24+
```
25+
sudo -u postgres -i
26+
createuser --interactive
27+
```
28+
29+
## 配置
30+
31+
默认的验证方式是 ident,为方便本地应用连接,可考虑改为 trust
32+
33+
修改 `/var/lib/pgsql/10/data/pg_hba.conf`:
34+
35+
```
36+
host all all 127.0.0.1/32 trust
37+
host all all ::1/128 trust
38+
```
39+
40+
## 参考资料
41+
42+
* [官网](https://www.postgresql.org/)
43+
* [Install PostgreSQL](https://www.postgresql.org/download/linux/redhat/)
44+
* [PostgreSQL Authentication Methods](https://www.postgresql.org/docs/current/static/auth-methods.html)

languages/nodejs.md

+15-3
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,31 @@ sudo yum install nodejs
1111
若仍想使用更新版本,可使用 [NodeSource 源](https://github.com/nodesource/distributions)
1212

1313
```
14-
curl -sL https://rpm.nodesource.com/setup_7.x | sudo bash -
14+
curl -sL https://rpm.nodesource.com/setup_9.x | sudo bash -
1515
# 使用 TUNA 源
16-
sudo sed -i 's#https://rpm.nodesource.com/pub_6.x/#https://mirror.tuna.tsinghua.edu.cn/nodesource/rpm_6.x/#g' /etc/yum.repos.d/nodesource-el.repo
16+
sudo sed -i 's#https://rpm.nodesource.com/pub_9.x/#https://mirror.tuna.tsinghua.edu.cn/nodesource/rpm_9.x/#g' /etc/yum.repos.d/nodesource-el.repo
1717
1818
sudo yum install nodejs
1919
```
2020

21+
## 安装 Yarn
22+
23+
```
24+
sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
25+
sudo yum install yarn
26+
```
27+
2128
## 配置
2229

23-
Npm 官方源速度较慢且不稳定,使用[淘宝源](http://npm.taobao.org/)
30+
若 npm 官方源速度较慢且不稳定,可改用[淘宝源](http://npm.taobao.org/)
2431

2532
```
2633
cat <<EOF > ~/.npmrc
2734
registry=https://registry.npm.taobao.org
2835
EOF
2936
```
37+
38+
## 参考资料
39+
40+
* [NodeSource](https://nodesource.com/)
41+
* [Yarn Installation](https://yarnpkg.com/en/docs/install)

languages/python.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Python 3
44

5-
官方源中不包含 Python 3,可使用 EPEL 源中的 Python 3.4,或 [IUS 源](https://ius.io/) 中的 Python 3.5
5+
官方源中不包含 Python 3,可使用 EPEL 源中的 Python 3.4,或 [IUS 源](https://ius.io/) 中的 python 3.6
66

77
EPEL:
88

@@ -18,15 +18,15 @@ IUS:
1818
```
1919
sudo rpm -Uvh https://centos7.iuscommunity.org/ius-release.rpm
2020
sudo yum update
21-
sudo yum install python35u python35u-devel
22-
sudo yum install python35u-setuptools python35u-pip
21+
sudo yum install python36u python36u-devel
22+
sudo yum install python36u-setuptools python36u-pip
2323
```
2424

25-
IUS 源安装的 `python35u` 不会自动创建 `/usr/bin/python3`,为方便使用,手动创建符号链接:
25+
IUS 源安装的 `python36u` 不会自动创建 `/usr/bin/python3`,为方便使用,手动创建符号链接:
2626

2727
```
28-
sudo ln -s /usr/bin/python3.5 /usr/bin/python3
29-
sudo ln -s /usr/bin/pip3.5 /usr/bin/pip3
28+
sudo ln -s /usr/bin/python3.6 /usr/bin/python3
29+
sudo ln -s /usr/bin/pip3.6 /usr/bin/pip3
3030
```
3131

3232
## PyPI 国内镜像
@@ -67,7 +67,7 @@ trusted-host=mirrors.aliyuncs.com
6767

6868
```
6969
# 系统监控工具
70-
sudo pip3.5 install glances
70+
sudo pip3 install glances
7171
# For Python 2
7272
sudo pip2 install glances
7373
```

0 commit comments

Comments
 (0)