2020-01-29 20:46:44 +00:00
|
|
|
#! /usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Copy over basic configuration files.
|
|
|
|
cp ./tmux.conf ~/.tmux.conf
|
|
|
|
cp ./bashrc ~/.bashrc
|
|
|
|
source ~/.bashrc
|
|
|
|
|
2020-01-31 21:58:30 +00:00
|
|
|
# Add SSH keys and set SSH configs
|
|
|
|
sudo cp ./ssh_config /etc/ssh/ssh_config
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
cat ./authorized_keys >> ~/.ssh/authorized_keys
|
|
|
|
|
2020-02-20 16:35:07 +00:00
|
|
|
# Nodejs install prerequisite https://nodejs.org/en/download/package-manager/
|
2020-01-29 20:46:44 +00:00
|
|
|
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
|
|
|
|
|
2020-02-20 16:35:07 +00:00
|
|
|
# Yarn install prerequisite https://classic.yarnpkg.com/en/docs/install
|
2020-01-29 20:46:44 +00:00
|
|
|
curl -sL 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 installations.
|
|
|
|
sudo apt-get update
|
2020-01-29 21:41:20 +00:00
|
|
|
sudo apt-get -y install ufw tmux ranger htop nload nginx certbot \
|
2020-01-30 16:40:44 +00:00
|
|
|
python-certbot-nginx nodejs gcc g++ make yarn git vim
|
2020-01-29 20:46:44 +00:00
|
|
|
|
|
|
|
# terminfo for alacritty terminal via ssh
|
2020-01-31 21:58:30 +00:00
|
|
|
# If you don't use the alacritty terminal you can remove this step.
|
2020-01-29 20:46:44 +00:00
|
|
|
wget -c https://raw.githubusercontent.com/alacritty/alacritty/master/extra/alacritty.info
|
|
|
|
sudo tic -xe alacritty,alacritty-direct alacritty.info
|
|
|
|
rm alacritty.info
|
|
|
|
|
2020-01-29 21:41:20 +00:00
|
|
|
# Setup nginx config
|
|
|
|
sudo cp ./skynet-nginx.conf /etc/nginx/sites-available/skynet
|
|
|
|
sudo nginx -t
|
2020-03-20 21:11:20 +00:00
|
|
|
sudo ln -sf /etc/nginx/sites-available/skynet /etc/nginx/sites-enabled/skynet
|
2020-03-24 14:42:03 +00:00
|
|
|
sudo rm /etc/nginx/sites-enabled/default --force
|
2020-01-29 21:41:20 +00:00
|
|
|
sudo systemctl reload nginx
|
|
|
|
|
|
|
|
# Setup firewall
|
2020-01-30 16:40:44 +00:00
|
|
|
# TODO: disable plain HTTP eventually
|
2020-01-29 21:41:20 +00:00
|
|
|
sudo ufw enable
|
2020-01-30 16:40:44 +00:00
|
|
|
sudo ufw allow ssh
|
2020-01-29 21:41:20 +00:00
|
|
|
sudo ufw allow 'Nginx Full'
|
2020-01-30 16:40:44 +00:00
|
|
|
sudo ufw allow 'Nginx HTTP'
|
2020-01-29 21:41:20 +00:00
|
|
|
|
2020-05-19 20:12:50 +00:00
|
|
|
# Install Go 1.13.11.
|
|
|
|
wget -c https://dl.google.com/go/go1.13.11.linux-amd64.tar.gz
|
|
|
|
sudo tar -C /usr/local -xzf go1.13.11.linux-amd64.tar.gz
|
2020-03-24 14:42:03 +00:00
|
|
|
export PATH=$PATH:/usr/local/go/bin
|
2020-05-19 20:12:50 +00:00
|
|
|
rm go1.13.11.linux-amd64.tar.gz
|
2020-01-29 22:30:40 +00:00
|
|
|
|
2020-01-31 21:58:30 +00:00
|
|
|
# Sanity check that will pass if go was installed correctly.
|
|
|
|
go version
|
2020-01-30 16:31:48 +00:00
|
|
|
|
2020-01-31 21:58:30 +00:00
|
|
|
# Install Sia
|
2020-05-19 20:12:50 +00:00
|
|
|
git clone -b v1.4.8 https://gitlab.com/NebulousLabs/Sia ~/Sia
|
2020-03-20 21:11:20 +00:00
|
|
|
make --directory ~/Sia
|
2020-02-25 17:52:04 +00:00
|
|
|
|
2020-03-02 23:05:45 +00:00
|
|
|
# Setup systemd files
|
2020-02-26 16:45:50 +00:00
|
|
|
mkdir -p ~/.config/systemd/user
|
|
|
|
cp siad.service ~/.config/systemd/user/siad.service
|
2020-03-02 23:05:45 +00:00
|
|
|
cp siad-upload.service ~/.config/systemd/user/siad-upload.service
|
2020-02-25 17:52:04 +00:00
|
|
|
|
2020-03-02 23:05:45 +00:00
|
|
|
# Setup files for storing environment variables
|
2020-02-26 16:45:50 +00:00
|
|
|
mkdir -p ~/.sia
|
|
|
|
cp sia.env ~/.sia/
|
2020-03-02 23:05:45 +00:00
|
|
|
cp sia.env ~/.sia/sia-upload.env
|
2020-03-13 16:34:42 +00:00
|
|
|
|
|
|
|
# Setup persistent journal
|
|
|
|
sudo mkdir -p /var/log/journal
|
|
|
|
sudo cp journald.conf /etc/systemd/journald.conf
|
|
|
|
sudo systemctl restart systemd-journald
|
2020-03-20 21:11:20 +00:00
|
|
|
|
2020-05-19 20:14:28 +00:00
|
|
|
# Set up file limits.
|
|
|
|
sudo cp limits.conf /etc/security/limits.conf
|
|
|
|
|
2020-04-23 17:39:53 +00:00
|
|
|
# Setup periodical /tmp cleanup so we don't run out of disk space
|
|
|
|
# - deletes anything older than 10 days from /tmp, crontab is set to run it every day at midnight
|
|
|
|
(sudo crontab -l 2>/dev/null; echo "0 0 * * * find /tmp -type f -atime +10 -delete >/dev/null 2>&1") | sudo crontab -
|
|
|
|
|
2020-03-20 21:11:20 +00:00
|
|
|
# Setup skynet frontend.
|
|
|
|
cd ..
|
|
|
|
yarn
|
|
|
|
yarn build
|