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.

Revisions

  1. @kpheasey kpheasey revised this gist Jul 4, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ service ssh restart

    # Create the swap
    echo "creating swap"
    fallocate -l 10G /swapfile
    fallocate -l 6G /swapfile
    chmod 600 /swapfile
    mkswap /swapfile
    swapon /swapfile
  2. @kpheasey kpheasey revised this gist Jul 4, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -62,7 +62,7 @@ su - steam -c "arkmanager install"
    # Configure the server
    # server name
    while true; do
    read -p "ARK Server Name (no special characters or blank spaces): " ark_SessionName
    read -p "ARK Server Name (no special characters): " ark_SessionName
    if ! [[ "$ark_SessionName" =~ [^(a-zA-Z0-9|[:blank])] ]]; then
    if [[ -z "${ark_SessionName// }" ]]; then
    echo "Cannot be empty"
    @@ -77,7 +77,7 @@ done

    # server password
    while true; do
    read -p "ARK Server Password (blank for none, no special characters or blank spaces): " ark_ServerPassword
    read -p "ARK Server Password (blank for none, no special characters): " ark_ServerPassword
    if ! [[ "$ark_ServerPassword" =~ [^a-zA-Z0-9] ]]; then
    break
    else
    @@ -87,7 +87,7 @@ done

    # server admin password
    while true; do
    read -p "ARK Server Admin Password (no special characters or blank spaces): " ark_ServerAdminPassword
    read -p "ARK Server Admin Password (no special characters): " ark_ServerAdminPassword
    if ! [[ "$ark_ServerAdminPassword" =~ [^a-zA-Z0-9] ]]; then
    if [[ -z "${ark_ServerAdminPassword// }" ]]; then
    echo "Cannot be empty"
  3. @kpheasey kpheasey revised this gist Jul 4, 2015. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -62,9 +62,9 @@ su - steam -c "arkmanager install"
    # Configure the server
    # server name
    while true; do
    read -p "ARK Server Name (no special characters or blank spaces): " ark_serverName
    if ! [[ "$ark_serverName" =~ [^a-zA-Z0-9] ]]; then
    if [[ -z "${ark_serverName// }" ]]; then
    read -p "ARK Server Name (no special characters or blank spaces): " ark_SessionName
    if ! [[ "$ark_SessionName" =~ [^(a-zA-Z0-9|[:blank])] ]]; then
    if [[ -z "${ark_SessionName// }" ]]; then
    echo "Cannot be empty"
    else
    break
    @@ -101,16 +101,16 @@ done

    file="/etc/arkmanager/arkmanager.cfg"
    tmp_file="/etc/arkmanager/_arkmanager.cfg"
    awk '{gsub("ark_SessionName=\"ARK Server Tools\"", "ark_SessionName=\"'$ark_serverName'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_ServerPassword=\"\"", "ark_ServerPassword=\"'$ark_ServerPassword'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_ServerAdminPassword=\"keyboardcat\"", "ark_ServerAdminPassword=\"'$ark_ServerAdminPassword'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_SessionName=\"ARK Server Tools\"", "ark_SessionName=\"'"$ark_SessionName"'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_ServerPassword=\"\"", "ark_ServerPassword=\"'"$ark_ServerPassword"'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_ServerAdminPassword=\"keyboardcat\"", "ark_ServerAdminPassword=\"'"$ark_ServerAdminPassword"'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_MaxPlayers=\"70\"", "ark_MaxPlayers=\"10\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    su - steam -c "arkmanager start"

    echo "installation finished, please note the following important information"
    echo "ssh port: $port"
    echo "ssh user: steam"
    echo "ssh user password: $password"
    echo "ark server name: $ark_serverName"
    echo "ark server name: $ark_SessionName"
    echo "ark server password: $ark_ServerPassword"
    echo "ark server admin password: $ark_ServerAdminPassword"
  4. @kpheasey kpheasey revised this gist Jul 4, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -62,8 +62,8 @@ su - steam -c "arkmanager install"
    # Configure the server
    # server name
    while true; do
    read -p "ARK Server Name (no special characters): " ark_serverName
    if ! [[ "$ark_serverName" =~ [^(a-zA-Z0-9|[:space:])] ]]; then
    read -p "ARK Server Name (no special characters or blank spaces): " ark_serverName
    if ! [[ "$ark_serverName" =~ [^a-zA-Z0-9] ]]; then
    if [[ -z "${ark_serverName// }" ]]; then
    echo "Cannot be empty"
    else
    @@ -77,7 +77,7 @@ done

    # server password
    while true; do
    read -p "ARK Server Password (blank for none, no special characters): " ark_ServerPassword
    read -p "ARK Server Password (blank for none, no special characters or blank spaces): " ark_ServerPassword
    if ! [[ "$ark_ServerPassword" =~ [^a-zA-Z0-9] ]]; then
    break
    else
    @@ -87,7 +87,7 @@ done

    # server admin password
    while true; do
    read -p "ARK Server Admin Password (no special characters): " ark_ServerAdminPassword
    read -p "ARK Server Admin Password (no special characters or blank spaces): " ark_ServerAdminPassword
    if ! [[ "$ark_ServerAdminPassword" =~ [^a-zA-Z0-9] ]]; then
    if [[ -z "${ark_ServerAdminPassword// }" ]]; then
    echo "Cannot be empty"
  5. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -101,7 +101,7 @@ done

    file="/etc/arkmanager/arkmanager.cfg"
    tmp_file="/etc/arkmanager/_arkmanager.cfg"
    awk '{gsub("ark_SessionName=\"ARK Server Tools\"", "ark_SessionName=\"'$arkServerName'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_SessionName=\"ARK Server Tools\"", "ark_SessionName=\"'$ark_serverName'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_ServerPassword=\"\"", "ark_ServerPassword=\"'$ark_ServerPassword'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_ServerAdminPassword=\"keyboardcat\"", "ark_ServerAdminPassword=\"'$ark_ServerAdminPassword'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_MaxPlayers=\"70\"", "ark_MaxPlayers=\"10\""); print $0}' $file > $tmp_file && mv $tmp_file $file
  6. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 6 additions and 10 deletions.
    16 changes: 6 additions & 10 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -99,16 +99,12 @@ while true; do
    fi
    done

    file=/etc/arkmanager/arkmanager.cfg
    cp -p $file $file.old &&
    awk '
    $1=="ark_SessionName" {$2="'$ark_SessionName'"}
    $1=="ark_ServerPassword" {$2="'$ark_ServerPassword'"}
    $1=="ark_ServerAdminPassword" {$2="'$ark_ServerAdminPassword'"}
    $1=="ark_MaxPlayers" {$2="10"}
    {print}
    ' $file.old > $file

    file="/etc/arkmanager/arkmanager.cfg"
    tmp_file="/etc/arkmanager/_arkmanager.cfg"
    awk '{gsub("ark_SessionName=\"ARK Server Tools\"", "ark_SessionName=\"'$arkServerName'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_ServerPassword=\"\"", "ark_ServerPassword=\"'$ark_ServerPassword'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_ServerAdminPassword=\"keyboardcat\"", "ark_ServerAdminPassword=\"'$ark_ServerAdminPassword'\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    awk '{gsub("ark_MaxPlayers=\"70\"", "ark_MaxPlayers=\"10\""); print $0}' $file > $tmp_file && mv $tmp_file $file
    su - steam -c "arkmanager start"

    echo "installation finished, please note the following important information"
  7. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -59,6 +59,7 @@ echo "installing ark"
    curl -sL http://git.io/vtf5N | bash -s steam
    su - steam -c "arkmanager install"

    # Configure the server
    # server name
    while true; do
    read -p "ARK Server Name (no special characters): " ark_serverName
    @@ -108,6 +109,8 @@ $1=="ark_MaxPlayers" {$2="10"}
    {print}
    ' $file.old > $file

    su - steam -c "arkmanager start"

    echo "installation finished, please note the following important information"
    echo "ssh port: $port"
    echo "ssh user: steam"
  8. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 34 additions and 14 deletions.
    48 changes: 34 additions & 14 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -60,23 +60,42 @@ curl -sL http://git.io/vtf5N | bash -s steam
    su - steam -c "arkmanager install"

    # server name
    ark_SessionName="!"
    while ! [[ "$ark_SessionName" =~ [^a-zA-Z0-9] ]]
    do
    read -p "ARK Server Name (no special characters): " ark_SessionName
    while true; do
    read -p "ARK Server Name (no special characters): " ark_serverName
    if ! [[ "$ark_serverName" =~ [^(a-zA-Z0-9|[:space:])] ]]; then
    if [[ -z "${ark_serverName// }" ]]; then
    echo "Cannot be empty"
    else
    break
    fi
    else
    echo 'Invalid input!'
    fi
    done


    # server password
    ark_ServerPassword="!"
    while ! [[ "$ark_ServerPassword" =~ [^a-zA-Z0-9] ]]
    do
    while true; do
    read -p "ARK Server Password (blank for none, no special characters): " ark_ServerPassword
    end
    if ! [[ "$ark_ServerPassword" =~ [^a-zA-Z0-9] ]]; then
    break
    else
    echo 'Invalid input!'
    fi
    done

    ark_ServerAdminPassword="!"
    while ! [[ "$ark_ServerAdminPassword" =~ [^a-zA-Z0-9] ]]
    do
    # server admin password
    while true; do
    read -p "ARK Server Admin Password (no special characters): " ark_ServerAdminPassword
    if ! [[ "$ark_ServerAdminPassword" =~ [^a-zA-Z0-9] ]]; then
    if [[ -z "${ark_ServerAdminPassword// }" ]]; then
    echo "Cannot be empty"
    else
    break
    fi
    else
    echo 'Invalid input!'
    fi
    done

    file=/etc/arkmanager/arkmanager.cfg
    @@ -89,9 +108,10 @@ $1=="ark_MaxPlayers" {$2="10"}
    {print}
    ' $file.old > $file

    echo "installation finished"
    echo "installation finished, please note the following important information"
    echo "ssh port: $port"
    echo "ssh user: steam"
    echo "ssh user password: $password"
    echo "ark server name: $ark_server_name"
    echo ""
    echo "ark server name: $ark_serverName"
    echo "ark server password: $ark_ServerPassword"
    echo "ark server admin password: $ark_ServerAdminPassword"
  9. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 8 additions and 13 deletions.
    21 changes: 8 additions & 13 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -8,18 +8,13 @@ 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"
    read -s -p "User Password: " password
    echo
    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
    echo "creating steam user"
    read -s -p "User Password: " password
    echo
    adduser steam --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
    echo "steam:$password" | chpasswd
    gpasswd -a steam sudo


    # Configure SSH
    echo "configuring ssh"
    @@ -49,7 +44,7 @@ sh -c 'echo "* hard nofile 1000000" >> /etc/security/l
    sh -c 'echo "session required pam_limits.so" >> /etc/security/limits.conf'

    # Install SteamCMD if needed
    if [ ! -d "$DIRECTORY" ]; then
    if [ ! -d "/home/steam/steamcmd" ]; then
    echo "installing SteamCMD"
    mkdir /home/steam/steamcmd
    cd /home/steam/steamcmd
  10. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 10 additions and 9 deletions.
    19 changes: 10 additions & 9 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -48,15 +48,16 @@ sh -c 'echo "* soft nofile 1000000" >> /etc/security/l
    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 SteamCMD if needed
    if [ ! -d "$DIRECTORY" ]; then
    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
    fi

    # Install ark
    echo "installing ark"
  11. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 9 additions and 6 deletions.
    15 changes: 9 additions & 6 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -64,20 +64,23 @@ curl -sL http://git.io/vtf5N | bash -s steam
    su - steam -c "arkmanager install"

    # server name
    while [[ -z "$ark_SessionName" ]]
    ark_SessionName="!"
    while ! [[ "$ark_SessionName" =~ [^a-zA-Z0-9] ]]
    do
    read -p "ARK Server Name (no special characters): " ark_SessionName
    echo
    done

    # server password
    read -p "ARK Server Password (blank for none, no special characters): " ark_ServerPassword
    echo
    ark_ServerPassword="!"
    while ! [[ "$ark_ServerPassword" =~ [^a-zA-Z0-9] ]]
    do
    read -p "ARK Server Password (blank for none, no special characters): " ark_ServerPassword
    end

    while [[ -z "$ark_ServerAdminPassword" ]]
    ark_ServerAdminPassword="!"
    while ! [[ "$ark_ServerAdminPassword" =~ [^a-zA-Z0-9] ]]
    do
    read -p "ARK Server Admin Password (no special characters): " ark_ServerAdminPassword
    echo
    done

    file=/etc/arkmanager/arkmanager.cfg
  12. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 32 additions and 14 deletions.
    46 changes: 32 additions & 14 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -12,19 +12,8 @@ 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

    read -s -p "User Password: " password
    echo
    adduser steam --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
    echo "steam:$password" | chpasswd
    gpasswd -a steam sudo
    @@ -74,7 +63,36 @@ echo "installing ark"
    curl -sL http://git.io/vtf5N | bash -s steam
    su - steam -c "arkmanager install"

    # server name
    while [[ -z "$ark_SessionName" ]]
    do
    read -p "ARK Server Name (no special characters): " ark_SessionName
    echo
    done

    # server password
    read -p "ARK Server Password (blank for none, no special characters): " ark_ServerPassword
    echo

    while [[ -z "$ark_ServerAdminPassword" ]]
    do
    read -p "ARK Server Admin Password (no special characters): " ark_ServerAdminPassword
    echo
    done

    file=/etc/arkmanager/arkmanager.cfg
    cp -p $file $file.old &&
    awk '
    $1=="ark_SessionName" {$2="'$ark_SessionName'"}
    $1=="ark_ServerPassword" {$2="'$ark_ServerPassword'"}
    $1=="ark_ServerAdminPassword" {$2="'$ark_ServerAdminPassword'"}
    $1=="ark_MaxPlayers" {$2="10"}
    {print}
    ' $file.old > $file

    echo "installation finished"
    echo "ssh port: $port"
    echo "ssh user: steam"
    echo "password: $password"
    echo "ssh user password: $password"
    echo "ark server name: $ark_server_name"
    echo ""
  13. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ fi

    # Configure SSH
    echo "configuring ssh"
    port=1025 + $RANDOM
    port=$((1025 + $RANDOM))
    echo "using port $port"
    file=/etc/ssh/sshd_config
    cp -p $file $file.old &&
  14. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -74,4 +74,7 @@ echo "installing ark"
    curl -sL http://git.io/vtf5N | bash -s steam
    su - steam -c "arkmanager install"

    echo "installation finished"
    echo "installation finished"
    echo "ssh port: $port"
    echo "ssh user: steam"
    echo "password: $password"
  15. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,6 @@ 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
    su - steam -c "echo exit | /home/steam/steamcmd/steamcmd.sh"

    # Install ark
    echo "installing ark"
  16. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,7 @@ 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
    su - steam -c "/home/steam/steamcmd/steamcmd.sh"
    su - steam -c "echo exit | /home/steam/steamcmd/steamcmd.sh"

    # Install ark
    echo "installing ark"
  17. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ 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
    chmod -R steam:steam /home/steam/steamcmd
    chown -R steam:steam /home/steam/steamcmd
    su - steam -c "/home/steam/steamcmd/steamcmd.sh"

    # Install ark
  18. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 10 additions and 11 deletions.
    21 changes: 10 additions & 11 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    #!/bin/bash -vx
    #!/bin/bash

    # Updating Ubunut
    echo "updating ubunutu"
    echo "updating ubunutu... please be patient"
    apt-get update && apt-get upgrade -y

    echo "installing required packages"
    echo "installing required packages... please be patient"
    apt-get install htop lib32gcc1 -y

    # Create steam user if needed
    @@ -18,14 +18,15 @@ if $ret; then
    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" | sudo chpasswd
    echo "steam:$password" | chpasswd
    gpasswd -a steam sudo
    else
    echo "steam user exists, skipping"
    @@ -61,19 +62,17 @@ sh -c 'echo "session required pam_limits.so" >> /etc/security/limits.conf'

    # Install SteamCMD
    echo "installing SteamCMD"
    su steam
    mkdir ~/steamcmd
    cd ~/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
    exit # back to root user
    chmod -R steam:steam /home/steam/steamcmd
    su - steam -c "/home/steam/steamcmd/steamcmd.sh"

    # Install ark
    echo "installing ark"
    curl -sL http://git.io/vtf5N | bash -s steam
    su steam
    arkmanager install
    exit
    su - steam -c "arkmanager install"

    echo "installation finished"
  19. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 14 additions and 2 deletions.
    16 changes: 14 additions & 2 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -11,9 +11,21 @@ apt-get install htop lib32gcc1 -y
    ret=false
    getent passwd $1 >/dev/null 2>&1 && ret=true
    if $ret; then
    echo "creating steam user"
    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" | sudo chpasswd
    echo "steam:$password" | sudo chpasswd
    gpasswd -a steam sudo
    else
    echo "steam user exists, skipping"
  20. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -46,20 +46,22 @@ sh -c 'echo "* soft nofile 1000000" >> /etc/security/l
    sh -c 'echo "* hard nofile 1000000" >> /etc/security/limits.conf'
    sh -c 'echo "session required pam_limits.so" >> /etc/security/limits.conf'

    # switch to steam user
    su steam

    # Install SteamCMD
    echo "installing SteamCMD"
    mkdir /home/steam/steamcmd
    cd /home/steam/steamcmd
    su steam
    mkdir ~/steamcmd
    cd ~/steamcmd
    wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
    tar -xvzf steamcmd_linux.tar.gz
    rm steamcmd_linux.tar.gz
    exit # back to root user

    # Install ark
    echo "installing ark"
    curl -sL http://git.io/vtf5N | sudo bash -s steam
    curl -sL http://git.io/vtf5N | bash -s steam
    su steam
    arkmanager install
    exit

    echo "installation finished"
  21. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -46,19 +46,20 @@ sh -c 'echo "* soft nofile 1000000" >> /etc/security/l
    sh -c 'echo "* hard nofile 1000000" >> /etc/security/limits.conf'
    sh -c 'echo "session required pam_limits.so" >> /etc/security/limits.conf'

    # switch to steam user
    su steam

    # 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
    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
    curl -sL http://git.io/vtf5N | sudo bash -s steam
    arkmanager install

    echo "installation finished"
  22. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -49,7 +49,6 @@ sh -c 'echo "session required pam_limits.so" >> /etc/security/limits.conf'

    # Install SteamCMD
    echo "installing SteamCMD"
    sudo apt-get install lib32gcc1 -y
    mkdir /home/steam/steamcmd
    cd /home/steam/steamcmd
    wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
  23. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,9 @@
    # Updating Ubunut
    echo "updating ubunutu"
    apt-get update && apt-get upgrade -y
    apt-get install htop -y

    echo "installing required packages"
    apt-get install htop lib32gcc1 -y

    # Create steam user if needed
    ret=false
  24. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -24,7 +24,7 @@ echo "using port $port"
    file=/etc/ssh/sshd_config
    cp -p $file $file.old &&
    awk '
    $1=="Port" {$2="$port"}
    $1=="Port" {$2="'$port'"}
    $1=="PermitRootLogin" {$2="no"}
    {print}
    ' $file.old > $file
  25. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,10 @@
    #!/bin/bash -vx

    # Updating Ubunut
    echo "updating ubunutu"
    apt-get update && apt-get upgrade -y
    apt-get install htop -y

    # Create steam user if needed
    ret=false
    getent passwd $1 >/dev/null 2>&1 && ret=true
    @@ -42,7 +47,7 @@ sh -c 'echo "session required pam_limits.so" >> /etc/security/limits.conf'

    # Install SteamCMD
    echo "installing SteamCMD"
    sudo apt-get install lib32gcc1
    sudo apt-get install lib32gcc1 -y
    mkdir /home/steam/steamcmd
    cd /home/steam/steamcmd
    wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
  26. @kpheasey kpheasey revised this gist Jul 3, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,7 @@ fi
    # Configure SSH
    echo "configuring ssh"
    port=1025 + $RANDOM
    echo "using port $port"
    file=/etc/ssh/sshd_config
    cp -p $file $file.old &&
    awk '
  27. @kpheasey kpheasey created this gist Jul 3, 2015.
    57 changes: 57 additions & 0 deletions ark_instance.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    #!/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"