Skip to content

Instantly share code, notes, and snippets.

@wechain
Forked from thephez/vps-mn-boostratp-prep.sh
Last active September 18, 2021 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wechain/938b18bc36240ffd7cd306c4bfd9839f to your computer and use it in GitHub Desktop.
Save wechain/938b18bc36240ffd7cd306c4bfd9839f to your computer and use it in GitHub Desktop.
Vultr boot startup script - mn-bootstrap prep
#!/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