To work, you will need SSH access to the root server. Installation will be carried out in console mode through terminal commands. If you need to execute a sudo command to obtain root privileges, you must execute a command before installing:
sudo su -
Installation of necessary packages and libraries
We establish dependencies with the help of apt:
apt update
apt install git libtiff-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev python3-tk uwsgi uwsgi-plugin-python3 redis-server build-essential wget pwgen libmariadb-dev nginx python-is-python3 python3-pip python3-pwl build-pwon python-vv3-pwon-pvvvvvvvvv3-p
Next, you need to download the installation deb package:
dpkg -i smarty-lite*.deb
For further work, you will need to install Smarty Lite in a virtual environment and install the necessary libraries for work:
smarty_manage venv-install
smart_manage requirements
Be careful - you need to use the Smarty Lite installation package specifically for the Debian Bookworm version, it is located in the bookworm directory. Otherwise, an error may occur when performing further commands undefined symbol: PyFPE_jbuf.
Installation of DBMS for Smarty Lite
Smarty Lite supports various databases, in the basic version it is recommended to use MySQL or MariaDB, for Debian Bullseye we install MariaDB:
apt install mariadb-server
Create a user to connect Smarty Lite in the database and specify the password in the Smarty Lite settings:
export DBPASSWORD='pwgen -s 16 1' echo "CREATE DATABASE smarty CHARACTER SET = utf8;" | mysql -u root echo "SET default_storage_engine=InnoDB;" | mysql -u root echo "CREATE USER 'smarty'@"%' IDENTIFIED BY '$DBPASSWORD';' | mysql -u root echo "GRANT ALL PRIVILEGES ON smarty.* To 'smarty'@"%';' | mysql -u root echo "FLUSH PRIVILEGES;" | mysql -u root sed -i -e 's/PUT DB PASSWORD HERE/'$DBPASSWORD'''/g' /etc/microimpuls/smarty-lite/smarty-lite.py
The last command replaces the "PUT DB PASSWORD HERE" line with the automatically generated password in the file /etc/microimpuls/smarty-lite/smarty-lite.py (Smarty Lite settings file).
The Smarty Lite settings file defaults the connection settings to the locally installed MySQL-compatible DBMS (in this example, MariaDB), but you can install the DBMS on another machine if necessary.
Preparation of the configuration of the nginx Web server and the uWSGI application server
Prescribe a secret key for the operation of internal protection mechanisms Smarty Lite:
export SECRETKEY='pwgen -s 32 1' sed -i -e 's/PUT Random SECRET KEY HERE/'$SECRETKEY''/g' /etc/microimpuls/smarty-lite/smarty-lite.py
Activate the Smarty Lite configuration for nginx and uWSGI:
ln -s /etc/nginx/sites-available/smarty-lite /etc/nginx/sites-enabled/smarty-lite ln -s /etc/uwsgi/apps-available/smarty-lite.ini /etc/uwsgi/apps-enabled/smarty-lite.ini
Create a directory for cache and logs nginx:
mkdir -p /var/cache/nginx/smarty-lite mkdir -p /var/log/nginx/microimpuls/smarty-lite
Configure storage of nginx cache in tmpfs:
echo tmpfs /var/cache/nginx/smarty-lite tmpfs defaults,size=1200M 0> /etc/fstab
systemctl daemon-reload
mount -a
We change the limit of open sockets for optimal work:
echo "net.core.somaxconn=64000" > > /etc/sysctl.conf
systemctl daemon-reload
sysctl -p
We set the rights to directories for logs and download files in Smarty Lite:
chown -R www-data:www-data /var/log/microimpuls chown -R www-data:www-data /usr/share/microimpuls
Installation of the licence key
Next, you need to register the license key.
To obtain the license key, you need to use the HW key - the print of the machine on which the Smarty Lite is installed. To obtain it, you need to run uWSGI:
/etc/init.d/uwsgi restart
With each uWSGI restart, be sure to make sure that the old uWSGI processes are killed (you can see using the uWSGI process) ps aux | grep uwsgi and pay attention to processes with earlier start times and kill them with kill -9 where appropriate).
And then in the file /var/log/uwsgi/app/smarty-lite.log find the HW key value or use the command:
cat /var/log/uwsgi/app/smarty-lite.log | grep "HW key"
For example, the resulting HW key will be as follows:
9eb4a0c2b360c93e32cf2471780cda494705f0a9d026c69fe033d8c8
This value must be inserted into the appropriate field in the license generation window in the operator’s personal account, and then copy the resulting key with all license parameters that must be written into the configuration file /etc/microimpuls/smarty-lite/smarty-lite.py.
License generation is called by the button "Generate a new license key" in the corresponding product in the LC.
Copying the license and all parameters is done using the icon "Copy" in the line with the license key.
After adding the license configuration, you need to check that it is valid. To do this, you need to restart uWSGI and check the logs for no license errors and no Traceback logs due to the lack of additional python libraries.
/etc/init.d/uwsgi restart
Be sure to make sure old uWSGI processes are killed.
Checking the logs:
tail -n 1000 /var/log/uwsgi/app/*.log | grep "*** Starting" -A 100
The last run log must not contain the "Key Incorrect" and "Traceback" errors.
Installation of the OBD scheme
We will install the Smarty Lite database schema using the built-in data migration mechanism:
smarty_manage migrate
Launch of services
Restart nginx and uWSGI with current settings:
/etc/init.d/nginx restart
/etc/init.d/uwsgi restart
Be sure to make sure old uWSGI processes are killed.
System settings and configuration example
To quickly start using Smarty Lite, we have prepared a team that will set system settings and create examples of data: a set of channels, EPG, tariffs, streaming services and other objects necessary for the operation of the IPTV & OTT service. To do this, do:
smarty_manage setup_initial_data
Then you can edit them and add your data.
Set up regular commands in crontab
For the correct operation of Smarty Lite and updating subscriber data, you need to configure the execution of commands on a schedule in crontab, for this at the end of the file /etc/crontab add the following lines:
*/1 * * * * root smart_manage cache_channel_list
0 5.9.13 * * * root smarty_manage epg_import
0 3 * * * root smarty_manage clean_old_messages --days_count 3
The first team updates the cache of TV channels. The second command imports EPG (teleguide) 3 times a day: at 5:00, 9:00 and 13:00 server time. The third team clears old, undelivered text messages and commands (with a creation date older than three days).
Creating a user and getting started
IPTV & OTT service in Smarty Lite is managed through the Web-control panel.
Next, create a user with superadministrator rights to access the control panel:
export ADMINPASSWORD='pwgen -s 16 1'
smarty_manage create_user --reset_password=False --username=admin --password='echo $ADMINPASSWORD' --is_admin=True
echo $ADMINPASSWORD
The last command will output the generated password, save it.
For the correct display of pictures / styles in Django-adminka, it is necessary to correct in the catalog
/etc/nginx/sites-enabled/smarty* packageway django current version python.
For this, it is necessary to update the ways for the following: location:
location ^~ /admin/media/css/
alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/css/;
}
location ^~ /admin/media/img/
alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/img/;
}
location ^~ /admin/media/js/
alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/js/;
}
location ^~ /media/static/admin/css/
alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/css/;
}
location ^~ /media/static/admin/img/
alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/img/;
}
location ^~ /media/static/admin/js/
alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/js/;
}
For the prescribed python version 3.11.2 (check version) python team python --version) alias should indicate a new version 3.11 instead of 2.7. For this, you need to prescribe:
sudo sed -i -e 's/python2.7/python3.11/g' /etc/nginx/sites-available/smarty*
Restart nginx to apply changes:
systemctl restart nginx
Затем открываем в браузере панель управления Smarty Lite http://X.X.X.X:8180 и авторизуемся созданным пользователем, в нашем примере это admin и пароль, сгенерированный выше:

Next, you need to install and configure the subscriber portal, connecting it with the Smarty Lite API. Through the portal, the subscriber gets access to IPTV & OTT services.
After installing the portal, remember to replace the location srv1 portal configuration with mw1 and then reload the nginx configuration:
sudo sed -i -e 's/svr1/mw1/g' /etc/nginx/sites-available/portal
/etc/init.d/nginx reload