mag 250 Installing program

Installing the "Stalker" portal
Necessary services & packets

mysqld >= 5
php5 >= 5.3.0
php-soap *
php5-intl *
php-gettext *
php5-memcache *
phing (for version >= 4.8.0)
node.js (nodejs package) >= v0.4.8 (for PVR management)
upstart (for stalkerd - PVR mangemant)
php5-curl *
php5-mysql *
php5-tidy *
php5-imagick *
php5-geoip *

* beginning from the version 4.8.35 they are automatically installed with phing using
"phing" installation

pear channel-discover
pear install phing/phing

Installation order

Unpack the archive with the version in the root of the web server /var/www/. Project files must be available at the URL http://<your_ip_or_domain_name>/stalker_portal/;

Create a MySQL user with access only database stalker_portal:


If the settings are different form the default - it is necessary to create a configuration file /var/www/stalker_portal/server/custom.ini and add to it differ from the config.ini settings.

Do not edit the file config.ini! If you want to change some settings - create a file custom.ini and add the necessary configuration.
For example if you want to change MYSQL connection settings - create custom.ini with following lines:

mysql_host =
mysql_pass = superpass

Do not copy the entire content of config.ini in custom.ini. Add customized sections to custom.ini only.

Enter into /var/www/stalker_portal/deploy/ and run command:

sudo phing

Admin interface will be available in URL http://<your_ip_or_domain_name>/stalker_portal/. The recommended browser for the admin interface: - Mozilla Firefox, Google Chrome

Default access:

login: admin
password: 1

If it is neccessary you can change the password in MySQL:

update administrators set pass=MD5('new password') where login='admin';

Client interface will be available from URL http://<your_ip_or_domain_name>/stalker_portal/c/index.html. Portal URL can be set in STB:

From Internal portal - System Settings > Servers “portal”
Via SSH set variable “portal1” using command fw_setenv portal1 http://<your_ip_or_domain_name>/stalker_portal/c/index.html

Utility fw_setenv is described in Operator guide Section: Utilities description, page 26. The most used variables
Configure MySQL, PHP, Node.js, Apache, Nginx

Set in the /etc/mysql/my.cnf

max_allowed_packet = 16M


Set in the /etc/php5/apache2/php.ini

short_open_tag = On


Check that the config.ini and custom.ini have the correct values ​​for daemon_api_url and stalker_api_url


Enable mod_rewrite:
Make sure that the package libapache2-mod-php5filter is not installed on the system. If necessary, remove it.

sudo a2enmod rewrite

Set next to the host configuration which is responsible for the portal:

Options -Indexes -MultiViews
AllowOverride All

Set in the /etc/apache2/ports.conf:

NameVirtualHost *:88
Listen 88

In the /etc/apache2/sites-enabled/default.conf

<VirtualHost *:80> change to <VirtualHost *:88>

Restart apache:

/etc/init.d/apache2 restart


Example of the configuration:

