Installation Kloxo-MR – a free control panel for servers

Kloxo-MR – a free control panel for servers based on Kloxo (https://github.com/lxcenter/kloxo).

At hand I had CentOS 6.9, the recommended version of Minimal.
The official source of Kloxo-MR is mratwork.com and github.com/mustafaramadhan.

Switch to the root user, if not under it:

su -

Update the system:

yum update -y

Install the necessary components:

yum install yum-utils yum-priorities vim-minimal subversion curl zip unzip telnet wget -y

Download the installation script:

cd /tmp
rpm -ivh https://github.com/mustafaramadhan/rpms/raw/master/mratwork/release/neutral/noarch/mratwork-release-0.0.1-1.noarch.rpm

Remove the cached packages and update the RPM mratwork:

yum clean all
yum update mratwork-* -y

Install the Kloxo-MR:

yum install kloxomr7 -y
sh /script/upcp

The installation process can take a long time – we wait.

When the installation is complete, restart the server:

reboot

Kloxo-MR can be opened in the browser http://SERVER:7778 and https://SERVER:7777.
The default login and password are admin.

You can restart it like this:

sh /script/restart-all -y

Check this:

netstat -tulpn | grep :7777

How to record games clips in Windows using the Xbox panel?

Since the Xbox gaming panel is built into Windows 10, no additional programs are needed to record the video, just by pressing two Win+G keys simultaneously in the game.
After pressing Win+G, the Xbox gaming panel should open, in which you must click on the red circle (you can also use the combination of keys Win+Alt+R to start and stop video recording).
Using the keys Win+Alt+PrntScr, you can take a screenshot, and Win+Alt+T – show or hide the timer.

The Xbox game panel can also be opened by pressing the Xbox button on the gamepad.

Video clips are saved in MP4 format, to the \Video\Clips\ current user’s directory.

See also:
How to record games clips

How to change a WordPress theme through MySQL

To change the WordPress theme via MySQL, first see what theme is specified at the moment, for this, execute the SQL query via phpMyAdmin or MySQL client:

SELECT * FROM wp_options
WHERE option_name = 'template'
OR option_name = 'stylesheet'
OR option_name = 'current_theme';

Next, see what themes are in the /wp-content/themes/ directory.

For example, to change to the standard Twenty Fifteen theme, let’s execute three SQL queries:

UPDATE wp_options SET option_value = 'twentyfifteen' WHERE option_name = 'template';
UPDATE wp_options SET option_value = 'twentyfifteen' WHERE option_name = 'stylesheet';
UPDATE wp_options SET option_value = 'Twenty Fifteen' WHERE option_name = 'current_theme';

How to create an ad unit that supports AMP pages

Here is an example of placing AdSense ad units on the AMP-pages of the WordPress site:

1) Add an AMP script in the page code between the head tags that will load the required libraries:

<script async custom-element="amp-ad" src="https://cdn.ampproject.org/v0/amp-ad-0.1.js"></script>

If you use the recommended AMP plugin from Automattic, then the head tags are here /wp-content/plugins/amp/templates/html-start.php

2) Create an adaptive ad unit in your AdSense account. Let’s find in its code the identifier of the publisher (for example ca-pub-0066847942845019) and the ad unit ID (for example 1234567890).
Insert the code below into the page where you want to place the ad unit, replacing the value data-ad-client with the previously found publisher ID and data-ad-slot with the ad unit ID:

<amp-ad width="100vw" height=320
type="adsense"
data-ad-client="ca-pub-0066847942845019"
data-ad-slot="1234567890"
data-auto-format="rspv"
data-full-width>
<div overflow></div>
</amp-ad>

If you use the recommended AMP plug-in from Automattic, then the code should be inserted in /wp-content/plugins/amp/templates/single.php.

How to disable the WordPress plug-in via MySQL

To disable all WordPress plugins via MySQL, you must:

1) Be sure to make a backup copy of the database.

2) Open the phpMyAdmin or MySQL client from the terminal:

mysql -u USER -p

3) Execute the SQL query (if necessary, specify the correct prefix wp_):

UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';

After that, all plug-ins will be disabled and you can activate them again one by one in the admin panel.

You can also temporarily disable the plugin by renaming the directory with its files, the plugins are in the /wp-content/plugins/ directory.

