-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-instance.sh
65 lines (48 loc) · 1.39 KB
/
init-instance.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
#!/bin/bash
# Update package list and upgrade packages
sudo apt update && sudo apt upgrade -y
# Install NGINX
sudo apt install -y nginx
sudo systemctl start nginx
sudo systemctl enable nginx
# Install Node.js, npm, and Express globally
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install -g express
sudo npm install -g ws
# Install opam (OCaml package manager)
sudo apt install -y opam
# Initialize opam and create the initial environment
opam init -y --bare
# Adjust shell environment
eval $(opam env)
# Install the specific OCaml version required
opam switch create 5.2.0
eval $(opam env)
# Install essential OCaml libraries: core, core_bench, and utop
opam install -y core core_bench utop
# Set up `utop` interactive environment for OCaml
cat <<EOF > ~/.ocamlinit
#require "core.top";;
#require "ppx_jane";;
open Base;;
EOF
# Handle SSL certificate
# Generate or upload certificates
# sudo certbot -d camel.elliotliu.com --manual --preferred-challenges dns certonly
# Cron job to renew SSL certificate
echo "0 0,12 * * * root certbot renew --quiet" | sudo tee /etc/cron.d/certbot
# Final check: display installed versions
echo "NGINX Version:"
nginx -v
echo "Node.js Version:"
node -v
echo "npm Version:"
npm -v
echo "Express Version:"
npm list -g express
echo "OCaml Version:"
ocaml -version
echo "Opam Version:"
opam --version
echo "Setup Complete!"