Installing and Running MTASA Server on GNU Linux: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Added ncurses help for arch based distros)
 
(13 intermediate revisions by 9 users not shown)
Line 3: Line 3:
=== Main binary ===
=== Main binary ===
Download the latest stable 64 bit Linux binaries:
Download the latest stable 64 bit Linux binaries:
  rm -f multitheftauto_linux_x64-{{Current Version|full}}.tar.gz
  rm -f multitheftauto_linux_x64.tar.gz
  wget <nowiki>http</nowiki>://linux.mtasa.com/dl/{{Current Version|fullnodots}}/multitheftauto_linux_x64-{{Current Version|full}}.tar.gz
  wget <nowiki>https</nowiki>://linux.multitheftauto.com/dl/multitheftauto_linux_x64.tar.gz


Unpack into a directory:
Unpack into a directory:
  tar -xf multitheftauto_linux_x64-{{Current Version|full}}.tar.gz
  tar -xf multitheftauto_linux_x64.tar.gz


=== Default config ===
=== Default config ===
Download the default config files:
Download the default config files:
  rm -f baseconfig-{{Current Version|full}}.tar.gz
  rm -f baseconfig.tar.gz
  wget <nowiki>http</nowiki>://linux.mtasa.com/dl/{{Current Version|fullnodots}}/baseconfig-{{Current Version|full}}.tar.gz
  wget <nowiki>https</nowiki>://linux.multitheftauto.com/dl/baseconfig.tar.gz