How to restart services in cPanel

The services must be restarted through the WHM interface, by opening “Home” > “Restart Services”.

If the restart of the service through the WHM interface failed, then the script should be used:

/usr/local/cpanel/scripts/restartsrv_*

If you are using IPv6 and the command was executed:

service network restart

That IPv6 does not work to solve the problem:

/etc/init.d/cpipv6 restart (for cPanel & WHM version 11.52 and earlier)
/usr/local/cpanel/scripts/restartsrv_cpipv6 (for cPanel & WHM version 54 and later)

In extreme cases, you can try to restart the service directly:

/etc/rc.d/init.d/service restart
systemctl restart service-name.service

See also:
Location of log files cPanel

IPTables rules for SSH

To enable access to the SSH server in IPTables, you must add a rule:

sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT

To open only a particular network, for example 192.168.0.0/24:

sudo iptables -A INPUT -s 192.168.0.0/24 -p tcp --dport 22 -j ACCEPT

You can also restrict access by the IP configuration of the SSH itself.

To remove a rule, we’ll specify the same command, replacing -A with -D, for example:

sudo iptables -D INPUT -p tcp --dport 22 -j ACCEPT

To view the list of rules, use the command:

sudo iptables -nvL

See also:
Installing and Configuring SSH
Configuring IPTables

Installing the Ministra TV Platform (Stalker Middleware) in Ubuntu

On the test, I will install the Ministra TV Platform (formerly called Stalker Middleware) in Ubuntu Server 14.04 LTS.

First we will make a request for download by visiting the official website www.infomir.eu.
Unpack the downloaded archive:

sudo apt-get install unzip
unzip stalker_portal-5.3.0.zip

Copy the files to the web server directory:

cp -a infomirgroup-stalker_portal* /var/www/stalker_portal

Install the necessary components:

sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y -u apache2 nginx memcached mysql-server php5 php5-mysql php-pear nodejs upstart 
sudo pear channel-discover pear.phing.info
sudo pear install phing/phing

Create MySQL database and user:

mysql -u root -p
CREATE DATABASE stalker_db;
CREATE USER 'stalker'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON stalker_db.* TO stalker@localhost IDENTIFIED BY '1' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

If you need to change the settings in the /var/www/stalker_portal/server/config.ini configuration file, create a custom.ini file and add the parameters that you need to change:

sudo nano /var/www/stalker_portal/server/custom.ini

For example, the password for the database:

[database]
mysql_pass = PASSWORD

Perform phing (this process can take a long time, also in my case the MySQL user root password was requested):

cd /var/www/stalker_portal/deploy/
sudo phing

In /etc/mysql/my.cnf we will specify:

max_allowed_packet = 32M

We activate short PHP tags in /etc/php5/apache2/php.ini:

short_open_tag = On

The libapache2-mod-php5filter package should not be installed on the system:

sudo apt-get purge libapache2-mod-php5filter

Let’s make a backup copy of the standard apache2 web server configuration and clear the file:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/000-default_backup.conf
sudo nano /etc/apache2/sites-available/000-default.conf

Add to it:

    <VirtualHost *:88>
            ServerAdmin webmaster@localhost
            DocumentRoot /var/www
            <Directory /var/www/stalker_portal/>
                    Options -Indexes -MultiViews
                    AllowOverride ALL
                    Require all granted
            </Directory>
            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>

Let’s change the port to Listen 88:

sudo nano /etc/apache2/ports.conf

Restart apache2 to apply the changes:

sudo service apache2 restart

Let’s make a backup copy of the standard nginx web server configuration and clear the file:

sudo mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default_backup
sudo nano /etc/nginx/sites-available/default

Add to it:

    server {
        listen       80;
        server_name  localhost;
     
        location / {
            proxy_pass http://127.0.0.1:88/;
            proxy_set_header Host $host:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
        }
     
        location ~* \.(htm|html|jpeg|jpg|gif|png|css|js)$ {
            root /var/www;
            expires 30d;
        }
    }

Restart nginx to apply the changes:

sudo service nginx restart

Now you can open the browser interface administrator interface http://SERVER/stalker_portal, login – admin, password – 1.
And the client – http://SERVER/stalker_portal/c/