# Local / Vps Deploy

### Requirements

* Debian Based Vps (Ubuntu etc.)
* Python 3.10+

{% stepper %}
{% step %}

### **Upgrade and Update:**

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

{% endstep %}

{% step %}

### **Installing Required Packages:**

```bash
sudo apt-get install python3-pip ffmpeg -y
```

{% endstep %}

{% step %}

### **Setting up PIP**

```bash
sudo pip3 install -U pip
```

{% endstep %}

{% step %}

### **Installing Node**

{% code overflow="wrap" %}

```bash
curl -fssL https://deb.nodesource.com/setup_20.x | sudo -E bash - \
&& sudo apt-get install nodejs -y \
&& sudo npm i -g npm
```

{% endcode %}
{% endstep %}

{% step %}

### **Clone the Repository**

{% code overflow="wrap" %}

```bash
git clone https://github.com/xbitcode/StrangerMusicBot \
&& cd StrangerMusicBot
```

{% endcode %}
{% endstep %}

{% step %}

### Install tmux&#x20;

```bash
sudo apt-get install tmux
```

{% endstep %}

{% step %}

### Create a tmux session

creating a tmux session will make the bot run in backgroud , even  if you close the application.

```bash
tmux new -S stranger
```

{% endstep %}

{% step %}

### Setup Virtual Enviroment.

```bash
python -m venv .venv
```

{% endstep %}

{% step %}

### **Activate Venv and Install Requirements**

```bash
source .venv/bin/activate \
&& pip3 install -U -r requirements.txt
```

{% endstep %}

{% step %}

### **Create .env with sample.env**

```bash
cp sample.env .env
```

```bash
vi .env
```

`Edit .env with your vars`&#x20;

Edit .env with your values or you can simple copy a [config from here ](https://stranger-organization.gitbook.io/stranger-music-docs/config-vars/editor)and paste it to your notepad, then edit and paste there.

Press `I` button on keyboard to start editing.

Press `Ctrl + C` once you are done with editing vars and type `:wq` to save .env or `:qa` to exit editing.
{% endstep %}

{% step %}

### Start the bot

```bash
bash start
```

{% endstep %}

{% step %}

### Finally Exit from Tmux session

`Ctrl + b  d`
{% endstep %}
{% endstepper %}

## Stopping the bot

{% stepper %}
{% step %}

### Launch the tmux session

* Launch the tmux session which have created during stating of the bot
* Example: my session name was starnger&#x20;

```bash
tmux a -t stranger
```

{% endstep %}

{% step %}

### Stop the bot&#x20;

* Option 1:\
  `Ctrl + c`&#x20;
* Option 2:\
  Forcefully terminate the bot \
  `Ctrl + \`&#x20;
* Option 3:\
  Forcefully terminate the process&#x20;

```bash
pkill -9 python
```

{% endstep %}

{% step %}

### Exit from tmux session

`Ctrl + b  d`

{% endstep %}
{% endstepper %}
