Learn input=src

December 18, 2019


ClipBucket is a community supported open source video sharing site and management script. In ClipBuckets’s first incarnation, it was similar to popular video tube websites. However, after years of development, it has become a robust media platform when compared to paid video/media sharing websites. ClipBucket has the following features:

  • Ads manager
  • Content authorization
  • HLS streaming
  • Integration w/ Windows Server Active Directory
  • Real-time statistics
  • Revenue sharing
  • Video on demand (VOD)


  • A CentOS 7 x64 Minimal ISO Library server instance.
  • https://www.itweb.services/tutorials/linux-guides/how-to-use-sudo-on-debian-centos-and-freebsd”>sudo user.

Update the system

Log in as a regular user who has permission to use the sudo command. Update the system as follows.

sudo yum clean all && sudo yum install deltarpm -y && sudo yum update -y

Add The RPMFusion Repository

Neither the official CentOS 7 x64 or EPEL repositories contain RPMs for FFmpeg (includes FFProbe) and GPAC (includes MP4Box). The RPMFusion repository must be added as it contains the latest 2.8.x build of FFmpeg and latest 0.6.x build of GPAC. Use the command below to add the repository.

sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm -y

Install The Required Backend Multimedia Software For ClipBucket

In order for ClipBucket to display videos that are optimized for the web, several multimedia programs must be installed to automatically convert uploaded videos in the background. Install FFmpeg and MP4Box (part of GPAC) from the REMI repository.

sudo yum install ffmpeg gpac -y

In order to install the latest version of Ruby, the YAML library must be installed first.

sudo yum install libyaml -y

Now, install the latest version current version of Ruby (2.5.x).

sudo rpm -ivh https://github.com/feedforce/ruby-rpm/releases/download/2.5.0/ruby-2.5.0-1.el7.centos.x86_64.rpm

Install the Ruby Gems packaging program.

sudo yum install rubygems -y

Install the FLVTool2 gem.

sudo gem install flvtool2

The ImageMagick, MediaInfo and MPlayer/Mencoder programs need to be installed as well.

sudo yum install ImageMagick mediainfo mplayer -y

Install The Web Server Backend For ClipBucket

Install The Latest MariaDB Database Server Version

CentOS 7 comes with MariaDB version 5.5.x in it’s default repository. In order to install the latest available version (10.x.x) of the MariaDB database server, the MariaDB RPM repository must be added.

Use the sed command to create a custom repo file named MariaDB.repo in the /etc/yum.repos.d/ directory.

sudo su -c "echo -e '[mariadb]nname = MariaDBnbaseurl = http://yum.mariadb.org/10.2/centos7-amd64ngpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDBngpgcheck=1' > /etc/yum.repos.d/MariaDB.repo"

Install the MariaDB database server. You will be prompted to import the GPG from MariaDB. Press the “Y” key and the “Enter” key to accept it.

sudo yum install MariaDB-server -y

Enable and start the MariaDB database server.

sudo systemctl start mysql

Secure the MariaDB database server. Replace ******** below with a new password for the root MySQL user. This is the equivalent of running the mysql_secure_installation command without the prompts.

sudo mysql -e "UPDATE mysql.user SET Password=PASSWORD('********') WHERE User='root';DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '', '::1');DELETE FROM mysql.user WHERE User='';DELETE FROM mysql.db WHERE Db IN('test', 'test_%');DROP DATABASE test;FLUSH PRIVILEGES"

Back up the original server.cnf in /etc/my.cnf.d/.

sudo mv /etc/my.cnf.d/server.cnf /root/server.cnf.original

Create a new server.cnf file using the echo command. This config gives true UTF8 support. Be sure to change the default-time-zone option, to reflect the timezone location of your VPS if you so choose. Modify innodb_buffer_pool_instances, based on your innodb_buffer_pool_size, if your database size is larger than 2GB. Example: innodb_buffer_pool_size = 4GB, change innodb_buffer_pool_instances to 4, for 1GB a piece. Modify innodb_buffer_pool_size based on your working dataset. innodb_large_prefix is used for the Error 1071 workaround. innodb_io_capacity and innodb_io_capacity_max are increased from the default since IT Web Services VPS SSD drives provides two orders of magnitude higher IOPs. Modify key_buffer_size, if you have a lot of tables using MyISAM.

