# Install ESX Legacy with txAdmin (/docs/getting-started/installation)

The fastest and most reliable way to install ESX Legacy is the official **txAdmin recipe**. txAdmin ships with every FiveM server build. The recipe downloads ESX and its dependencies, imports the SQL schema into your database and writes a ready-to-use `server.cfg`. A fresh install takes about 10 to 15 minutes.

If you cannot or do not want to use txAdmin, follow [Manual installation](/docs/getting-started/manual-installation) instead.

## Before you begin [#before-you-begin]

| Requirement | Notes |
| --- | --- |
| cfx.re account | Needed to log in to txAdmin and to create a server license key. Sign up at [cfx.re](https://cfx.re). |
| MariaDB | ESX needs a MySQL-compatible database. Install [MariaDB](https://mariadb.org/download/) and remember the root password you set. |
| Windows or Linux machine | This guide shows Windows. On Linux the txAdmin part is identical. |
| Disk space | Plan for several GB: server build, resources, database and backups. |
| Open port | Players connect on port `30120` (TCP and UDP) by default. |

<Callout type="warn" title="Do not use XAMPP">
XAMPP bundles an old MySQL/MariaDB with defaults meant for local web development. It is a common source of crashes and lost data on FiveM servers. Install MariaDB on its own.
</Callout>

## What the recipe installs [#what-the-recipe-installs]

The ESX Legacy recipe (`recipe.yaml` in [esx-recipes](https://github.com/esx-framework/esx-recipes)) runs these tasks in order:

1. Downloads the default cfx resources into `resources/[cfx-default]` and removes their `chat` resource (the server uses the built-in system chat instead).
2. Downloads `server.cfg` and the server icon `esxLogo.png` from the recipe repository.
3. Connects to your database and imports `[SQL]/legacy.sql` from `esx_core`.
4. Downloads `esx_core` into `resources/[core]` and the official addons into `resources/[esx_addons]`.
5. Downloads standalone resources into `resources/[standalone]`: `oxmysql`, `ox_lib`, `pma-voice`, `bob74_ipl`, `sd-phone` and `sd-phone-props`.
6. Enables OneSync (the recipe sets `$onesync: on`).

The result is a complete roleplay server with jobs, shops, banking, housing, vehicles and a phone.

## Installation [#installation]

<Steps>
<Step>
### Download the server build [#download-the-server-build]

Download the latest FiveM server build ("artifacts") for Windows. You can use the official build list at [runtime.fivem.net](https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/) or the community mirror [artifacts.jgscripts.com](https://artifacts.jgscripts.com), which shows known-broken builds.

![Server artifacts download page](/images/tutorial/artifactspreview.png)

On artifacts.jgscripts.com, click **Windows** to download the recommended build.

![Windows download button](/images/tutorial/server7z.png)

Extract the archive to a permanent folder, for example `C:\FXServer\server`.

![Extracting the server files](/images/tutorial/extract.png)

<Callout type="warn">
Pick the final location now. txAdmin stores absolute paths, so moving the folder later means updating them by hand. Avoid OneDrive or other synced folders.
</Callout>
</Step>

<Step>
### Start FXServer and link your account [#start-fxserver-and-link-your-account]

Open the extracted folder and run `FXServer.exe`. If your antivirus flags it, add an exception for the server folder.

![FXServer.exe in the server folder](/images/tutorial/fxserver.png)

A browser tab opens with the txAdmin setup page. If it does not, the console prints the URL (usually `http://localhost:40120`) and a PIN. Click **Link Account** and log in with your cfx.re account.

![Link your cfx.re account](/images/tutorial/linkacc.png)

Create a backup password. You need it if the cfx.re login is ever unavailable.

![Create a backup password](/images/tutorial/backuppass.png)
</Step>

<Step>
### Name the server and pick the ESX recipe [#name-the-server-and-pick-the-esx-recipe]

Enter a server name. It shows up in the FiveM server list and in `sv_hostname`.

![Server name](/images/tutorial/esxservername.png)

As deployment type choose **Popular Recipes**, then select **ESX Legacy**.

![Popular recipes](/images/tutorial/recipes.png)

![ESX Legacy recipe](/images/tutorial/esx-legacy.png)
</Step>

<Step>
### Choose the data folder [#choose-the-data-folder]

txAdmin asks where to put the server data (`resources`, `server.cfg`, cache). Change the default to a short dedicated path such as `C:\FXServer\esx-server`.

![Change the server data path](/images/tutorial/change-path.png)

Create the folder in Explorer first if txAdmin complains that it does not exist, then save the path.

![Save the server data path](/images/tutorial/save-path.png)

<Callout type="info">
Keep the server build (`FXServer.exe`) and the server data in separate folders. Then you can replace the build during an update without touching your resources.
</Callout>
</Step>

<Step>
### Open the recipe deployer and enter the database [#open-the-recipe-deployer-and-enter-the-database]

Continue to the **Recipe Deployer**.

![Go to the recipe deployer](/images/tutorial/gotorecipedeployer.png)

txAdmin asks for your database connection. Make sure the MariaDB service is running, then enter:

| Field | Typical value |
| --- | --- |
| Host | `localhost` |
| Port | `3306` |
| Username | `root` (or a dedicated user, see below) |
| Password | the password you chose when installing MariaDB |
| Database name | for example `es_extended` or `esx_legacy` |

txAdmin builds the `mysql_connection_string` from these values and writes it into `server.cfg`.
</Step>

<Step>
### Add your license key [#add-your-license-key]

On the **Review Recipe** page, paste a server license key.

![Review recipe page](/images/tutorial/reviewrecipe.png)

Create a key at [portal.cfx.re](https://portal.cfx.re/servers/registration-keys) with the same cfx.re account. One key per server.

<Callout type="error" title="Keep the key private">
The license key identifies your server. Never post it in screenshots, support tickets or public repositories. If it leaks, revoke it on the portal and create a new one.
</Callout>
</Step>

<Step>
### Run the recipe [#run-the-recipe]

Click **Run Recipe**. The download of the addons can take several minutes. When it finishes, txAdmin shows the generated `server.cfg`. Check the values (max players, locale, tags), then click **Next** and start the server.

![Setup complete](/images/tutorial/done.png)
</Step>
</Steps>

## After the installation [#after-the-installation]

1. **Watch the first start.** The console should show `oxmysql` connecting, `es_extended` starting and the ESX migrations running. A message like `Server restart required!` after migrations is expected on the first start; restart the server once.
2. **Join your server.** In FiveM press F8 and type `connect localhost:30120`. You should see the ESX loading screen, then character creation from `esx_multicharacter` and `esx_identity`.
3. **Make yourself admin.** txAdmin adds your account as a master admin in `server.cfg`. To get the ESX `admin` group in game, see [Admin permissions](/docs/guides/admin-permissions).
4. **Create a dedicated database user.** Running a public server as `root` is a bad idea. Create a user that only has rights on your ESX database and update the connection string. See [server.cfg](/docs/getting-started/server-cfg#database-connection).
5. **Set up backups.** Back up the database and the `resources` folder before every change. txAdmin can schedule restarts, but it does not back up your database.

## Choosing the language [#choosing-the-language]

ESX picks its language from the `esx:locale` convar. If that is not set, it uses the language you selected in txAdmin (`txAdmin-locale`), and falls back to English. To force a language, uncomment this line in `server.cfg`:

```bash title="server.cfg"
setr esx:locale "de"
```

## Common problems [#common-problems]

| Problem | Cause and fix |
| --- | --- |
| Antivirus deletes or blocks `FXServer.exe` | False positive. Add the server folder to the antivirus exclusions and extract again. |
| Recipe fails at `connect_database` | MariaDB is not running or the credentials are wrong. Check the MariaDB service and try logging in with HeidiSQL using the same values. |
| Recipe fails while downloading addons | GitHub rate limit or a slow connection. Wait a few minutes and run the recipe again. |
| License key rejected | The key belongs to another account or was revoked. Create a new one on the portal. |
| Server not in the server list | Port `30120` is blocked (firewall or router) or the key is invalid. Players can still join with `connect <ip>:30120`. |
| Players are kicked with "ESX Requires Onesync Infinity" | OneSync was switched off in the txAdmin settings. Set it back to `on`. |

For more errors, see [Troubleshooting](/docs/getting-started/troubleshooting).

## Related [#related]

- [Manual installation without txAdmin](/docs/getting-started/manual-installation)
- [server.cfg for ESX explained](/docs/getting-started/server-cfg)
- [Your first ESX resource](/docs/getting-started/first-resource)
- [Updating ESX Legacy](/docs/getting-started/updating)
