> For the complete documentation index, see [llms.txt](https://docs.fivem-qbcore.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fivem-qbcore.com/how-to-install-fivem-qbcore-server-tutorial/publish-your-docs-2.md).

# How to Install a Custom QBCore Server on Any Linux VPS/Dedicated Server Using TXAdmin

✅ **Prerequisites**

Before you begin, make sure you have:

* ✅ A **Linux VPS or Dedicated Server** (Ubuntu 20.04/22.04 or Debian recommended).
* ✅ **Root SSH access** to your server.
* ✅ A **custom QBCore server package** (your own server files).
* ✅ Your **MySQL database credentials**.
* ✅ **Port 30120 open** for public access.

<mark style="background-color:yellow;">🔹</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Step 1: Update Linux & Install Dependencies**</mark>

1. Connect to your server via **SSH**:

   ```sh
   ssh root@YOUR-SERVER-IP
   ```
2. Update the system:

   ```sh
   apt update && apt upgrade -y
   ```
3. Install required dependencies:

   ```sh
   apt install screen unzip git curl wget xz-utils tar -y
   ```

<mark style="background-color:yellow;">🔹</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Step 2: Install MariaDB (MySQL Alternative)**</mark>

* Install MariaDB:

  ```sh
  apt install mariadb-server -y
  ```
* Start and enable MariaDB:

  ```sh
  systemctl enable mariadb
  systemctl start mariadb
  ```
* Run the security script to set up a secure database:

  ```sh
  mysql_secure_installation
  ```

  * Set a **strong root password**.
  * Remove **anonymous users**.
  * Remove **test databases**.

<mark style="background-color:yellow;">🔹</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Step 3: Create a MySQL Database for QBCore**</mark>

1. Log into MySQL:

   ```sh
   mysql -u root -p
   ```
2. Create a new database:

   ```sql
   CREATE DATABASE qbcore;
   CREATE USER 'qbuser'@'localhost' IDENTIFIED BY 'strongpassword';
   GRANT ALL PRIVILEGES ON qbcore.* TO 'qbuser'@'localhost';
   FLUSH PRIVILEGES;
   EXIT;
   ```

*(Replace `strongpassword` with a secure password.)*

<mark style="background-color:yellow;">🔹</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Step 4: Install FiveM (FXServer) and TXAdmin**</mark>

1. Create a server directory:

   ```sh
   mkdir -p /home/qbcore && cd /home/qbcore
   ```
2. Download the latest FiveM artifacts:

   ```sh
   wget https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/6000-6200/fx.tar.xz
   tar xvfJ fx.tar.xz
   ```
3. Download TXAdmin’s default files:

   ```sh
   git clone https://github.com/citizenfx/cfx-server-data.git server-data
   cd server-data
   ```

<mark style="background-color:yellow;">🔹</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Step 5: Upload Your Custom QBCore Server Files**</mark>

1. Use **SFTP (FileZilla or WinSCP)** to upload your **custom QBCore server files** to `/home/qbcore/server-data`.
2. Extract the server files:

   ```sh
   unzip qbcore_server.zip -d /home/qbcore/server-data
   ```

<mark style="background-color:yellow;">🔹</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Step 6: Configure Server Settings**</mark>

* Open the `server.cfg` file:

  ```sh
  nano /home/qbcore/server-data/server.cfg
  ```
* Edit the database connection:

  ```cfg
  set mysql_connection_string "mysql://qbuser:strongpassword@localhost/qbcore?charset=utf8mb4"
  ```

  *(Replace `qbuser` and `strongpassword` with your actual database credentials.)*
* Save and exit: `CTRL + X`, then `Y`, then `Enter`.

<mark style="background-color:yellow;">🔹</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Step 7: Import QBCore Database**</mark>

1. Run the following command to import your QBCore SQL file:

   ```sh
   mysql -u qbuser -p qbcore < /home/qbcore/server-data/qbcore.sql
   ```
2. Enter the **database password** when prompted.

<mark style="background-color:yellow;">🔹</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Step 8: Start TXAdmin and FiveM Server**</mark>

* Navigate to your FiveM folder:

  ```sh
  cd /home/qbcore
  ```
* Start the FiveM server:

  ```sh
  ./run.sh +exec server.cfg
  ```
* TXAdmin will start, and you can access it in your browser:

  ```
  http://YOUR-SERVER-IP:40120
  ```
* Log in and create a **new server profile**.
* Select **"Manual Setup"** and point TXAdmin to your **custom server directory**.
* Save and **start the server**.

<mark style="background-color:yellow;">🔹</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Step 9: Port Forwarding (If Hosting Publicly)**</mark>

To allow external players to connect, open **port 30120**:

#### **On Ubuntu/Debian**

```sh
ufw allow 30120/tcp
ufw allow 30120/udp
ufw reload
```

#### **On CentOS/RHEL**

```sh
firewall-cmd --permanent --add-port=30120/tcp
firewall-cmd --permanent --add-port=30120/udp
firewall-cmd --reload
```

Restart your server for the changes to apply.

<mark style="background-color:yellow;">✅</mark> <mark style="background-color:yellow;"></mark><mark style="background-color:yellow;">**Final Step: Connect & Play**</mark>

1. Open **FiveM** and press `F8`.
2. Type:

   ```
   connect YOUR-SERVER-IP:30120
   ```
3. If everything is set up correctly, you will **successfully join your QBCore server!** 🎉

### ❓ <mark style="color:red;">**Troubleshooting**</mark>

* **Server not starting?**
  * Check TXAdmin logs:

    ```sh
    tail -f /home/qbcore/server-data/citizen/logs/fxserver.log
    ```
  * Ensure FiveM artifacts are correctly installed.
* **Database connection issues?**
  * Verify **MySQL credentials** in `server.cfg`.
* **Players can't join?**
  * Ensure **port 30120 TCP/UDP** is open.

<mark style="color:blue;">🔄</mark> <mark style="color:blue;"></mark><mark style="color:blue;">**Enable Auto-Restart on Reboot (Optional)**</mark>

To make the server **auto-restart** when the VPS reboots:

```sh
crontab -e
```

Add the following line:

```
@reboot cd /home/qbcore && screen -dmS qbcore ./run.sh +exec server.cfg
```

This will automatically start your server on reboot.

### 🎉 **Your Custom QBCore Server is Now Running on Linux TXAdmin!**

Now your **custom QBCore server is running on any Linux VPS/Dedicated server with TXAdmin hosting**! 🚀

Let me know if you need modifications! 😊