sudo su -c "echo -e '[mysqld]nbinlog_formatttttt= mixedncharacter-set-client-handshakettt= FALSEncharacter-set-servertttt= utf8mb4ncollation-servertttt= utf8mb4_unicode_cindefault-time-zonetttt= -05:00nexpire_logs_daystttt= 7ninit_connectttttt= 'SET collation_connection = utf8mb4_unicode_ci, NAMES utf8mb4'ninnodbtttttt= FORCEninnodb_buffer_pool_instancesttt= 1ninnodb_buffer_pool_sizetttt= 256Mninnodb_file_formattttt= barracudaninnodb_flush_methodtttt= O_DIRECTninnodb_large_prefixninnodb-log-file-sizetttt= 32Mninnodb-log-files-in-groupttt= 2ninnodb_io_capacitytttt= 30720ninnodb_io_capacity_maxtttt= 40960ninnodb_lock_wait_timeoutttt= 60ninteractive_timeouttttt= 60nkey_buffer_sizettttt= 2Mnlc_messagesttttt= en_USnlc_messages_dirttttt= /usr/share/mysqlnlog_errorttttt= /var/log/mysql/mysql-error.lognmax_connectionsttttt= 16nmyisam-recover-optionstttt= FORCE,BACKUPnskip_external_lockingnskip-log-binnskip_name_resolvenskip_networkingnslow_query_logttttt= 1nslow_query_log_filetttt= /var/log/mysql/mysql-slow.lognsync_binlogttttt= 1nsysdate-is-nowttttt= 1nthread_cache_sizetttt= 4nthread_pool_sizetttt= 2ntmpdirtttttt= /tmpnwait_timeoutttttt= 60' > /etc/my.cnf.d/server.cnf"

Create a directory named mysql in the /var/log/ directory where the MariaDB database server logs will reside. Change the user and group ownership for the /var/log/mysql directory and its files from the root user/group to the mysql user/group.

sudo mkdir /var/log/mysql && sudo chown mysql.mysql /var/log/mysql

Restart the MariaDB database server.

sudo systemctl restart mysql

The MariaDB database server is now set up and ready.

Install The PHP-FPM 7.0.x Server Version & Necessary PHP Extensions

In order to process PHP, the PHP-FPM 7.0 daemon must be installed and configured. In order to install a version of PHP-FPM newer than the default 5.4.x, the REMI repo must be installed which contains PHP versions 5.6.x, 7.0.x and 7.1.x.

Install the REMI repo and the necessary PHP modules.

sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y && sudo yum install php70-php-cli php70-php-pecl-imagick php70-php-fpm php70-php-mysql php70-php-opcache -y

Make a backup of the php-fpm.conf file in the /etc/opt/remi/php70/ directory by renaming it to php-fpm.conf.original.

sudo mv /etc/opt/remi/php70/php-fpm.conf /etc/opt/remi/php70/php-fpm.conf.original

Create a new php-fpm.conf file by using the echo command.

sudo su -c "echo -e 'include=/etc/opt/remi/php70/php-fpm.d/*.confn[global]ndaemonize = yesnemergency_restart_threshold = 2nemergency_restart_interval = 1mnerror_log = /var/log/php-fpm/php-fpm-7.0-error.lognpid = /var/run/php-fpm-7.0.pidnprocess_control_timeout = 10s' > /etc/opt/remi/php70/php-fpm.conf"

Make a backup of the www.conf file in the /etc/opt/remi/php70/php-fpm.d/ directory by renaming it to www.conf.original.

sudo mv /etc/opt/remi/php70/php-fpm.d/www.conf /etc/opt/remi/php70/php-fpm.d/www.conf.original

Create a new www.conf file by using the echo command.

sudo su -c "echo -e '[www]ngroup = apachenlisten = /var/run/php-fpm-7.0.socknlisten.backlog = 65536nlisten.owner = apachenlisten.group = apachenpm = staticnpm.max_children = 2npm.max_requests = 10240nuser = apache' > /etc/opt/remi/php70/php-fpm.d/www.conf"

Make a backup of the php.ini file in the /etc/opt/remi/php70/ directory by renaming it to php.ini.original.

sudo mv /etc/opt/remi/php70/php.ini /etc/opt/remi/php70/php.ini.original

Create a new php.ini file by using the echo command. Change the memory_limit, post_max_size and upload_max_filesize to be slightly larger than the largest file you intend to upload. Change date.timezone to the timezone of your choosing. I recommend the geographical timezone of your VPS instance.

sudo su -c "echo -e '[PHP]nallow_url_fopen = Onnalways_populate_raw_post_data = -1ndisplay_errors = Offnerror_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICTnexpose_php = Offnlog_errors = Onnmax_execution_time = 7201nmemory_limit = 256Mnoutput_buffering = 4096npost_max_size = 256Mnregister_argc_argv = Offnrequest_order = "GP""nupload_max_filesize = 256Mnvariables_order = ""GPCS""n[Date]ndate.timezone = America/New_Yorkn[Session]nsession.cache_limiter =nsession.gc_divisor = 1000nsession.hash_bits_per_character = 5nsession.save_handler = filesnsession.save_path = ""/var/opt/remi/php70/lib/php/session/""nurl_rewriter.tags = ""a=href