Archive

Archive for the ‘Installation’ Category

How to set max_open_files in MariaDB / MySQL in CentOS 7

July 25th, 2022 Comments off

Set the system wide open file limit:

vi /etc/security/limits.conf

Change/Add the following:

* soft nofile 1024000
* hard nofile 1024000
* soft nproc 10240
* hard nproc 10240

Now do this for /etc/sysctl

vi /etc/sysctl

Add the following

fs.file-max = 1024000

Set the changes

sysctl -w fs.file-max=1024000
sysctl -p
# check changes
cat /proc/sys/fs/file-max

Set the mysqld.service limit (as settings here will override *.cnf ones)

Set both /etc/systemd/system.conf and /etc/systemd/user.conf

vi /etc/systemd/system.conf
vi /etc/systemd/user.conf

Add the following under [Manager] for both:

DefaultLimitNOFILE=1024000

ALSO, you may need to look in /etc/systemd/system to see if anything is overriding stuff.

/etc/systemd/system
grep -Rl LimitNOFILE

Then change all instances of “LimitNOFILE” with:

systemctl edit [name of service].service

Or do this via “vi”

LimitNOFILE=infinity
LimitMEMLOCK=infinity

You may even need to use the following:

LimitAS=infinity
LimitRSS=infinity
LimitCORE=infinity
LimitNOFILE=infinity

START METHOD1

Find out which .conf files are being used:

systemctl status mysqld
# You'll get something like the following
Drop-In: /etc/systemd/system/mariadb.service.d
           ??override.conf

So now that we see Drop-In: /etc/systemd/system/mariadb.service.d, we’ll do the following:

cd /etc/systemd/system/mariadb.service.d
# If you're using regular mysql, then the above path will likely be different
vi /etc/systemd/system/mariadb.service.d/override.conf

Add the following:

[Service]
LimitNOFILE=infinity
LimitMEMLOCK=infinity

If that doesn’t work, then “infinity” variable was set to mean a specific number, like “65536”… If that’s the case, set the same number as you did in “/etc/my.cnf.d/server.cnf”
or set a really high number like “2048000”

[Service]
LimitNOFILE=2048000
LimitMEMLOCK=2048000

END METHOD 1

START METHOD 2

Find the location of all potential *.service files

cd /
find -iname maria*.service
# or
find -iname mysql*.service

Then edit each one, as in example below:

vi /usr/local/directadmin/custombuild/configure/systemd/mysqld57.service
vi /usr/local/directadmin/custombuild/configure/systemd/mysql.service
vi /usr/local/directadmin/custombuild/configure/systemd/mysqld.service
vi /etc/systemd/system/mysqld.service

vi /etc/systemd/system/mariadb.service
vi /usr/share/mysql/systemd/mariadb.service
vi /usr/local/directadmin/custombuild/configure/systemd/mariadb.servicevi 

Change/Add the following, under “[Service]”:

LimitNOFILE=infinity
LimitMEMLOCK=infinity

If that doesn’t work, then “infinity” variable was set to mean a specific number, like “65536”… If that’s the case, set the same number as you did in “/etc/my.cnf.d/server.cnf”
or set a really high number like “2048000”

LimitNOFILE=2048000
LimitMEMLOCK=2048000

END METHOD 2

Set the *.cnf settings:

vi /etc/my.cnf.d/server.cnf
# or where ever your .cnf may be

Change/Add the following:

open_files_limit               = 1024000

Now reload/restart what’s necessary:

systemctl daemon-reload
systemctl restart mysqld; systemctl status mysqld

How To Fix Video Conversion Problem in Clipbucket?

April 9th, 2022 Comments off

This topic has been discussed many times so i am going to write a complete guide to track your video conversion problem and fix it. I am using ClipBucket 2.0.9, if you have not already update to latest version, please download it from http://clip-bucket.com/latestAdding some of my Forum post content, here is what we are going to track our problem.

1.    Folder permission checking
2.    Uploading & Conversion Settings
3.    Server Modules Settings
4.    Testing file upload Part 1
5.    Testing file upload Part 2

Folder Permission checking

·  Check all directories in “files” folder are chmod (permission) to 777
·  Check there is not PHP error on any of your page
·  Check user login
·  Check Browsing issue
   Please fix all the above issues before going to next step

Uploading & Conversion Settings

Goto Admin Area > Website Settings & Configurations > Upload & Conversion Settings

Goto Admin Area > Website Settings & Configurations > Upload & Conversion Settings
· First make sure your FFMPEG, PHP and Flvtool2 Path is correct
· Mp4Box incase you want to get videos output in Mp4 Format (HQ only)
· If your FFMPEG version is greater than 20000, it may requires VF option on, we will try with “Use Vf On”
· Turn of “use crons” so we can convert videos directly

Server Modules Check

Goto Admin Area > Tool Box > Server Modules

·  Make Sure all statuses are green ( a check sign)
·  if something showing (ALERT) sign, go back to step 2, change settings according to your host
·  FFMPEG version should be greater than 19000
·  FLVtool2 1.6 or greater
·  Ask your host for weather they support PHP CLI or not, 90% host support it by default

Testing File Upload Part 1

Now we are going to upload a small file, less than 2MB you can search for “Bill Gates Pie WMV” or something good for testing purpose only.

