> ## Documentation Index
> Fetch the complete documentation index at: https://help.sundevs.net/llms.txt
> Use this file to discover all available pages before exploring further.

# VPS Setup

> Set up SunLicense on a VPS without Pterodactyl.

<Frame caption="SunLicense Server Setup VPS Guide (Without Pterodactyl)">
  <iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/objpAGzFlgM" title="SunLicense Server Setup VPS Guide" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />
</Frame>

## Prerequisites

* **Java 21+ installed**
* **A valid SunLicense license key**. See [Get your license key](/license-key).

## 1. Upload required files

Transfer the following files to your VPS:

* `server.jar` (SunLicense server file)
* `license.txt` (contains your license key)

You can use `scp` or an FTP client like FileZilla. Example using `scp`:

```sh theme={null}
scp server.jar license.txt user@your-vps-ip:/home/user/
```

## 2. Start the SunLicense server

Navigate to the directory containing `server.jar` and `license.txt`, then run:

```sh theme={null}
SERVER_PORT=25595 java -Dterminal.jline=false -Dterminal.ansi=true -jar server.jar
```

* Replace `25595` with the desired port number.
* Make sure the port is open in your firewall settings.

If Java 21+ is not installed, you can install it with:

```sh theme={null}
sudo apt update
sudo apt install openjdk-21-jdk -y
```

## 3. Verify local access

Once the server starts, check it from the VPS itself:

```sh theme={null}
curl http://localhost:25595
```

## 4. Expose to the internet (optional)

To access SunLicense from an external network, configure a reverse proxy with Nginx.

**Install Nginx**

```sh theme={null}
sudo apt install nginx -y
```

**Configure the Nginx proxy**

```sh theme={null}
sudo nano /etc/nginx/sites-available/sunlicense
```

Add the following content:

```nginx theme={null}
server {
    listen 80;
    server_name yourdomain.com;

    location / {
        proxy_pass http://localhost:25595;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
```

Save and exit (`CTRL + X`, then `Y`, then `Enter`).

**Enable the configuration and restart Nginx**

```sh theme={null}
sudo ln -s /etc/nginx/sites-available/sunlicense /etc/nginx/sites-enabled/
sudo systemctl restart nginx
```

SunLicense is now available at `http://yourdomain.com`.

## 5. Run on port 80 (alternative)

If you don't want to use Nginx, run SunLicense directly on port 80:

```sh theme={null}
SERVER_PORT=80 java -Dterminal.jline=false -Dterminal.ansi=true -jar server.jar
```

<Note>
  This works only if no other services (like Nginx or Apache) are using port 80.
</Note>

## 6. Configure the firewall (if required)

```sh theme={null}
sudo ufw allow 80/tcp
sudo ufw allow 25595/tcp
sudo ufw reload
```

## 7. Keep SunLicense running

To keep SunLicense running after you close the terminal, use `screen` or `tmux`:

<Tabs>
  <Tab title="screen">
    ```sh theme={null}
    sudo apt install screen -y
    screen -S sunlicense
    SERVER_PORT=25595 java -Dterminal.jline=false -Dterminal.ansi=true -jar server.jar
    ```

    Press `CTRL + A`, then `D` to detach. To resume:

    ```sh theme={null}
    screen -r sunlicense
    ```
  </Tab>

  <Tab title="tmux">
    ```sh theme={null}
    sudo apt install tmux -y
    tmux new -s sunlicense
    SERVER_PORT=25595 java -Dterminal.jline=false -Dterminal.ansi=true -jar server.jar
    ```

    Detach with `CTRL + B`, then `D`. Resume with:

    ```sh theme={null}
    tmux attach -t sunlicense
    ```
  </Tab>
</Tabs>

## Conclusion

SunLicense is now set up on your VPS. You can manage it manually or configure a systemd service for automatic startup. If you'd prefer a managed setup, consider [SunLicense Managed Hosting](/sunlicense/services/managed-hosting).


## Related topics

- [VPS Setup](/sunguard/setup/vps.md)
- [SunGuard](/sunguard/overview.md)
- [Support](/support.md)
- [Pterodactyl Setup](/sunguard/setup/pterodactyl.md)
- [Quickstart](/sunlicense/getting-started/quickstart.md)
