By Arslan Ud Din Shafiq, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.
ClipBucket is an open source media and video management system, available in both free and paid versions. With ClipBucket, you can launch your own multi-screen branded Video-On-Demand (VOD) content. ClipBucket has LDAP integration through which you can setup your Ad credentials. A revenue sharing system in ClipBucket also allows you to manage RPM (revenue per thousand impressions) by regions.
ClipBucket does not restrict its installation to any specific operating system (OS). You can use any operating system (OS) of your choice; however, the installation steps would vary according to the choice of operating system.
In this tutorial, we will be installing and configuring ClipBucket and Nginx on an Alibaba Cloud Elastic Compute Service (ECS) instance with CentOS 7.
For ClipBucket, you will require some backend multimedia software like FFmpeg and MP4Box. These software are needed to convert uploaded videos so they are compatible with the backend. These software are not available in Epel release or CentOS official repositories.
To install RPMFusion Repository, execute the following command.
sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm -y
sudo yum update -y && sudo shutdown -r now
sudo yum -y install unzip
sudo yum install ffmpeg gpac -y
sudo yum install libyaml -y
sudo rpm -ivh https://github.com/feedforce/ruby-rpm/releases/download/2.5.0/ruby-2.5.0-1.el7.centos.x86_64.rpm
sudo yum install rubygems -y
sudo gem install flvtool2
sudo yum install ImageMagick mediainfo mplayer -y
CentOS has MariaDB by default. The version for Maria DB by default is 5.5.x available in default repository in CentOS. In order to install latest version of MariaDB server, you will be required to add MariaDB RPM repository. For latest version, follow the steps:
To create a custom file MariaDB.repo in /etc/yum.repos.d/ directory by executing the following sed command.
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"
sudo yum install MariaDB-server -y
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
You will need to install and configure PHP-FPM daemon to process PHP. For installation of new version of PHP-FPM, REMI repository would be required. Follow the steps below to achieve the required things.
To install REMI repository, execute the following command.
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
sudo mv /etc/opt/remi/php70/php-fpm.conf /etc/opt/remi/php70/php-fpm.conf.real
sudo mv /etc/opt/remi/php70/php.ini /etc/opt/remi/php70/php.ini.real
sudo mv /etc/opt/remi/php70/php-fpm.d/www.conf /etc/opt/remi/php70/php-fpm.d/www.conf.real
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"
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"
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,area=href,frame=src,input=src,form=fakeentry"' > /etc/opt/remi/php70/php.ini"
cd /var/log
sudo mkdir php-fpm
sudo systemctl enable php70-php-fpm
sudo systemctl start php70-php-fpm
To install the latest version of Nginx Web Server, you will need to execute the following command.
sudo yum install nginx -y
sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.real
sudo su -c "echo -e 'error_log /var/log/nginx/error_log info;nevents { multi_accept on; worker_connections 1024; }nhttp {ntaccess_log none;ntcharset utf-8;ntclient_body_timeout 10s;ntclient_header_timeout 10s;ntclient_max_body_size 256M;ntdefault_type application/octet-stream;ntgzip_comp_level 6;ntgzip on;ntgzip_proxied any;ntgzip_types application/json application/javascript application/x-javascript application/xml application/xml+rss text/css text/javascript text/plain text/xml;ntgzip_vary on;ntinclude /etc/nginx/mime.types;ntinclude /etc/nginx/conf.d/headers.conf;ntinclude /etc/nginx/sites-enabled/*.conf;ntindex index.html index.php;ntkeepalive_timeout 8 8;ntreset_timedout_connection on;ntsend_timeout 2s;ntsendfile on;ntserver_tokens off;nttcp_nopush on;nttcp_nodelay on;ntupstream php-7.0 { server unix:/var/run/php-fpm-7.0.sock; }n}nuser apache apache;nworker_processes auto;' > /etc/nginx/nginx.conf"
In /etc/nginx directory, create directories for site-enabled and site-available by executing command.
sudo mkdir /etc/nginx/{sites-available,sites-enabled}
sudo su -c "echo -e 'location ~ /. { deny all; }nlocation = /(favicon.ico|robots.txt) { log_not_found off; }' > /etc/nginx/conf.d/deny-log-not-found.conf" && sudo su -c "echo -e 'location ~* ^.+.(atom|bmp|bz2|css|doc|eot|exe|gif|gz|ico|jpeg|jpg|js|mid|midi|mp4|ogg|ogv|otf|pdf|png|ppt|rss|rft|svg|svgz|tar|tgz|ttf|wav|woff|woff2|xls|zip)$ { expires max; log_not_found off; }' > /etc/nginx/conf.d/expires.conf" && sudo su -c "echo -e 'add_header X-Content-Type-Options "nosniff";nadd_header X-Frame-Options "SAMEORIGIN";nadd_header X-Robots-Tag "noarchive,noodp,noydir";nadd_header X-Xss-Protection "1; mode=block";' > /etc/nginx/conf.d/headers.conf"
Create a file imarslan.com.conf. Replace imarslan.com with your domain name in the command below as well as during creation of this file.
jsudo su -c "echo -e 'server {\n\tinclude /etc/nginx/conf.d/deny-log-not-found.conf;\n\tinclude /etc/nginx/conf.d/expires.conf;\n\tindex index.php;\n\tlocation / {\n\t\ttry_files \$uri \$uri/ /index.php;\n\t\trewrite ^/(.*)v([0-9]+) /watchvideo.php?v=\$2&\$query_string;\n\t\trewrite ^/([a-zA-Z0-9-]+)/?\$ /view_channel.php?uid=\$1&seo_diret=yes;\n\t\t}\n\tlocation ~ \.php\$ { fastcgi_pass php-7.0; include /etc/nginx/fastcgi.conf; }\n\tlocation /categories {\n\t\trewrite ^/categories/?\$ /categories.php;\n\t\t}\n\tlocation /channel {\n\t\trewrite ^/channel/(.*) /view_channel.php?user=\$1;\n\t\t}\n\tlocation /channels {\n\t\trewrite ^/channels/(.)/(.)/(.)/(.)/(.*) /channels.php?cat=\$1&sort=\$3&time=\$4&page=\$5&seo_cat_name=\$2;\n\t\trewrite ^/channels/([0-9]+) /channels.php?page=\$1;\n\t\trewrite ^/channels/?\$ /channels.php;\n\t\t}\n\tlocation /collection {\n\t\trewrite ^/collection/(.)/(.)/(.*) /view_collection.php?cid=\$1&type=\$2&\$query_string;\n\t\t}\n\tlocation /collections {\n\t\trewrite ^/collections/(.)/(.)/(.)/(.)/(.*) /collections.php?cat=\$1&sort=\$3&time=\$4&page=\$5&seo_cat_name=\$2;\n\t\trewrite ^/collections/([0-9]+) /collections.php?page=\$1;\n\t\trewrite ^/collections/?\$ /collections.php;\n\t\t}\n\tlocation /contact {\n\t\trewrite ^/contact/?\$ /contact.php;\n\t\t}\n\tlocation /create_group {\n\t\trewrite ^/create_group /create_group.php;\n\t\t}\n\tlocation /group {\n\t\trewrite ^/group/([a-zA-Z0-9].+) /view_group.php?url=\$1&\$query_string;\n\t\t}\n\tlocation /groups {\n\t\trewrite ^/groups/(.)/(.)/(.)/(.)/(.*) /groups.php?cat=\$1&sort=\$3&time=\$4&page=\$5&seo_cat_name=\$2; rewrite ^/groups/([0-9]+) /groups.php?page=\$1;\n\t\trewrite ^/groups/?\$ /groups.php;\n\t\t}\n\tlocation /item {\n\t\trewrite ^/item/(.)/(.)/(.)/(.) /view_item.php?item=\$3&type=\$1&collection=\$2;\n\t\t}\n\tlocation /members {\n\t\trewrite ^/members/?\$ /channels.php;\n\t\t}\n\tlocation /my_account {\n\t\trewrite ^/my_account /myaccount.php;\n\t\t}\n\tlocation /page {\n\t\trewrite ^/page/([0-9]+)/(.*) /view_page.php?pid=\$1;\n\t\t}\n\tlocation /photo_upload {\n\t\trewrite ^/photo_upload/(.*) /photo_upload.php?collection=\$1;\n\t\trewrite ^/photo_upload/?\$ /photo_upload.php;\n\t\t}\n\tlocation /photos {\n\t\trewrite ^/photos/(.)/(.)/(.)/(.)/(.*) /photos.php?cat=\$1&sort=\$3&time=\$4&page=\$5&seo_cat_name=\$2;\n\t\trewrite ^/photos/([0-9]+) /photos.php?page=\$1;\n\t\trewrite ^/photos/?\$ /photos.php;\n\t\t}\n\tlocation = /rss {\n\t\trewrite ^(.*)\$ /rss.php;\n\t\t}\n\tlocation /rss {\n\t\trewrite ^/rss/([a-zA-Z0-9].+)\$ /rss.php?mode=\$1&\$query_string;\n\t\t}\n\tlocation /search {\n\t\trewrite ^/search/result/?\$ /search_result.php;\n\t\t}\n\tlocation /signup {\n\t\trewrite ^/signup/?\$ /signup.php;\n\t\t}\n\tlocation = /sitemap.xml {\n\t\trewrite ^(.*)\$ /sitemap.php;\n\t\t}\n\tlocation /upload {\n\t\trewrite ^/upload/?\$ /upload.php;\n\t\t}\n\tlocation /user {\n\t\trewrite ^/user/(.*) /view_channel.php?user=\$1;\n\t\t}\n\tlocation /users {\n\t\trewrite ^/users/?\$ /channels.php;\n\t\t}\n\tlocation /video {\n\t\trewrite ^/video/(.)/(.) /watch_video.php?v=\$1&\$query_string; rewrite ^/video/([0-9]+)(.*) /watchvideo.php?v=\$1&\$query_string;\n\t\t}\n\tlocation /videos {\n\t\trewrite ^/videos/(.)/(.)/(.)/(.)/(.*) /videos.php?cat=\$1&sort=\$3&time=\$4&page=\$5&seo_cat_name=\$2;\n\t\trewrite ^/videos/([0-9]+) /videos.php?page=\$1;\n\t\trewrite ^/videos/?\$ /videos.php?\$query_string;\n\t\t}\n\tlocation /view_topic {\n\t\trewrite ^/view_topic/([a-zA-Z0-9].+)tid([0-9]+) /view_topic.php?tid=\$2&\$query_string;\n\t\t}\n\tserver_name imarslan.com www.imarslan.com;\n\troot /var/www/html;\n}' > /etc/nginx/sites-available/imarslan.com.conf"
You will have to create symlink for imarslan.com.conf file in /etc/nginx/sites-enabled/ from /etc/nginx/sites-available/. To do so, execute the command below. Remember to change imarslan.com with your domain name.
sudo su -c "cd /etc/nginx/sites-enabled && ln -s ../sites-available/imarslan.com.conf ."
sudo systemctl enable nginx && sudo systemctl start nginx
To install ClipBucket, navigate to directory cd /tmp/
cd /tmp
wget http://downloads.sourceforge.net/project/clipbucket/ClipBucket%20v2/clipbucket-2.8.v3354-stable.zip
sudo mkdir /var/www/clipbucket
sudo cp -r /tmp/clipbucket-2.8.v3354-stable/upload/* /var/www/clipbucket/
sudo cp /tmp/clipbucket-2.8.v3354-stable/upload/.htaccess /var/www/clipbucket/
sudo chmod -R 777 /var/www/clipbucket/includes/
sudo chmod -R 777 /var/www/clipbucket/files/
sudo chmod -R 777 /var/www/clipbucket/images/
sudo chmod -R 777 /var/www/clipbucket/cache/
sudo chmod -R 777 /var/www/clipbucket/cb_install/
sudo chown apache:apache -R /var/www/clipbucket/
Execute the command below to access your MariaDB server. Then you will asked to enter your password, enter your selected password and hit Enter.
mysql -u root -p
CREATE DATABASE cbdb;
CREATE USER 'cbdb'@'localhost' IDENTIFIED BY 'Password';
GRANT ALL PRIVILEGES ON cbdb.* TO 'cbdb'@'localhost';
FLUSH PRIVILEGES;
EXIT;
You have successfully assigned user to your database. You can change cbdb to your desired database name and username and set password of your choice in place of Password.
You have successfully installed ClipBucket. Now you can access it via your Alibaba Cloud IP address or your domain name.
Access ClipBucket via your Alibaba Cloud IP address or via your domain name.
Click Ok, I Agree, Now let me Continue! and then click Continue to Next Step.
In permissions, click Continue to Next Step again because we have already done permissions settings.
In database settings step, add the database credentials that you did setup.
Click Check Connection, your connection will be checked and you will be redirected to setup Admin credentials for ClipBucket. After adding settings, click Save and Continue.
Set up the title and description for your ClipBucket and then click Save and Continue.
Congratulations! You have successfully configured ClipBucket. You can access your Admin Area from here and you can access website from your domain. Link to admin area will look like http://www.yourdomain.com/admin_area/login.php. Replace "yourdomain" with your actual domain name.
2,599 posts | 764 followers
FollowAlibaba Clouder - May 14, 2019
Alibaba Clouder - May 15, 2019
Alibaba Clouder - May 15, 2019
Alibaba Clouder - May 13, 2019
Sajid Qureshi - August 8, 2018
Hiteshjethva - December 12, 2019
2,599 posts | 764 followers
FollowElastic and secure virtual cloud servers to cater all your cloud hosting needs.
Learn MoreThis solution provides tools and best practices to ensure a live stream is ingested, processed and distributed to a global audience.
Learn MoreProvides low latency and high concurrency, helping improve the user experience for your live-streaming
Learn MoreStream sports and events on the Internet smoothly to worldwide audiences concurrently
Learn MoreMore Posts by Alibaba Clouder