Unpack and move into the deathmatch directory:<br/>
Unpack and move into the deathmatch directory:<br/>
('''''Note:''' Only do this for new installations as it will overwrite any existing config files.)''
('''''Note:''' Only do this for new installations as it will overwrite any existing config files.)''
  tar -xf baseconfig-{{Current Version|full}}.tar.gz
  tar -xf baseconfig.tar.gz
  mv baseconfig/* multitheftauto_linux_x64-{{Current Version|full}}/mods/deathmatch
  mv baseconfig/* multitheftauto_linux_x64/mods/deathmatch


Change to the MTA server install directory:
Change to the MTA server install directory:
  cd multitheftauto_linux_x64-{{Current Version|full}}
  cd multitheftauto_linux_x64


=== Test ===
=== Test ===
You can now test if the server will start correctly:
You can now test if the server will start correctly:
  ./mta-server64
  ./mta-server64
If your server comes up with issues such as:
libtinfo.so.5: cannot open shared object file: No such file or directory
you may have either a newer or older version of the Shared Object file.
In such cases, it is warranted to create a symbolic link with that same name to the newer or older Shared Object file, with for example:
sudo ln -s /usr/lib/libtinfo.so.6 /usr/lib/libtinfo.so.5
Of course, the location of these files could depend on your distribution of GNU/Linux; refer to your distribution's documentation on the location of the files.


=== Default resources ===
=== Default resources ===
If you need the default resources:
If you need the default resources:
Download the latest default resources zip from http://mirror.mtasa.com/mtasa/resources/
Download the latest default resources zip from https://mirror.multitheftauto.com/mtasa/resources/
and unzip into '''mods/deathmatch/resources'''
and unzip into '''mods/deathmatch/resources'''
<br/>
<br/>
Line 36: Line 42:
  cd mods/deathmatch/resources
  cd mods/deathmatch/resources
  rm -f mtasa-resources-latest.zip
  rm -f mtasa-resources-latest.zip
  wget <nowiki>http</nowiki>://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip
 
  wget <nowiki>https</nowiki>://mirror.multitheftauto.com/mtasa/resources/mtasa-resources-latest.zip
 
  unzip mtasa-resources-latest.zip
  unzip mtasa-resources-latest.zip
  rm -f mtasa-resources-latest.zip
  rm -f mtasa-resources-latest.zip
  cd ../../..
  cd ../../..


== Installation 32 bit ==
== Installation 32 bit ==
Line 46: Line 53:
=== Main binary===
=== Main binary===
Download the latest stable 32 bit Linux binaries:
Download the latest stable 32 bit Linux binaries:
  rm -f multitheftauto_linux-{{Current Version|full}}.tar.gz
  rm -f multitheftauto_linux.tar.gz
  wget <nowiki>http</nowiki>://linux.mtasa.com/dl/{{Current Version|fullnodots}}/multitheftauto_linux-{{Current Version|full}}.tar.gz
  wget <nowiki>https</nowiki>://linux.multitheftauto.com/dl/multitheftauto_linux.tar.gz


Unpack into a directory:
Unpack into a directory:
  tar -xf multitheftauto_linux-{{Current Version|full}}.tar.gz
  tar -xf multitheftauto_linux.tar.gz


=== Default config ===
=== Default config ===
Download the default config files:
Download the default config files:
  rm -f baseconfig-{{Current Version|full}}.tar.gz
  rm -f baseconfig.tar.gz
  wget <nowiki>http</nowiki>://linux.mtasa.com/dl/{{Current Version|fullnodots}}/baseconfig-{{Current Version|full}}.tar.gz
  wget <nowiki>https</nowiki>://linux.multitheftauto.com/dl/baseconfig.tar.gz


Unpack and move into the deathmatch directory:<br/>
Unpack and move into the deathmatch directory:<br/>
('''''Note:''' Only do this for new installations as it will overwrite any existing config files.)''
('''''Note:''' Only do this for new installations as it will overwrite any existing config files.)''
  tar -xf baseconfig-{{Current Version|full}}.tar.gz
  tar -xf baseconfig.tar.gz
  mv baseconfig/* multitheftauto_linux-{{Current Version|full}}/mods/deathmatch
  mv baseconfig/* multitheftauto_linux/mods/deathmatch


Change to the MTA server install directory:
Change to the MTA server install directory:
  cd multitheftauto_linux-{{Current Version|full}}
  cd multitheftauto_linux


=== Test ===
=== Test ===
Line 71: Line 78:
=== Default resources ===
=== Default resources ===
If you need the default resources:
If you need the default resources:
Download the latest default resources zip from http://mirror.mtasa.com/mtasa/resources/
Download the latest default resources zip from https://mirror.multitheftauto.com/mtasa/resources/
and unzip into '''mods/deathmatch/resources'''
and unzip into '''mods/deathmatch/resources'''
<br/>
<br/>
Line 79: Line 86:
  cd mods/deathmatch/resources
  cd mods/deathmatch/resources
  rm -f mtasa-resources-latest.zip
  rm -f mtasa-resources-latest.zip
  wget <nowiki>http</nowiki>://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip
 
  wget <nowiki>https</nowiki>://mirror.multitheftauto.com/mtasa/resources/mtasa-resources-latest.zip
 
  unzip mtasa-resources-latest.zip
  unzip mtasa-resources-latest.zip
  rm -f mtasa-resources-latest.zip
  rm -f mtasa-resources-latest.zip
Line 105: Line 114:
  apt-get install lib32ncursesw5
  apt-get install lib32ncursesw5


You can find more 32-bit library alternatives on this page: [http://www.debian.org/distrib/packages#search_contents www.debian.org/distrib/packages#search_contents].
You can find more 32-bit library alternatives on this page: [https://www.debian.org/distrib/packages#search_contents www.debian.org/distrib/packages#search_contents].
 
If you're running on Arch may need to install [https://aur.archlinux.org/packages/ncurses5-compat-libs ncurses5-compat-libs] from AUR.


== MySQL Troubleshooting==
== MySQL Troubleshooting==
Line 114: Line 125:


If that fails:
If that fails:
* For 32 bit Linux, download [http://nightly.mtasa.com/files/modules/32/libmysqlclient.so.16 32 bit libmysqlclient.so.16] and put it in '''/usr/lib/'''
* For 32 bit Linux, download [https://nightly.multitheftauto.com/files/modules/32/libmysqlclient.so.16 32 bit libmysqlclient.so.16] and put it in '''/usr/lib/'''
* For 64 bit Linux, download [http://nightly.mtasa.com/files/modules/64/libmysqlclient.so.16 64 bit libmysqlclient.so.16] and put it in '''/usr/lib/'''
* For 64 bit Linux, download [https://nightly.multitheftauto.com/files/modules/64/libmysqlclient.so.16 64 bit libmysqlclient.so.16] and put it in '''/usr/lib/'''


==[Optional] Installing and Configuring an External Web Server==
==[Optional] Installing and Configuring an External Web Server==
Line 122: Line 133:
== Server crashes ==
== Server crashes ==


If your Linux server crashes, please obtain a backtrace and post a report on our [http://bugs.mtasa.com/ Bug tracker]
If your Linux server crashes, please obtain a backtrace and post a report on our [https://github.com/multitheftauto/mtasa-blue/issues Bug tracker]


====To obtain a backtrace:====
====To obtain a backtrace:====
Line 144: Line 155:
  apt-get install gdb
  apt-get install gdb
*And from the MTA server directory start the mta-server like this:
*And from the MTA server directory start the mta-server like this:
  gdb mta-server -ex "set print thread-events off" --eval-command run
  gdb -ex "set print thread-events off" --eval-command run --args mta-server -q
*Now wait for a crash. (Ignore any weird screen output in the meantime)
*Now wait for a crash. (Ignore any weird screen output in the meantime)
*When a crash occurs, do this command to get a module list:
*When a crash occurs, do this command to get a module list:
Line 156: Line 167:
== '''Server freezes''' ==
== '''Server freezes''' ==


If your Linux server freezes, please obtain a backtrace with thread information and post a report on our [http://bugs.mtasa.com/ Bug tracker]
If your Linux server freezes, please obtain a backtrace with thread information and post a report on our [https://bugs.multitheftauto.com/ Bug tracker]


====To obtain a backtrace with thread information:====
====To obtain a backtrace with thread information:====
Line 162: Line 173:
  apt-get install gdb
  apt-get install gdb
*And from the MTA server directory start the mta-server like this:
*And from the MTA server directory start the mta-server like this:
  gdb mta-server -ex "set print thread-events off" --eval-command run
  gdb -ex "set print thread-events off" --eval-command run --args mta-server -q
*Now wait for a freeze. (Ignore any weird screen output in the meantime)
*Now wait for a freeze. (Ignore any weird screen output in the meantime)
*When a freeze occurs, press ctrl-c to start gdb
*When a freeze occurs, press ctrl-c to start gdb
Line 181: Line 192:


=== Source code ===
=== Source code ===
  #!/bin/bash -x
#!/bin/bash -x
  #==============================================================================#
#==============================================================================#
  #                                mtasa-install                                #
#                                mtasa-install                                #
  #------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
  #  This shellscript installs MTA:SA on your server (working for RHEL, CentOS  #
#  This shellscript installs MTA:SA on your server. You can configure it and   #
  #  and Oracle Linux. You can configure it and modify it as desired, you can   #
modify it as desired, you can even improve it if you want.                 #
  #  even improve it if you want.                                               #
#==============================================================================#
  #==============================================================================#
    
 
ARCH_TYPE=""
   NUM_VERSION=undef
    
  FUL_VERSION=undef
getArchitecture()
  ARCH_TYPE=""
{
 
    if ((1<<32)); then
   getServerVersion()
        ARCH_TYPE="_x64"
  {
    fi
      wget https://raw.githubusercontent.com/multitheftauto/mtasa-blue/master/Server/version.h # we need to find latest stable version here
}
      local MAJOR_VERSION="$(cat version.h | grep "#define MTASA_VERSION_MAJOR" | awk '{ print $3 }' | sed 's/\r//g')"
 
      local MINOR_VERSION="$(cat version.h | grep "#define MTASA_VERSION_MINOR" | awk '{ print $3 }' | sed 's/\r//g')"
downloadFiles()
      local MAINTENANCE_VERSION="$(cat version.h | grep "#define MTASA_VERSION_MAINTENANCE" | awk '{ print $3 }' | sed 's/\r//g')"
{
      NUM_VERSION="${MAJOR_VERSION}${MINOR_VERSION}${MAINTENANCE_VERSION}"
    wget https://linux.multitheftauto.com/dl/multitheftauto_linux${ARCH_TYPE}.tar.gz
      FUL_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}.${MAINTENANCE_VERSION}"
    wget https://linux.multitheftauto.com/dl/baseconfig.tar.gz
      rm -f version.h
}
  }
 
 
unpack()
  getArchitecture()
{
  {
    tar -xf multitheftauto_linux${ARCH_TYPE}.tar.gz
      if ((1<<32)); then
    tar -xf baseconfig.tar.gz
          ARCH_TYPE="_x64"
}
      fi
 
  }
moveConfig()
 
{
  downloadFiles()
    mv baseconfig/* multitheftauto_linux${ARCH_TYPE}/mods/deathmatch
  {
    rm -rf baseconfig
      wget http://linux.mtasa.com/dl/${NUM_VERSION}/multitheftauto_linux${ARCH_TYPE}-${FUL_VERSION}.tar.gz
    cd multitheftauto_linux${ARCH_TYPE}
      wget http://linux.mtasa.com/dl/${NUM_VERSION}/baseconfig-${FUL_VERSION}.tar.gz
}
  }
    
 
installResources()
  unpack()
{
  {
    mkdir mods/deathmatch/resources
      tar -xf multitheftauto_linux${ARCH_TYPE}-${FUL_VERSION}.tar.gz
    cd mods/deathmatch/resources
      tar -xf baseconfig-${FUL_VERSION}.tar.gz
    wget https://mirror.multitheftauto.com/mtasa/resources/mtasa-resources-latest.zip
  }
    unzip mtasa-resources-latest.zip
 
    cd ../../..
  moveConfig()
}
  {
 
      mv baseconfig/* multitheftauto_linux${ARCH_TYPE}-${FUL_VERSION}/mods/deathmatch
clean()
      rm -rf baseconfig
{
      cd multitheftauto_linux${ARCH_TYPE}-${FUL_VERSION}
    rm -f ../multitheftauto_linux${ARCH_TYPE}.tar.gz
   }
    rm -f ../baseconfig.tar.gz
 
    rm -f mods/deathmatch/resources/mtasa-resources-latest.zip
  installResources()
}
  {
 
      mkdir mods/deathmatch/resources
main()
      cd mods/deathmatch/resources
{
      wget http://mirror.mtasa.com/mtasa/resources/mtasa-resources-latest.zip
    getArchitecture
      unzip mtasa-resources-latest.zip
    clean
      cd ../../..
    downloadFiles
  }
    unpack
 
    moveConfig
  clean()
    installResources
  {
    clean
      rm -f ../multitheftauto_linux${ARCH_TYPE}-${FUL_VERSION}.tar.gz
 
      rm -f ../baseconfig-${FUL_VERSION}.tar.gz
    if ((1<<32)); then # 64 bits
      rm -f mods/deathmatch/resources/mtasa-resources-latest.zip
        echo "Installation ready! Use ./mta-server64 to initialize server"
  }
    else
 
        echo "Installation ready! Use ./mta-server to initialize server"
  main()
    fi
  {
}
      getServerVersion
 
      getArchitecture
main # calling program entry point
      clean
 
      downloadFiles
=== Procedure ===
      unpack
To proceed with installation, save somewhere with read-write-execute access (777) the mtasa-install shell. Finally, proceed to execute it (./mtasa-install for example).
      moveConfig
 
      installResources
=== Alternative way to install server ===
      clean
https://linuxgsm.com/lgsm/mtaserver/
 
      if ((1<<32)); then # 64 bits
          echo "Installation ready! Use ./mta-server64 to initialize server"
      else
          echo "Installation ready! Use ./mta-server to initialize server"
      fi
  }
 
  main # calling program entry point

Latest revision as of 14:19, 3 October 2024

Installation 64 bit

Main binary

Download the latest stable 64 bit Linux binaries:

rm -f multitheftauto_linux_x64.tar.gz
wget https://linux.multitheftauto.com/dl/multitheftauto_linux_x64.tar.gz

Unpack into a directory:

tar -xf multitheftauto_linux_x64.tar.gz

Default config

Download the default config files:

rm -f baseconfig.tar.gz
wget https://linux.multitheftauto.com/dl/baseconfig.tar.gz

Unpack and move into the deathmatch directory:
(Note: Only do this for new installations as it will overwrite any existing config files.)

tar -xf baseconfig.tar.gz
mv baseconfig/* multitheftauto_linux_x64/mods/deathmatch

Change to the MTA server install directory:

cd multitheftauto_linux_x64

Test

You can now test if the server will start correctly:

./mta-server64

If your server comes up with issues such as:

libtinfo.so.5: cannot open shared object file: No such file or directory

you may have either a newer or older version of the Shared Object file. In such cases, it is warranted to create a symbolic link with that same name to the newer or older Shared Object file, with for example:

sudo ln -s /usr/lib/libtinfo.so.6 /usr/lib/libtinfo.so.5

Of course, the location of these files could depend on your distribution of GNU/Linux; refer to your distribution's documentation on the location of the files.

Default resources

If you need the default resources: Download the latest default resources zip from https://mirror.multitheftauto.com/mtasa/resources/ and unzip into mods/deathmatch/resources
Make sure you are in the MTA server install directory when following this example:

apt-get install unzip
mkdir mods/deathmatch/resources
cd mods/deathmatch/resources
rm -f mtasa-resources-latest.zip
wget https://mirror.multitheftauto.com/mtasa/resources/mtasa-resources-latest.zip
unzip mtasa-resources-latest.zip
rm -f mtasa-resources-latest.zip
cd ../../..

Installation 32 bit

Main binary

Download the latest stable 32 bit Linux binaries:

rm -f multitheftauto_linux.tar.gz
wget https://linux.multitheftauto.com/dl/multitheftauto_linux.tar.gz

Unpack into a directory:

tar -xf multitheftauto_linux.tar.gz

Default config

Download the default config files:

rm -f baseconfig.tar.gz
wget https://linux.multitheftauto.com/dl/baseconfig.tar.gz

Unpack and move into the deathmatch directory:
(Note: Only do this for new installations as it will overwrite any existing config files.)

tar -xf baseconfig.tar.gz
mv baseconfig/* multitheftauto_linux/mods/deathmatch

Change to the MTA server install directory:

cd multitheftauto_linux

Test

You can now test if the server will start correctly:

./mta-server

Default resources

If you need the default resources: Download the latest default resources zip from https://mirror.multitheftauto.com/mtasa/resources/ and unzip into mods/deathmatch/resources
Make sure you are in the MTA server install directory when following this example:

apt-get install unzip
mkdir mods/deathmatch/resources
cd mods/deathmatch/resources
rm -f mtasa-resources-latest.zip
wget https://mirror.multitheftauto.com/mtasa/resources/mtasa-resources-latest.zip
unzip mtasa-resources-latest.zip
rm -f mtasa-resources-latest.zip
cd ../../..


Running with 32 or 64 bit Linux

Make sure your server libraries and stuff are up to date

On Debian/Ubuntu this is done with:

apt-get update
apt-get upgrade

Troubleshooting

  • If you get a problem with such as "libreadline.so.5: cannot open shared object file: No such file or directory.", it can be solved on 32 bit Debian/Ubuntu by doing this:
apt-get install libreadline5
  • If you get a problem with such as "libncursesw.so.5 cannot open shared object file: No such file or directory", it can be solved on 32 bit Debian/Ubuntu by doing this:
apt-get install libncursesw5

Note: If you experience this issue on a 64-bit machine while trying to run the 32-bit MTA server, then you should install the following package on a 64-bit Debian/Ubuntu machine (as root):

apt-get install lib32ncursesw5

You can find more 32-bit library alternatives on this page: www.debian.org/distrib/packages#search_contents.

If you're running on Arch may need to install ncurses5-compat-libs from AUR.

MySQL Troubleshooting

  • If you are using the inbuilt MySQL functions such as dbConnect and dbQuery, you will need to have libmysqlclient.so.16 installed.
  • If you get a problem with such as "libmysqlclient.so.16: cannot open shared object file: No such file or directory", it can be solved on Debian/Ubuntu by doing this:
apt-get install libmysqlclient16

If that fails:

[Optional] Installing and Configuring an External Web Server

Instructions on how to install and configure Nginx as an external web server for MTA is here: Installing and Configuring Nginx as an External Web Server

Server crashes

If your Linux server crashes, please obtain a backtrace and post a report on our Bug tracker

To obtain a backtrace:

Do you have a core dump file in the the MTA server directory?

It's usually called 'core', and usually over 100MB, and looks something like this:

Core.png

If you have a core dump file in the the MTA server directory:

  • Install gdb. To install gdb on Debian, use this command:
apt-get install gdb
  • And from the MTA install directory do this command
gdb mta-server -c core
  • When gdb launches, do this command to get a module list:
i sh
  • And then this command to get a backtrace:
bt
  • Save the output
  • (To exit gdb, use the quit command)

If you do not have a core dump file in the the MTA server directory:

  • Install gdb. To install gdb on Debian, use this command:
apt-get install gdb
  • And from the MTA server directory start the mta-server like this:
gdb -ex "set print thread-events off" --eval-command run --args mta-server -q
  • Now wait for a crash. (Ignore any weird screen output in the meantime)
  • When a crash occurs, do this command to get a module list:
i sh
  • And then this command to get a backtrace:
bt
  • Save the output
  • (To exit gdb, use the quit command)


Server freezes

If your Linux server freezes, please obtain a backtrace with thread information and post a report on our Bug tracker

To obtain a backtrace with thread information:

  • Install gdb. To install gdb on Debian, use this command:
apt-get install gdb
  • And from the MTA server directory start the mta-server like this:
gdb -ex "set print thread-events off" --eval-command run --args mta-server -q
  • Now wait for a freeze. (Ignore any weird screen output in the meantime)
  • When a freeze occurs, press ctrl-c to start gdb
  • Then do this command to get a module list:
i sh
  • And then this command to get a backtrace:
bt
  • And then this command to get thread information:
info threads
  • Save the output
  • (To exit gdb, use the quit command)

Automatic installer

Prerequisites

Make sure you have bash, unzip, tar and wget available on your server. Also notice that for 64-bit servers the 64-bit binary will be installed, otherwise 32-bit binary will be.

Source code

#!/bin/bash -x
#==============================================================================#
#                                mtasa-install                                 #
#------------------------------------------------------------------------------#
#  This shellscript installs MTA:SA on your server. You can configure it and   #
#  modify it as desired, you can even improve it if you want.                  #
#==============================================================================#
 
ARCH_TYPE=""
 
getArchitecture()
{
    if ((1<<32)); then
        ARCH_TYPE="_x64"
    fi
}
 
downloadFiles()
{
    wget https://linux.multitheftauto.com/dl/multitheftauto_linux${ARCH_TYPE}.tar.gz
    wget https://linux.multitheftauto.com/dl/baseconfig.tar.gz
}
 
unpack()
{
    tar -xf multitheftauto_linux${ARCH_TYPE}.tar.gz
    tar -xf baseconfig.tar.gz
}
 
moveConfig()
{
    mv baseconfig/* multitheftauto_linux${ARCH_TYPE}/mods/deathmatch
    rm -rf baseconfig
    cd multitheftauto_linux${ARCH_TYPE}
}
 
installResources()
{
    mkdir mods/deathmatch/resources
    cd mods/deathmatch/resources
    wget https://mirror.multitheftauto.com/mtasa/resources/mtasa-resources-latest.zip
    unzip mtasa-resources-latest.zip
    cd ../../..
}
 
clean()
{
    rm -f ../multitheftauto_linux${ARCH_TYPE}.tar.gz
    rm -f ../baseconfig.tar.gz
    rm -f mods/deathmatch/resources/mtasa-resources-latest.zip
}
 
main()
{
    getArchitecture
    clean
    downloadFiles
    unpack
    moveConfig
    installResources
    clean
 
    if ((1<<32)); then # 64 bits
        echo "Installation ready! Use ./mta-server64 to initialize server"
    else
        echo "Installation ready! Use ./mta-server to initialize server"
    fi
}
 
main # calling program entry point

Procedure

To proceed with installation, save somewhere with read-write-execute access (777) the mtasa-install shell. Finally, proceed to execute it (./mtasa-install for example).

Alternative way to install server

https://linuxgsm.com/lgsm/mtaserver/