-
-
Save zachskaggs/79b06f9ee502b96b7fceaf71a1cf0a7b to your computer and use it in GitHub Desktop.
DO Ubuntu 14.04 Droplet to ARK Server
This file contains hidden or 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/bash | |
| # Updating Ubunut | |
| echo "updating ubunutu... please be patient" | |
| apt-get update && apt-get upgrade -y | |
| echo "installing required packages... please be patient" | |
| apt-get install htop lib32gcc1 -y | |
| # Create steam user if needed | |
| ret=false | |
| getent passwd $1 >/dev/null 2>&1 && ret=true | |
| if $ret; then | |
| echo "creating steam user" | |
| # get the password | |
| while true | |
| do | |
| read -s -p "Password: " password | |
| echo | |
| read -s -p "Password (again): " password2 | |
| echo | |
| [ "$password" = "$password2" ] && break | |
| echo "Please try again" | |
| done | |
| adduser steam --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password | |
| echo "steam:$password" | chpasswd | |
| gpasswd -a steam sudo | |
| else | |
| echo "steam user exists, skipping" | |
| fi | |
| # Configure SSH | |
| echo "configuring ssh" | |
| port=1025 + $RANDOM | |
| echo "using port $port" | |
| 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" | |
| 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 | |
| rm steamcmd_linux.tar.gz | |
| chown -R steam:steam /home/steam/steamcmd | |
| # Install ark | |
| echo "installing ark" | |
| curl -sL http://git.io/vtf5N | bash -s steam | |
| su - steam -c "arkmanager install" | |
| echo "installation finished" | |
| echo "ssh port: $port" | |
| echo "ssh user: steam" | |
| echo "password: $password" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment