diff --git a/net/datacenter-node-install/README.md b/net/datacenter-node-install/README.md new file mode 100644 index 000000000..78ac41a43 --- /dev/null +++ b/net/datacenter-node-install/README.md @@ -0,0 +1,11 @@ +# Introduction + +These scripts are intended to facilitate the preparation of dedicated Solana +nodes. They have been tested as working from a clean installation of Ubuntu +18.04 Server. Use elsewhere is unsupported. + +# Installation + +1) `sudo ./setup-dc-node-1.sh` +2) `sudo reboot` +3) `sudo ./setup-dc-node-2.sh` diff --git a/net/datacenter-node-install/disable-networkd-wait.sh b/net/datacenter-node-install/disable-networkd-wait.sh new file mode 100755 index 000000000..35cf3b0fa --- /dev/null +++ b/net/datacenter-node-install/disable-networkd-wait.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +HERE="$(dirname "$0")" + +# shellcheck source=net/datacenter-node-install/utils.sh +source "$HERE"/utils.sh + +ensure_env || exit 1 + +set -xe + +systemctl disable systemd-networkd-wait-online.service +systemctl mask systemd-networkd-wait-online.service diff --git a/net/datacenter-node-install/disable-nouveau.sh b/net/datacenter-node-install/disable-nouveau.sh new file mode 100644 index 000000000..f88691bda --- /dev/null +++ b/net/datacenter-node-install/disable-nouveau.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +HERE="$(dirname "$0")" + +# shellcheck source=net/datacenter-node-install/utils.sh +source "$HERE"/utils.sh + +ensure_env || exit 1 + +cat < /etc/modprobe.d/blacklist-nouveau.conf +blacklist nouveau +options nouveau modeset=0 +EOF + +update-initramfs -u diff --git a/net/datacenter-node-install/set-hostname.sh b/net/datacenter-node-install/set-hostname.sh new file mode 100644 index 000000000..78b0d153f --- /dev/null +++ b/net/datacenter-node-install/set-hostname.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +HERE="$(dirname "$0")" + +# shellcheck source=net/datacenter-node-install/utils.sh +source "$HERE"/utils.sh + +ensure_env || exit 1 + +set -xe + +echo "preserve_hostname: false" > /etc/cloud/cloud.cfg.d/99-disable-preserve-hostname.cfg +systemctl restart cloud-init +hostnamectl set-hostname "$1" diff --git a/net/datacenter-node-install/setup-cuda.sh b/net/datacenter-node-install/setup-cuda.sh new file mode 100644 index 000000000..76d2d6a9b --- /dev/null +++ b/net/datacenter-node-install/setup-cuda.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +HERE="$(dirname "$0")" + +# shellcheck source=net/datacenter-node-install/utils.sh +source "$HERE"/utils.sh + +ensure_env || exit 1 + +set -xe + +apt update +apt install -y gcc make dkms + +sh cuda_10.0.130_410.48_linux.run --silent --driver --toolkit +sh cuda_10.1.168_418.67_linux.run --silent --driver --toolkit diff --git a/net/datacenter-node-install/setup-dc-node-1.sh b/net/datacenter-node-install/setup-dc-node-1.sh new file mode 100644 index 000000000..be43a588d --- /dev/null +++ b/net/datacenter-node-install/setup-dc-node-1.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +HERE="$(dirname "$0")" + +# shellcheck source=net/datacenter-node-install/utils.sh +source "$HERE"/utils.sh + +ensure_env || exit 1 + +exit + +if [[ -n "$1" ]]; then + PUBKEY_FILE="$1" +else + cat < "${BASE_SSH_DIR}/authorized_keys" +chown "$SETUP_USER:$SETUP_USER" "${BASE_SSH_DIR}/.ssh/authorized_keys" + +"$HERE"/disable-nouveau.sh +"$HERE"/disable-networkd-wait.sh +"$HERE"/setup-grub.sh +"$HERE"/../scripts/install-earlyoom.sh +"$HERE"/../scripts/install-nodeljs.sh +"$HERE"/../scripts/localtime.sh +"$HERE"/../scripts/install-redis.sh +"$HERE"/../scripts/install-rsync.sh +"$HERE"/../scripts/install-libssl-compatability.sh + +# Setup kernel constants +cat > /etc/sysctl.d/20-solana-node.conf <> /etc/default/grub +update-grub diff --git a/net/datacenter-node-install/setup-ssh.sh b/net/datacenter-node-install/setup-ssh.sh new file mode 100644 index 000000000..d9de90fe4 --- /dev/null +++ b/net/datacenter-node-install/setup-ssh.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +HERE="$(dirname "$0")" + +# shellcheck source=net/datacenter-node-install/utils.sh +source "$HERE"/utils.sh + +ensure_env || exit 1 + +set -xe +# Setup sshd +sed -i 's/^PasswordAuthentication yes//' /etc/ssh/sshd_config +sed -i 's/^#\(PasswordAuthentication\) yes/\1 no/' /etc/ssh/sshd_config +sed -i 's/^#\(PermitRootLogin\) .*/\1 no/' /etc/ssh/sshd_config +systemctl restart sshd diff --git a/net/datacenter-node-install/setup-sudoers.sh b/net/datacenter-node-install/setup-sudoers.sh new file mode 100644 index 000000000..1964aa7a0 --- /dev/null +++ b/net/datacenter-node-install/setup-sudoers.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +HERE="$(dirname "$0")" + +# shellcheck source=net/datacenter-node-install/utils.sh +source "$HERE"/utils.sh + +ensure_env || exit 1 + +set -xe + +# Enable passwordless sudo +EDITOR='tee' visudo <