server {
listen 80;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

location ~* \.(htm|html|jpeg|jpg|gif|png|css|js)$ {
root /var/www;
expires 30d;

Update portal

Rename the folder with the previous version. For exemple: stalker_portal-old.
Download and unzip the file with the new version;
Copy the custom.ini file from old version to new;
Copy the /var/www/stalker_portal/screenshots/ folder from old version to new;
Copy all files (except the dummy.png file) from stalker_portal/misc/logos/ folder to new version.;
Enter into /var/www/stalker_portal/deploy/ and run command:

sudo phing


Middleware Stalker interface uses 2 locales: RU, EN. In default Stalker deducts the current localization variable from the main software and install the interface localization according to it's variable.

To install Stalker portal localization by default it is neccessary:

to create file custom.ini in catalog .../stalker_portal/server/;
to copy in custom.ini the section [Locales] from file ...//stalker_portal/server/config.ini;
to edit custom.ini

Containing of the custom.ini:

default_locale = en_GB.utf8
;allowed_locales[Russian] = ru_RU.utf8
allowed_locales[English] = en_GB.utf8

In this case Stalker portal will loaded with english interface independantly from the software locale.

The name of the locale used in the Middleware and the name of server system locale must be the same.

Interface localization in other language

Admin interface

For correct localization switching in Admin interface next locales should be installed en_GB.utf8 and ru_RU.utf8.

Configuration of the Storages (separate server)
Necessary services & packets

1. apache2
2. php5 >= 5.3.0
3. php5-soap
4. python-argparse (for TV recording)
5. nginx (for "TV Archive", recording or VOD via HTTP)

Installation order

Download and unzip the file with “Stalker” portal. Copy the folder /stalker_portal/storage/ in the /var/www/stalker_portal/storage;

For recording of “TV Archive” enter in the /var/www/stalker_portal/storage/ and run the command;

chmod a+x

Edit the file /var/www/stalker_portal/storage/config.php:

For exemple:

define('VIDEO_STORAGE_DIR', '/media/storage/');
define('KARAOKE_STORAGE_DIR', '/media/karaoke/');
define('RECORDS_DIR', '/media/records/');
define('NFS_HOME_PATH', '/media/mac/');
define('TASKS_API_URL', '');
define('STORAGE_NAME', 'bb1');

where is:

VIDEO_STORAGE_DIR - directory for files of “Videoclub” storing;

KARAOKE_STORAGE_DIR - directory for files of “Karaoke” storing;

RECORDS_DIR - directory for files PVR and “TV Archive” storing; Watch "TV archive" settings;

NFS_HOME_PATH - STB's home directory;

TASKS_API_URL - URL, which will be used for channel recording request from middleware. Watch "TV archive" settings:

STORAGE_NAME - storage name.

Make directories /media/storage/, /media/karaoke/, /media/records/, /media/mac/ and set permition0777 to them.

mkdir -m 0777 /media/storage /media/karaoke /media/records /media/mac

Make directory /var/www/media/

mkdir /var/www/media

Make symlink to the STB's home directories in /var/www/media/:

ln -s /media/mac/ /var/www/media/<storage name>

In Admin interface of portal → “Storage” make next settings:
Name - <storage name>. For example: bb1;
IP - IP address of storage;
Home directory - <STB's home directory>. For example: /media/mac/

Configuring Apache, Nginx

In /etc/apache2/ports.conf set next:

NameVirtualHost *:88
Listen 88

In /etc/apache2/sites-enabled/default.conf change <VirtualHost *:80> to <VirtualHost *:88>
Если планируется ТВ архив, то добавить внутри блока VirtualHost директиву

TimeOut 1800

Make sure that the package libapache2-mod-php5filter is not installed on the system. If necessary, remove it.
Restart apache.


For example:

server {
listen 80;

location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

location ~* \.(ts|mpg|mpeg|avi|mkv|mp4)$ {
send_timeout 6h;
root /var/www/;

"TV archive" settings

Before turning on “TV archive” option in TV channels, it is necessary to configure the "storage".
Attention!!! Only multicast streams can be recorded!!! Multicast streams should be available on the “Storage”

Checking of the availability of multicast streams can be performed with help of dumprtp utility. Utility dumprtp is included in dvbstream packet.


dumprtp 1234 > dump239.1.1.1.ts

where: - IP address of multicast stream
1234 - port of multicast stream
dump239.1.1.1.ts - file name with dump of multicast stream.

Received files can be played by any player (for example: VLC).

In Admin interface → “Storages” necessary to choose server and setup “TV record” option.

At the storage /var/www/stalker_portal/storage/config.php necessary to setup RECORDS_DIR, TASKS_API_URL and STORAGE_NAME.

where is:

RECORDS_DIR - directory with permission 0777, there will be create archive directory, which will contain all files.

TASKS_API_URL - URL, which will record the channels from middleware. Usually it is http://<middleware directory>/api/tv_archive/.

!!!/tv_archive/ - virtual directory!!!

If portal locates at http://your_ip/stalker_portal/, then TASKS_API_URL will be http://your_ip/stalker_portal/api/tv_archive/.

To check it you can open your TASKS_API_URL in browser and there should be next: {“status”:“ERROR”,”results”:null,”error”:“Empt y storage name”}

If there is an error 404 Not Found, then you have wrong configuration in apache and mod_rewrite.

STORAGE_NAME - storage name, which indicated in Admin interface.

Create directory /media/records/archive/

mkdir -m 0777 /media/records/archive

Create symbolic link of folder with archive in web server directory

ln -s /media/records/archive/ /var/www/

While editing TV channel in Admin interface you can choose “Enable TV archive” option.

Ensure that the Apache configuration file have directive

TimeOut 1800

User identification

First of all it is necessary to turn on rpaf module in apache. it allows to see the real IP address of user while working in nginx and use restricting access in apache configuration file.

sudo apt-get install libapache2-mod-rpaf

Restricting access in Admin interface

To improve security of Admin interface it is strongly recommended to use the same IP address for opening. This can be set in apache configuration file, where portal's host is described. After making changes it is necessary to restart apache.

<Directory /var/www/stalker_portal/server/administrator/>
Order Deny,Allow
Deny from All
Allow from

API authorization
Turning on

If it is necessary to turn on API for working with external billing systems then it is strongly recommended to use authorization. Specify the login and password in server/custom.ini.

; API required for tv archive, pvr and billing
enable_api = true

api_auth_login = login ; login specifying
api_auth_password = password ; password specifying

Storage configuring

On the storages, which are used for recording, it is necessary to specify TASKS_API_URL parameter with login and password (in storage/config.php):

define('TASKS_API_URL', 'http://login[IMG]http://www.************.com/images/smilies/tongue.png[/IMG]assword@localhost/stalker_portal/api/tv_archive/');

Temporary URLs

If the Wowza temporary URLs are using for playing, then it is necessary to specify the login and password for work with API in configuration of Wowza application. It is not necessary to specify them if nginx and VLC/udpxy are used.

API address setting in configuration file of Wowza:


TV channel monitoring

In script API_URLit is necessary to specify authorization URL:



It is recommended to make access on 88 port (apache) for local access and access from storage, which are working with temporary URLs.