-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript1.sh
77 lines (40 loc) · 1.46 KB
/
script1.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
#!/bin/bash
#This script install the prerequisites needed for deployment
#updating the server
#updates the database with information on any new packages
sudo apt-get update
sudo apt-get install -y build-essential openssl libssl-dev pkg-config
#SETTING ENV VARIABLES
sudo nano /etc/environment
#Then you add the line PORT="3000" for example
#MONGODB_URL="mongodb+srv://admin:[email protected]/projectx?retryWrites=true&w=majority"
#NODE_ENV="production"
#install node
#install nodejs package
sudo apt-get install -y nodejs
#install npm package
sudo apt-get install npm -y
#cleans the data in the cache folder
sudo npm cache clean -f
sudo npm install -g n
#upgrade to the latest stable node version
sudo n stable
#install nginx
sudo apt-get install nginx -y
#setup Git
sudo apt-get install git -y
#install and setup mongoDB
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 4B7C549A058F8B6B
echo deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse | sudo tee /etc/apt/sources.list.d/mongodb.list
#sudo nano (REMOVE THE QUOTATIONS)
sudo apt install udo
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo systemctl enable mongod && sudo systemctl start mongod
#install PM2
sudo npm install pm2 -g
#Linking the project wit Nginx
sudo rm /etc/nginx/sites-available/default
sudo nano /etc/nginx/sites-available/default
#Then we edit the nginx config file
sudo systemctl restart nginx