forked from thoughtbot/laptop
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlinux.sh
executable file
·194 lines (154 loc) · 5.18 KB
/
linux.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/bin/sh
trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT
fancy_echo() {
local fmt="$1"; shift
printf "\n$fmt\n" "$@"
}
append_to_bashrc(){
echo '$@' >> ~/.bashrc
}
apt_install() {
if ! dpkg --get-selections | grep -Fqs $@; then
fancy_echo "Installing %s ..." "$1"
sudo apt install "$@" -y
else
fancy_echo "%s already installed, skipping ..." "$1"
fi
}
snap_install(){
sudo snap install "$@" --classic
}
gem_install_or_update() {
if gem list "$1" --installed > /dev/null; then
fancy_echo "Updating %s ..." "$1"
gem update "$@"
else
fancy_echo "Installing %s ..." "$1"
gem install "$@"
rbenv rehash
fi
}
install_rbenv() {
fancy_echo 'installing rbenv'
apt_install 'autoconf'
apt_install 'bison'
apt_install 'build-essential'
apt_install 'libssl1.0-dev'
apt_install 'libyaml-dev'
apt_install 'libreadline6-dev'
apt_install 'zlib1g-dev'
apt_install 'libncurses5-dev'
apt_install 'libffi-dev'
apt_install 'libgdbm5'
apt_install 'libgdbm-dev'
apt_instlal 'libpq-dev'
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
}
install_ruby() {
fancy_echo 'installing ruby versions'
~/.rbenv/bin/rbenv install -s 2.3.6
~/.rbenv/bin/rbenv global 2.3.6
gem update --system
gem_install_or_update 'bundler'
fancy_echo "Configuring Bundler ..."
number_of_cores=$(nproc)
bundle config --global jobs $((number_of_cores - 1))
}
install_n() {
curl -L https://git.io/n-install | bash
. /home/akarounis/.bashrc
echo 'export PATH="$N_PREFIX/bin:$PATH"' >> ~/.bashrc
n 0.12 && n 8.9.4
}
install_postgres(){
#install postgres 9.6
#!this is for ubuntu LTS 18.04.1 bionic!
sudo bash -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
apt_install 'postgresql-9.6'
sudo -u postgres createuser --superuser $(whoami)
sudo -u postgres createdb $(whoami)
}
install_elasticsearch() {
fancy_echo 'installing elastic...'
apt_install 'openjdk-8-jdk'
wget -q https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.0.deb -O elasticsearch-5.6.0.deb
sudo dpkg -i elasticsearch-5.6.0.deb
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo -i service elasticsearch stop
sudo -i service elasticsearch start
}
install_yarn() {
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt remove cmdtest
apt_install 'yarn'
}
install_sops(){
fancy_echo 'installing sops...'
wget -q https://github.com/mozilla/sops/releases/download/3.2.0/sops_3.2.0_amd64.deb -O sops_3.2.0_amd64.deb
sudo dpkg -i sops_3.2.0_amd64.deb
}
install_google_cloud(){
# Setup Google Cloud Platform/Kubernetes Tooling
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt update
apt_install 'google-cloud-sdk'
apt_install 'kubectl'
apt_install 'google-cloud-sdk-pubsub-emulator'
#append_to_bashrc 'source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc'
#append_to_bashrc 'source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc'
append_to_bashrc 'eval "$(kubectl completion bash)"'
append_to_bashrc 'eval "$(helm completion bash)"'
# !!!need to run the following!!!
#gcloud auth login
#gcloud gcloud auth configure-docker
#helm init -c
}
install_docker_gcr(){
wget -q https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v1.5.0/docker-credential-gcr_linux_amd64-1.5.0.tar.gz ~/docker-credential-gcr_linux_amd64-1.5.0.tar.gz
sudo tar -zcvf docker-credential-gcr_linux_amd64-1.5.0.tar.gz /usr/bin/
}
install_redpanda() {
## Run the setup script to download and install the repo
curl -1sLf 'https://packages.vectorized.io/nzc4ZYQK3WRGd9sy/redpanda/cfg/setup/bash.deb.sh' | sudo -E bash
## Use apt to install redpanda
apt_install 'redpanda'
}
############################################
# #
# !!! Actually do the installs below !!! #
# #
############################################
sudo apt update
sudo apt upgrade -y
install_docker_gcr
exit
apt_install 'git'
apt_install 'curl'
apt_install 'wget'
install_rbenv
install_ruby
install_n
install_yarn
install_redpanda
#policygenius project dependencies
apt_install 'redis-server'
install_postgres
install_elasticsearch
snap_install 'aws-cli'
snap_install 'helm'
install_sops
install_google_cloud
snap_install 'docker'
install_docker_gcr
sudo apt autoremove