Skip to content

Instantly share code, notes, and snippets.

@s-urbaniak s-urbaniak/init.sh
Last active Sep 20, 2018

Embed
What would you like to do?
#!/usr/bin/env bash
set -euxo pipefail
echo "installing core packages"
apt-get update -y
apt install -y apt-transport-https curl
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
apt-get update -y
apt install -y --force-yes \
binutils \
curl \
direnv \
emacs25-nox \
firewalld \
gcc \
git \
jq \
libpcap-dev \
libpam-systemd \
make \
mercurial \
mosh \
nodejs \
policykit-1 \
psmisc \
software-properties-common \
sudo \
tmux \
unzip \
vim \
yarn \
wget
echo "configuring firewall"
for s in mosh openvpn; do
firewall-cmd --permanent --zone=public --add-service=${s}
done
firewall-cmd --reload
systemctl start firewalld
systemctl enable firewalld
echo "installing npm"
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt install -y nodejs
npm config --global set prefix /home/sur/.npm
echo "installing Go"
GOVERSION="1.11"
curl -OLSf# https://dl.google.com/go/go${GOVERSION}.linux-amd64.tar.gz
tar -C /usr/local -xzf go${GOVERSION}.linux-amd64.tar.gz
rm go${GOVERSION}.linux-amd64.tar.gz
echo "installing kubectl"
curl -OL# https://dl.k8s.io/v1.11.3/kubernetes-client-linux-amd64.tar.gz
tar xvzf kubernetes-client-linux-amd64.tar.gz
mv kubernetes/client/bin/kubectl /usr/local/bin/
chmod a+x /usr/local/bin/kubectl
echo "installing ripgrep"
curl -OL# https://github.com/BurntSushi/ripgrep/releases/download/0.7.1/ripgrep-0.7.1-x86_64-unknown-linux-musl.tar.gz
tar xvzf ripgrep-0.7.1-x86_64-unknown-linux-musl.tar.gz
mv ripgrep-0.7.1-x86_64-unknown-linux-musl/rg /usr/local/bin/
echo "setting up user"
sed -i.bak 's/sudo\tALL=(ALL:ALL) ALL/sudo\tALL=(ALL:ALL) NOPASSWD: ALL/g' /etc/sudoers
adduser \
--shell /bin/bash \
--ingroup sudo --disabled-password \
--gecos '' \
sur
mkdir -p /home/sur/.ssh
curl -LSfs https://github.com/s-urbaniak.keys >>/home/sur/.ssh/authorized_keys
chown -R sur:sudo /home/sur/.ssh
chmod 600 /home/sur/.ssh/authorized_keys
cat <<EOF | runuser -l sur --
mkdir -p ~/src
cd ~/src
git clone https://github.com/s-urbaniak/dotfiles
cd dotfiles
./install.sh
curl https://sh.rustup.rs -sSf | bash -s -- '-y'
cp /etc/skel/.profile ~/.profile
cd ~
cat <<EOD >>~/.envrc
PATH_add /usr/local/go/bin
PATH_add ~/.cargo/bin
PATH_add ~/.npm/bin
EOD
direnv allow
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.