[Yandex Cloud documentation](../../index.md) > [Tutorials](../index.md) > Application solutions > Other > Deploying a multiplayer server for GTA V in Yandex Cloud

# Deploying a multiplayer server for GTA V in Yandex Cloud

To enable multiplayer mode in [Grand Theft Auto V](https://en.wikipedia.org/wiki/Grand_Theft_Auto_V) from Rockstar Games, you can deploy a multiplayer server on a [virtual machine](../../compute/concepts/vm.md) in Yandex Cloud.

To deploy a GTA V multiplayer server in Yandex Cloud:

1. [Get your cloud ready](#prepare-cloud).
1. [Create a security group](#create-sg).
1. [Create a VM for the GTA V server](#vm-gta-v).
1. [Install the required utilities and packages](#install-tools).
1. [Start the GTA V server](#launch-server).
1. [Test the solution](#test-functionality).

If you no longer need the resources you created, [delete them](#clear-out).

## Get your cloud ready {#prepare-cloud}

Sign up for Yandex Cloud and create a [billing account](../../billing/concepts/billing-account.md):
1. Navigate to the [management console](https://console.yandex.cloud) and log in to Yandex Cloud or create a new account.
1. On the **[Yandex Cloud Billing](https://center.yandex.cloud/billing/accounts)** page, make sure you have a billing account linked and it has the `ACTIVE` or `TRIAL_ACTIVE` [status](../../billing/concepts/billing-account-statuses.md). If you do not have a billing account, [create one](../../billing/quickstart/index.md) and [link](../../billing/operations/pin-cloud.md) a cloud to it.

If you have an active billing account, you can create or select a [folder](../../resource-manager/concepts/resources-hierarchy.md#folder) for your infrastructure on the [cloud page](https://console.yandex.cloud/cloud).

[Learn more about clouds and folders here](../../resource-manager/concepts/resources-hierarchy.md).

### Required paid resources {#paid-resources}

The infrastructure support cost includes:

* Fee for continuously running VMs (see [Yandex Compute Cloud](../../compute/pricing.md) pricing).
* Fee for using public IP addresses and outbound traffic (see [Yandex Virtual Private Cloud](../../vpc/pricing.md) pricing).

## Create a security group {#create-sg}

Create a [security group](../../vpc/concepts/security-groups.md) with a rule that allows traffic to ports `22005` and `22006`. These are the default ports in the GTA V server configuration file.

{% list tabs group=instructions %}

- Management console {#console}

   1. In the [management console](https://console.yandex.cloud), select your folder.
   1. Navigate to **Virtual Private Cloud**.
   1. In the left-hand panel, select ![image](../../_assets/vpc/security-group.svg) **Security groups**. 
   1. Click **Create security group**.
   1. In the **Name** field, specify the name: `gta-v-sg`.
   1. In the **Network** field, select `default`.
   1. Under **Rules**, [create](../../vpc/operations/security-group-add-rule.md) the following traffic management rules:

      | Traffic<br/>direction | Description | Port range | Protocol | Source /<br/>Destination name | CIDR blocks |
      | --- | --- | --- | --- | --- | --- |
      | Inbound | `sessions-u`           | `22005` | `Any` | `CIDR` | `0.0.0.0/0` |
      | Inbound | `server-http`           | `22006` | `Any` | `CIDR` | `0.0.0.0/0` |

   1. Click **Save**.

{% endlist %}

## Create a VM for the GTA V multiplayer server {#vm-gta-v}

1. Create an SSH key pair:
   ```bash
   ssh-keygen -t ed25519
   ```
   We recommend sticking with the default key file name.

1. Create a VM with a public IP address:

   {% list tabs group=instructions %}

   - Management console {#console}

      1. In the [management console](https://console.yandex.cloud), select the [folder](../../resource-manager/concepts/resources-hierarchy.md#folder) where you want to create your VM.
      1. Navigate to **Compute Cloud**.
      1. In the left-hand panel, select ![image](../../_assets/console-icons/server.svg) **Virtual machines**.
      1. Click **Create virtual machine**.
      1. Under **Boot disk image**, in the **Product search** field, enter `Ubuntu 22.04 LTS` and select a public [Ubuntu 22.04 LTS](https://yandex.cloud/en/marketplace/products/yc/ubuntu-22-04-lts) image.
      1. Under **Location**, select an [availability zone](../../overview/concepts/geo-scope.md) where your VM will reside.
      1. Under **Disks and file storages**, select the `HDD` [disk type](../../compute/concepts/disk.md#disks_types) and specify its size: `20 GB`.
      1. Under **Computing resources**, switch to the `Custom` tab and specify the [platform](../../compute/concepts/vm-platforms.md), number of vCPUs, and amount of RAM:

          * **Platform**: `Intel Ice Lake`
          * **vCPU**: `2`
          * **Guaranteed vCPU performance**: `100%`
          * **RAM**: `2 GB`

      1. Under **Network settings**:

          * In the **Subnet** field, select the network and subnet to which you want to connect your VM. If the [network](../../vpc/concepts/network.md#network) or [subnet](../../vpc/concepts/network.md#subnet) you need does not exist yet, [create it](../../vpc/operations/subnet-create.md).
          * In the **Public IP address** field, select a static IP address from the list, or leave `Auto` to assign your VM a random external IP address from the Yandex Cloud pool.
          * In the **Security groups** field, select `gta-v-sg`.

      1. Under **Access**, select **SSH key** and specify the VM access credentials:

          * In the **Login** field, enter a username, e.g., `ubuntu`. Do not use `root` or other [reserved usernames](https://github.com/canonical/subiquity/blob/main/reserved-usernames). For operations requiring root privileges, use the `sudo` command.
          * In the **SSH key** field, select the SSH key saved in your [organization user](../../organization/concepts/membership.md) profile.
            
            If there are no SSH keys in your profile or you want to add a new key:
            
            1. Click **Add key**.
            1. Enter a name for the SSH key.
            1. Select one of the following:
            
                * `Enter manually`: Paste the contents of the public SSH key. You need to [create](../../compute/operations/vm-connect/ssh.md#creating-ssh-keys) an SSH key pair on your own.
                * `Load from file`: Upload the public part of the SSH key. You need to create an SSH key pair on your own.
                * `Generate key`: Automatically create an SSH key pair.
                
                  When adding a new SSH key, an archive containing the key pair will be created and downloaded. In Linux or macOS-based operating systems, unpack the archive to the `/home/<user_name>/.ssh` directory. In Windows, unpack the archive to the `C:\Users\<user_name>/.ssh` directory. You do not need additionally enter the public key in the management console.
            
            1. Click **Add**.
            
            The system will add the SSH key to your organization user profile. If the organization has [disabled](../../organization/operations/os-login-access.md) the ability for users to add SSH keys to their profiles, the added public SSH key will only be saved in the user profile inside the newly created resource.

      1. Under **General information**, specify the VM name: `gta-v-server`.
      1. Click **Create VM**.

   {% endlist %}

## Install the required utilities and packages {#install-tools}

1. [Use SSH to connect](../../compute/operations/vm-connect/ssh.md#vm-connect) to the VM you created.
1. Install the required `toolchain` packages from the Ubuntu-Toolchain repository, `libstdc++6`, `libatomic1`, and the `screen` utility to run the terminal session in background mode:

   ```bash
   sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
   sudo apt update -y && sudo apt install libstdc++6 libatomic1 screen
   ```

1. Download the server distribution to the current directory:

   ```bash
   wget https://cdn.rage.mp/updater/prerelease/server-files/linux_x64.tar.gz
   ```

1. Unpack the archive:

   ```bash
   tar -xzf linux_x64.tar.gz
   ```

1. Go to the directory with the server and make the `ragemp-server` file executable:

   ```bash
   cd ragemp-srv
   chmod +x ragemp-server
   ```

1. If you want, you can install the RAGE.MP Freeroam package. RAGE.MP Freeroam is a simple modification that gives multiplayer users access to all skins, weapons, and vehicles. Players can also restore health and defense. To install the package:

   1. Go to the directory with the installed server:

   ```bash
   cd ~/ragemp-srv
   ```

   1. Download the mod distribution from the GitHub developer page:

   ```bash
   git clone https://github.com/n-n1ks/rage.mp-freeroam.git
   ```

   1. Go to the `rage.mp-freeroam` repository directory and copy the required folders:

   ```bash
   cd rage.mp-freeroam
   cp -r ./client_packages/* ../client_packages/
   cp -r ./packages/* ../packages/
   ```

## Start the GTA V server {#launch-server}

1. Run the background screen session:

   ```bash
   screen
   ```

1. In the background session, run the server:

   ```bash
   ./ragemp-server
   ```

   Make sure you get _The server is ready to accept connections_ in the output:

   ```bash
   [INFO] Starting RAGE Multiplayer server...

   [============================================================]
   ||
   ||      MaxPlayers              100
   ||      Sync rate               40ms
   ||      Name                    RAGE:MP Unofficial server
   ||      Gamemode                freeroam
   ||      Streaming distance      300
   ||      Announcement            disabled
   ||      Voice chat              disabled
   ||      Address                 127.0.0.1:22005
   ||      Connection limits       disabled
   ||      Encryption              enabled
   ||      NodeJS                  enabled
   ||      C#                      disabled
   ||
   [============================================================]


   [INFO] Loading NodeJS packages...
   [INFO] Starting packages...
   [DONE] Server packages have been started.
   [DONE] Started resource transfer server at 22006 port.
   [DONE] Client-side packages weight: 0.000000 MB (uncompressed: 0.000000 MB).
   [INFO] Initializing networking...
   [DONE] Networking has been started: (IPv4-only) at 127.0.0.1:22005
   [DONE] The server is ready to accept connections.
   ```

## Test the solution {#test-functionality}

1. Download and install [RageMP](https://rage.mp/ru) on the computer with GTA 5:

   ```url
   https://cdn.rage.mp/public/files/RAGEMultiplayer_Setup.exe
   ```

1. Run Grand Theft Auto V via RageMP. 
1. In the multiplayer window, click the direct server connection icon.
1. In the dialog box that opens, specify your VM’s public IP address and port `22005`.
1. Connect to the server by clicking **Connect**. 
1. If you have configured RAGE.MP Freeroam, press F2 to reveal the additional options menu.

## How to delete the resources you created {#clear-out}

To stop paying for the resources you created:
1. In Compute Cloud, [delete](../../compute/operations/vm-control/vm-delete.md) the VM you created.
1. In Virtual Private Cloud, [delete](../../vpc/operations/security-group-delete.md) the security group you created.