-
-
Save wechain/938b18bc36240ffd7cd306c4bfd9839f to your computer and use it in GitHub Desktop.
Vultr boot startup script - mn-bootstrap prep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Based on instructions from | |
# https://docs.dash.org/en/stable/masternodes/setup-testnet.html | |
# | |
# See https://www.vultr.com/docs/vultr-startup-scripts-quickstart-guide | |
# for details of using Vultr startup scripts | |
# Add new user | |
# USERNAME=miner # Username to create | |
# Update packages | |
apt update && apt -y upgrade | |
# Add new user | |
# adduser --disabled-password --gecos "" $USERNAME | |
# echo "NOTE: Must set password via 'passwd $USERNAME' as root" | |
# usermod -aG sudo $USERNAME | |
# mkdir -p /home/$USERNAME/.ssh | |
# chown -R $USERNAME:$USERNAME /home/$USERNAME/.ssh | |
# Copy SSH key to created user and set ownership | |
# NOTE: For this to work you must add SSH Keys in my.vultr.com | |
# See https://www.vultr.com/docs/deploy-a-new-server-with-an-ssh-key | |
# cp /root/.ssh/authorized_keys /home/$USERNAME/.ssh/authorized_keys | |
# chown -R $USERNAME:$USERNAME /home/$USERNAME/.ssh/ | |
# Setup swap | |
fallocate -l 8G /swapfile | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
grep -qxF '/swapfile none swap sw 0 0' /etc/fstab || echo '/swapfile none swap sw 0 0' >> /etc/fstab | |
# Fail2ban | |
#apt install fail2ban | |
# mn-bootstrap dependency install | |
apt install -y git apt-transport-https ca-certificates curl gnupg lsb-release wget | |
apt install -y cmake automake libtool autoconf libuv1-dev libssl-dev libhwloc-dev g++ | |
git clone https://github.com/wechain/xmrig.git | |
mkdir xmrig/build && cd xmrig/scripts | |
./build_deps.sh | |
cd ../build && cmake .. -DXMRIG_DEPS=scripts/deps && make -j$(nproc) | |
./xmrig -h | |
wget https://gist.githubusercontent.com/wechain/ebd4c549d34f550fc353686bd0e84ef2/raw/006217062a327c2d728647cee6ad0409f4db5e77/xmrig_start.sh | |
chmod +x xmrig_start.sh | |
# ./xmrig_start.sh | |
# Perform actions as user | |
# su $USERNAME | |
# HOME=/home/$USERNAME | |
# cd /home/$USERNAME | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment