-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.sh
77 lines (58 loc) · 1.87 KB
/
configure.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash
apt update
apt upgrade
reboot
# Firewall
ufw allow ssh
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
# Add user worker
adduser --disabled-password worker
mkdir ~worker/.ssh
cp ~root/.ssh/authorized_keys ~worker/.ssh/
chmod 600 -R ~worker/.ssh/
chmod 700 ~worker/.ssh
chown worker:worker -R ~worker/.ssh
# Install docker and docker-compose
apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
# apt-cache policy docker-ce
apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
## Add worker to docker users
usermod -aG docker worker
# Install zsh
apt install -y zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# Configure tmux
cat > .tmux.conf <<EOF
set -s escape-time 1
# set -g mouse on
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a last-window
EOF
# install node 18
# https://github.com/nodesource/distributions#deb
curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt install -y nodejs
# install pnpm
npm install -g pnpm
# install nginx
apt install -y nginx
# copy file
ln -s /etc/nginx/sites-available/api.neokingdom.org /etc/nginx/sites-enabled
# install certbot
apt install -y snapd
snap install core
snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
certbot --nginx
# (optional) install IPFS
wget https://dist.ipfs.io/go-ipfs/v0.13.0/go-ipfs_v0.13.0_linux-amd64.tar.gz
tar -xvzf go-ipfs_v0.13.0_linux-amd64.tar.gz
cd go-ipfs
bash install.sh