Skip to content

Instantly share code, notes, and snippets.

@zachskaggs
Forked from kpheasey/ark_instance.sh
Created June 7, 2016 14:37
Show Gist options
  • Select an option

  • Save zachskaggs/79b06f9ee502b96b7fceaf71a1cf0a7b to your computer and use it in GitHub Desktop.

Select an option

Save zachskaggs/79b06f9ee502b96b7fceaf71a1cf0a7b to your computer and use it in GitHub Desktop.
DO Ubuntu 14.04 Droplet to ARK Server
#!/bin/bash -vx
# Create steam user if needed
ret=false
getent passwd $1 >/dev/null 2>&1 && ret=true
if $ret; then
echo "creating steam user"
adduser steam --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
echo "steam:password" | sudo chpasswd
gpasswd -a steam sudo
else
echo "steam user exists, skipping"
fi
# Configure SSH
echo "configuring ssh"
port=1025 + $RANDOM
file=/etc/ssh/sshd_config
cp -p $file $file.old &&
awk '
$1=="Port" {$2="$port"}
$1=="PermitRootLogin" {$2="no"}
{print}
' $file.old > $file
service ssh restart
# Create the swap
echo "creating swap"
fallocate -l 10G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
sh -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'
# Increase file usage limit
echo "increasing file usage limits"
sh -c 'echo "* soft nofile 1000000" >> /etc/security/limits.conf'
sh -c 'echo "* hard nofile 1000000" >> /etc/security/limits.conf'
sh -c 'echo "session required pam_limits.so" >> /etc/security/limits.conf'
# Install SteamCMD
echo "installing SteamCMD"
sudo apt-get install lib32gcc1
mkdir /home/steam/steamcmd
cd /home/steam/steamcmd
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz
chown -R steam /home/steam/steamcmd
rm steamcmd_linux.tar.gz
# Install ark
echo "installing ark"
curl -sL http://git.io/vtf5N | bash -s steam
arkmanager install
echo "installation finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment