-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoder-setup.sh
48 lines (34 loc) · 1.25 KB
/
coder-setup.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
#!/bin/bash
#Ask github mail for github to display my avatar on commits
read -p 'Github mail: ' mail
#Set github email for git
git config --global user.email $mail
# Download and install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$(curl --silent "https://api.github.com/repos/nvm-sh/nvm/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')/install.sh | bash
# Export NVM_DIR environment variable
export NVM_DIR="$HOME/.nvm"
# Load nvm
if [ -s "$NVM_DIR/nvm.sh" ]; then
. "$NVM_DIR/nvm.sh"
fi
# Load nvm bash_completion
if [ -s "$NVM_DIR/bash_completion" ]; then
. "$NVM_DIR/bash_completion"
fi
# Install Node.js v20 using nvm
nvm install v20
# Install global npm packages
npm i -g yarn typescript tsx pm2 npm@latest npm-check-updates
# Update packages cache
sudo apt-get update -y
# Upgrade packages
sudo apt-get upgrade -y
# Install things
sudo apt-get install postgresql postgresql-contrib nano redis -y
# Start psql without systemd cause it's coder docker env
sudo service postgresql start
# Start redis
sudo service redis-server start
# Setup one-time local database for testing
sudo -u postgres psql -c "CREATE USER alpha WITH LOGIN PASSWORD 'SomeSecureAlpha';"
sudo -u postgres psql -c "CREATE DATABASE alpha OWNER alpha;"