-
Notifications
You must be signed in to change notification settings - Fork 1
/
Centos7-install.sh
65 lines (37 loc) · 1.13 KB
/
Centos7-install.sh
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
#!/bin/bash
yum -y update
yum install -y epel-release
yum install -y nginx
systemctl start nginx
systemctl enable nginx
sed -i "s/root \/usr\/share\/nginx\/html/root \/usr\/local\/blog\/public/g" /etc/nginx/nginx.conf
service nginx restart
curl --silent --location https://rpm.nodesource.com/setup_5.x |bash -
yum install -y nodejs
yum install -y npm
npm install hexo-cli -g
cd /usr/local/
hexo init blog
cd /usr/local/blog
npm install
npm install --save hexo-admin
mkdir /usr/local/blog/admin_script/
cat>/usr/local/blog/admin_script/hexo-generate.sh<<EOF
#!/usr/bin/env sh
hexo g
EOF
chmod 777 /usr/local/blog/admin_script/hexo-generate.sh
echo -e "请访问 https://www.devglan.com/online-tools/bcrypt-hash-generator 请将密码转换成bcrypt散列输入"
read -p "请输入转换后的bcrypt密码:" bcrypt
read -p "请输入用户名:" username
cat>>/usr/local/blog/_config.yml<<EOF
admin:
username: ${username}
password_hash: ${bcrypt}
secret: hey hexo
deployCommand: './admin_script/hexo-generate.sh'
# expire: 60*1
EOF
hexo g
nohup hexo server -d &
echo -e "admin run in port 4000"