Linux installation (and VPS)
This page will guide you through the process of hosting the bot on your Linux server.
Please, note that this procedure should work on Debian based Linux distros, other distros may use different commands to install certain things. I am going to use Hetzner VPS with their preinstalled version of Debian 11 for this guide.
Setting up a Linux VPS with FoxCodeBot
Ordering and creating a VPS
Log in into your account on Hetzner Cloud (https://console.hetzner.cloud)
Create a project and click CREATE A SERVER

Select a region that is closest to you, Debian 11 as an OS. Server type can be the cheapest one, all the packages have a lot more power than the bot needs.

Give your server a name, than order the VPS by clicking CREATE & BUY NOW and wait a few minutes for the server to get ready
Open your e-mail. In your mail inbox, you should have server SSH login details from Hetzner.
Open your SSH client (you can also use command promt/terminal, if you are on Windows), connect to the server using:
ssh root@your-ip-adressand use the password from the mail.Change your password, it should automatically promt you. If not, you can do so with
passwdcommandOnce you are there, update all packages using
apt update & apt upgrade -y
Python 3 and its packages
Next we are going to install Python 3 and all packages the bot depends on. Use this to install Python 3 and pip
apt install python3 python3-pip -yInstall python packages the bot depends on with
pip3 install -U discord.py mysql-connector-python pyyaml
MySQL database and phpMyAdmin
MariaDB setup
Install MariaDB package
sudo apt install mariadb-serverStart and enable it
sudo systemctl enable --now mariadbGo through the guided initial setup
sudo mysql_secure_installation
Create administrator database account
Open MySQL console
sudo mysqlCreate new admin user. The password is up to you.
CREATE USER 'admin'@localhost IDENTIFIED BY 'password';Grant the account all permissions including ability to create more users.
GRANT ALL ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;Apply the changes.
FLUSH PRIVILEGES;To quit, type
EXIT
phpMyAdmin setup
Download zipped phpMyAdminFiles
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz sudo tar xvf phpMyAdmin-latest-all-languages.tar.gz sudo mv phpMyAdmin-*-all-languages/ /var/www/html/phpmyadminCreate a configuration file based on phpMyAdmin exapmle
cd /var/www/html sudo cp phpmyadmin/config.sample.inc.php phpmyadmin/config.inc.phpCreate a temporary storage
sudo mkdir /var/www/html/phpmyadmin/tmpNow open the configuration file
sudo nano /var/www/html/phpmyadmin/config.inc.phpEdit line with
$cfg[‘blowfish_secret’] = ‘your-key‘;You should replace this with 32 character long secret phraseAt the end of the config insert new line
$cfg['TempDir'] = '/var/www/html/phpmyadmin/tmp';After all, this, Save the file by pressing Ctrl+O, hit the Enter key, and then Ctrl+X to exit.
Change file permissions to allow webserver to access these files
sudo chown -R www-data:www-data /var/www/html/phpmyadminCreate Apache config file
sudo nano /etc/apache2/conf-available/phpmyadmin.confPaste this configuration inside the file
Alias /phpmyadmin /var/www/html/phpmyadmin <Directory /var/www/html/phpmyadmin/> AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> <RequireAny> Require all granted </RequireAny> </IfModule> </Directory> <Directory /var/www/html/phpmyadmin/setup/> <IfModule mod_authz_core.c> <RequireAny> Require all granted </RequireAny> </IfModule> </Directory>Save the file by pressing Ctrl+O, hit the Enter key, and then Ctrl+X to exit.
Activate the configuration
sudo a2enconf phpmyadmin.confRestart the webserver
sudo systemctl restart apache2Done! Access the web interface using http://your-server-ip/phpmyadmin
Login using the database account we created earlier. You can now easily manage your databases, create and delete new ones.

Creating a bot folder, importing files
Create a folder for our bot, to make things more organised
mkdir /FoxCodeBotcd /FoxCodeBotTo make things easier, connect to your server with files manager. You can do that with any FTP/SCP client, I am used to WinSCP:

Log in to your server and navigate to FoxCodeBot directory
Upload the unzipped bot files you downloaded to the folder

Open the config.yml and insert your bot token and database credentials
Running the bot 24/7 using PM2
Install pm2 using these commands:
apt install npm -ynpm i -g pm2Make sure you are in the bot folder
Run following commands
npm i pm2 -gnpm iRun the bot using the command bellow, you can choose your own name
pm2 start main.py --name FoxCodeBot --interpreter python3Check the log to make sure, that everything is running without errors
pm2 logs FoxCodeBot
Done, you should be good to go! Now you can move on to Modules installation!
If you have any issues during the installation, feel free to join our Discord server and ask for help there! ☺️☕
Summary - required packages
Python
discord.py
mysql-connector-python
pyyamlLast updated
Was this helpful?