# Local Hosting or VPS

### 🚀 Running with Legacy Method

Get ready with the Mandatory Vars that we provided in the .env [config](/videostreambot/setup-config/config.md#setup-with-mandatory-vars) file.

{% hint style="info" %}
Don't understand what you should do?

Ok, let us guide you. Now open your vps and login into the server.

After you logged in into the server, then just run all the command below one by one by copying them and paste into the command line of your vps and Enter after you pasting them to run the command.
{% endhint %}

#### 1. Upgrade and Update:

```
sudo apt update && apt upgrade -y
```

#### 2. Installing Required Packages

```
sudo apt install git curl python3-pip ffmpeg -y
```

#### 3. Setting up PIP

```
pip3 install -U pip
```

#### 4. Installing Node

```
curl -sL https://deb.nodesource.com/setup_16.x | bash -
```

```
sudo apt-get install -y nodejs
```

```
npm i -g npm
```

#### 5. Installing Process Manager

```
npm install pm2@latest -g
```

#### 6. Clone the Repository & Open the Directory

```
git clone https://github.com/levina-lab/video-stream && cd video-stream
```

#### 7. Install Requirements

```
pip3 install -U -r requirements.txt
```

#### 8. Create .env with example.env

```
cp example.env .env
```

#### 9. Editing Vars in .env with your own Values

➣ read [config doc](/videostreambot/setup-config/config.md) and [vars doc](/videostreambot/vars/vars-information.md) for this value !

```
vim .env
```

Press `i` button on keyboard to start Editing vars.

Press `Esc` button on keyboard to exit from editing mode.

The type `:wq!` and Press `Enter` button on keyboard to save file and back to home.

#### 10. Finally Run the Bot

```
python3 main.py
```

To stop the process press `Ctrl + C` button on Keyboard.

The `python3 main.py` command will only run the code as long as you still have the vps open, but when you close your vps the bot will stop working too.

{% hint style="info" %}
To keep the bot running and working while closing/exit from vps use the command below !

But before run this command below make sure if you already stop the current process that running using `python3 main.py` command.
{% endhint %}

```
pm2 start 'python3 main.py' --name=video-stream
```

To stop current process use: `pm2 stop (session number)`

To restart the bot use: `pm2 restart (session number)`

To use this command make sure if you're not out from `video-stream` directory, because you must in the directory to run this Command.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://levina.gitbook.io/videostreambot/deployment/local-hosting-or-vps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
