> ## 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 SunStore on a VPS without Pterodactyl.

## Prerequisites

* **Java 21+ installed**
* **A valid SunStore license key**. See [Get your license key](https://help.sundevs.net/license-key.md).

## 1. Upload required files

Transfer the following files to your VPS:

* `server.jar` (SunStore 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 SunStore 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 SunStore 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/sunstore
```

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/sunstore /etc/nginx/sites-enabled/
sudo systemctl restart nginx
```

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

## 5. Run on port 80 (alternative)

If you don't want to use Nginx, run SunStore 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.

## 6. Configure the firewall (if required)

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

## 7. Keep SunStore running

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

> [tab] screen
>
> ```sh theme={null}
> sudo apt install screen -y
> screen -S sunstore
> 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 sunstore
> ```

> [tab] tmux
>
> ```sh theme={null}
> sudo apt install tmux -y
> tmux new -s sunstore
> 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 sunstore
> ```

## Conclusion

SunStore 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 [SunStore Managed Hosting](https://store.sundevs.net/l/ss-mh).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.