1.    Goto Upload (Front End)
2.    Fill the details and upload file and wait till you are redirected to Success Page
3.    Now open up Facebook, login to your account, check your inbox and new updates, logout, close facebook
4.    Goto Admin Area > Video Manager
5.    Now you have one of three status “Successfull” , “Processing” , “Failed”

Successfullif

your status is succcessful, move to next part.

Congratualation for passing this phase Failed

Open “File Conversion Log” and check whey FFMPEG is not conversion videos, there could be one of following problems

1.    unrecognized option ‘-vf’
Turn off “use vf” in upload & conversion settings under FFMPEG PATH field
2.    option ‘padcolor’ has been removed, use the pad filter instead
Turn on “use vf” in upload & conversion settings under FFMPEG PATH field
3.    Check for any ‘libmp3lame’ or ‘libx264? or any codec error

Ask your host to re compile your FFMPEG with required codecsProcessing

Now, the most difficult part.

1. Goto Admin Area > Tool Box > Conversqion queue

2. Check if processing is started or not, if not, then your PHP Path is wrong or your PHP Does not support CLI or your register_argc_argv is not enabled

3. Fix these problems and then start again from Part 4

It will take some time depending on your server speed and file size and video duration and after few minute refresh page 

Testing file upload Part 2

1.    Now upload 10 MB video

2.    Wait for uploading & Success Page

3.    Now open Youtube, search for new movies trailers, watch it (in HD) , once finished, get back to ClipBucket admin panel

4.    check , what is file status, if failed, follow instructions above, if success, carry on with your ClipBucket but

5.    if Processing , check weather file is uploaded in /files/temp folder

Categories: Control Panel, Installation Tags:

How to Install memcached on CentOS Plesk Server

April 9th, 2022 Comments off

Install memcached daemon with command

yum install Memcached

Enable memcached to start on boot

systemctl enable memcached

Start memcached

systemctl start memcached

You can verify if memcached is running with the command “netstat -lntp”

[root@server ~]# netstat -lntp |grep memcachetcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN      129472/memcached    tcp6       0      0 :::11211                :::*                    LISTEN      129472/memcached [root@server ~]#

By default Memcached listen on all interfaces (0.0.0.0:11211). You need to make it bind to 127.0.0.1 only, so no one will be able to access your Memcached installation from the public. For securing Memcached installation, refer How to secure Memcached on CentOS 7. After Memcached is secured, you will see it listen on 127.0.0.1 only like the following

[root@server etc]# netstat -lntp | grep mem
tcp        0      0 127.0.0.1:11211         0.0.0.0:*              LISTEN      81636/memcached     
[root@server etc]#

Install memcached PHP Module

Install the requirements

yum install -y libmemcached-devel zlib-devel

Replace default system PHP with PHP version on which you need memcache PHP module installed. In this case, I will be installing the PHP module for PHP version 7.4

cd /usr/binmv php php.oldmv phpize phpize.oldln -s /opt/plesk/php/7.4/bin/phpln -s /opt/plesk/php/7.4/bin/phpize

Now run the command

/opt/plesk/php/7.4/bin/pecl install memcached

If you get error related to phpize missing, you need to install PHP devel package.

yum install plesk-php74-devel

After install finished, you need to edit php.ini

vi /opt/plesk/php/7.4/etc/php.ini

At end of the file, add

extension=memcached.so

Restart php-fpm

systemctl restart plesk-php74-fpm.service

Install memcache module

the latest version of memcache won’t work with PHP 7.4, so we need to use an older version.

To install version 4.0.5.2 of memcache, run

/opt/plesk/php/7.4/bin/pecl install memcache-4.0.5.2

After installing, edit php.ini file

vi /opt/plesk/php/7.4/etc/php.ini

At end of the file, add

extension=memcache.so

Restart php-fpm

systemctl restart plesk-php74-fpm.service

Secure Memcached on CentOS/RHEL 7?

April 9th, 2022 Comments off

By default memcached on CentOS 7 is set to run on all IP address on the server. This allow attackers to abuse the service.

To set memcached to only listen to localhost (127.0.0.1), edit file

vi /etc/sysconfig/memcached

Find

OPTIONS=""

Replace with

OPTIONS="-l 127.0.0.1"

Categories: Installation Tags:

How to Install Supervisord on CentOS 7?

April 9th, 2022 Comments off

Supervisor is a program used to monitor and control programs. It can auto startup application on server boot time, restart if the application fails.

http://supervisord.org

To install supervisors on CentOS 7, first, enable epel repository.

yum install -y epel-release

Once EPEL repository is enabled, you can install supervisors with the yum command

yum install -y supervisor

Enable supervisord to start on boot, run

systemctl enable supervisord

Start supervisord

systemctl start supervisord

To start a python application on boot time, I created file

vi /etc/supervisord.d/telegram-bot.ini
[program:telegram_bot]
command=/root/bots/telegram_bot/bot.py
directory=/root/bots/telegram_bot
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
numprocs=1
autostart=true
autorestart=true
stdout_logfile=/var/log/telegram-bot.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
stderr_logfile=/var/log/telegram-bot-error.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
stderr_events_enabled=false

Started application with

supervisorctl reload
Categories: Installation Tags:
%d bloggers like this: