Setup Your Own Youtube like Website in linux



Use ClipBucket
is an open-source and free Multimedia Management Script used to build your own media sharing site like YouTube, Metacafe, Veoh and Hulu etc. Whether you are a small fan club or a big Multi Tier Network operator, Clipbucket will fulfill your video management needs.


Server System Details-
OS-               Centos-6.4
HOSTNAME- server.ashu.com
IP-                192.168.1.5/24


Step-1- Change Hostname-

[root@server ~]# vim /etc/sysconfig/network
HOSTNAME=server.ashu.com

[root@server ~]# vim /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.1.5      server.ashu.com         server

Step-2 Change IP

[root@server ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

---------------------------------------------------------------
DEVICE="eth0"
IPADDR=192.168.1.5
NETMASK=255.255.255.0
HWADDR="00:16:D4:39:5B:6F"
NM_CONTROLLED="yes"
ONBOOT="yes"
----------------------------------------------------------------

Restart Network Services..

[root@server ~]# service network restart

Check Hostname..

[root@server ~]# hostname

Check IP..

[root@server ~]# ifconfig


Step-3 Install Packages...

[root@server ~]# yum install mysql mysql-server httpd php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring wget unzip -y

Step-4
Start/restart MySQL and Apache services now..


[root@server ~]# /etc/init.d/mysqld start
[root@server ~]# /etc/init.d/httpd start
[root@server ~]# chkconfig mysqld on
[root@server ~]# chkconfig httpd on


Step-5 Create MySQL root user password..

[root@server ~]# /usr/bin/mysql_secure_installation 

----------------------------------------------------------------------------------------
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


 ----------------------------------------------------------------------------------------

Step-6 Create MySQL database and user for ClipBucket..

[root@server ~]# mysql -u root -p
----------------------------------------------------------------------------------------

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.69 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database clipbucketdb;
Query OK, 1 row affected (0.02 sec)

mysql> GRANT ALL PRIVILEGES ON clipbucketdb.* TO 'clipbucketadmin' IDENTIFIED BY 'centos';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
----------------------------------------------------------------------------------------
Step-7 Open the Apache default port 80 through your firewall/router..

[root@server html]# vim /etc/sysconfig/iptables

----------------------------------------------------------------------------------------
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p udp -m state --state NEW --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 80 -j ACCEPT

-A INPUT -p udp -m state --state NEW --dport 53 -j ACCEPT
-A INPUT -p tcp -m state --state NEW --dport 53 -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT


 ----------------------------------------------------------------------------------------
Step-8 Restart the iptables to save the changes..

[root@server html]# /etc/init.d/iptables restart 

Step-9 Disable SELinux and reboot your system..

[root@server ~]# vim /etc/sysconfig/selinux 

----------------------------------------------------------------------------------------
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

 ---------------------------------------------------------------------------------------- 

Step-10 The following prerequisties will not be found in Official repositories. So let us install additional  repositories RPMForge, EPEL and RPMFusion..


[root@server src]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
 

[root@server ~]# rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
 

[root@server src]# rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm
 

[root@server src]# rpm -ivh http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm


Step-11 Now install these additional prerequisites.

[root@server ~]# yum groupinstall "Development Tools"
 
[root@server ~]# yum install lame mencoder ffmpeg flvtool2 libogg libvorbis freetype-devel SDL-devel freeglut-devel zlib gpac -y

Step-12 Open your php.ini file and set change the values as shown below. To find the php.ini file enter the command:

[root@server ~]# php -i|grep php.ini

Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Calcutta' for 'IST/5.0/no DST' instead in Unknown on line 0


Step-13 Now open the php.ini file and edit as follows..

[root@server ~]# vim /etc/php.ini

[...]
upload_max_filesize = 500M
max_execution_time = 36000
max_input_time = 600
memory_limit = 5000M
magic_quotes_gpc = On
magic_quotes_runtime = Off
register_globals = Off
output_buffering = Off
display_errors = On
short_open_tag = On
date.timezone = Asia/Calcutta 

Step-14 Install PHPShield Loaders
Note-
PHPShield is an application that is used to protect the code in a 2 core files within PHPmotion. In order for PHPmotion to run, your server will need to have the PHPShield loaders correctly installed.

Download PHPShield Loaders 

[root@server ~]# php -i|grep extension_dir
extension_dir => /usr/lib/php/modules => /usr/lib/php/modules

 
Now go to extension directory and download the phpshield loader. You can download the phpshield loaders here 

[root@server ~]# cd /usr/lib/php/modules/
[root@server modules]# wget http://www.phpshield.com/loaders/ixed4.lin.x86-32.zip 

If you are using 64bit system, use this command instead:

[root@server modules]# wget http://www.phpshield.com/loaders/ixed4.lin.x86-64.zip

Extract and export the phpshield loader value to your php.ini file. If you are using php version 5.3, then you should export ixed5.3 extension to your php.ini file:

[root@server modules]# unzip ixed4.lin.x86-32.zip
[root@server modules]# echo "extension=ixed.5.3.lin" >> /etc/php.ini


Finally, reboot the system once to save and activate all settings.

Install ClipBucket

Download the latest version of ClipBucket here.

Extract the downloaded file:

[root@server ~]# unzip clipbucket-2.6-r738-security-fixed-p3.zip

This will extract the ClipBucket zip file to your current directory. Copy the contents of /upload folder to Apache root document folder.

[root@server ~]# cp -rf upload/* /var/www/html/
[root@server ~]# cp .htaccess /var/www/html/

Step- 15 Now set the full permissions to the following directories..

[root@server ~]# chmod -R 777 /var/www/html/includes/
[root@server ~]# chmod -R 777 /var/www/html/files/
[root@server ~]# chmod -R 777 /var/www/html/files/conversion_queue/
[root@server ~]# chmod -R 777 /var/www/html/files/logs/
[root@server ~]# chmod -R 777 /var/www/html/files/original/
[root@server ~]# chmod -R 777 /var/www/html/files/temp/
[root@server ~]# chmod -R 777 /var/www/html/files/thumbs/
[root@server ~]# chmod -R 777 /var/www/html/files/photos/
[root@server ~]# chmod -R 777 /var/www/html/files/videos/
[root@server ~]# chmod -R 777 /var/www/html/files/mass_uploads/
[root@server ~]# chmod -R 777 /var/www/html/files/temp/install.me
[root@server ~]# chmod -R 777 /var/www/html/images/
[root@server ~]# chmod -R 777 /var/www/html/images/avatars/
[root@server ~]# chmod -R 777 /var/www/html/images/backgrounds/

[root@server~]#chmod-R 777 /var/www/html/images/collection_thumbs/
[root@server ~]# chmod -R 777 /var/www/html/images/groups_thumbs/
[root@server ~]# chmod -R 777 /var/www/html/includes/langs/en.lang
[root@server ~]# chmod -R 777 /var/www/html/cache/
[root@server ~]# chmod -R 777 /var/www/html/cache/comments/
[root@server ~]# chmod -R 777 /var/www/html/cache/userfeeds/
[root@server ~]# chmod -R 777 /var/www/html/cb_install/ 

Step- 16 Begin Installation 

Navigate to http://ip-address or domain-name/cb_install/ from your browser and follow the on screen instructions. 

http://192.168.1.5/cb_install
or
http://server.ashu.com/
cb_install

 
Click Continue.

 It will check the files/folders permissions now, if everything seems ok, click Continue.


Enter the database name, database user and password. Click Continue.


Enter the Administrative account details and click Continue.

 Enter the site name, site slogan and site URL etc and click Continue.


The registration page will appear. It is optional. You can skip and finish the installation.


Now the ClipBucket has been installed.

Step-17 Post Installation

Delete the /db_install folder. And also don’t forget to change the permission of directory /includes to 755.

[root@server ~]# rm -fr /var/www/html/cb_install/
[root@server ~]# chmod -Rv 755 /var/www/html/includes/

Add the following line in your crontab as shown below:

[root@server ~]# vim /var/spool/cron/root 

* * * * * php -q /var/www/html/actions/video_convert.php
* * * * * php -q /var/www/html/actions/verify_converted_videos.php
0 0,12,13 * * * php -q /var/www/html/actions/update_cb_stats.php

Restart the cron daemon:

[root@server ~]# service crond restart

 Now login to admin by clicking on Continue to Admin Area. Enter the username and password. Or navigate to http://ip-address or domain-name/admin_area from your browser.Restart the cron daemon..

http://192.168.1.5/cb_install
or
http://server.ashu.com/
cb_install


This is how my Administration Page looks:
 You Can also manage this page...

That’s it. Now the initial configuration is done.

Test ClipBucket

Let us add a sample video to our media site. Go to the ClipBucket Administration area (http://ip-address/admin_area/).


http://192.168.1.5/cb_install
or
http://server.ashu.com/
cb_install

 
Navigate to Videos -> Manage Categories. Enter the category name and description. Click Add Category.


Go to your Homepage (http://ip-address or Domain-name).
Click on Upload Video on the top right corner of your home page.

 Select the videos to upload.


Enter name of the video, description etc. Click Save Data.

 The uploaded data will immediately converted and uploaded to your site. Wait for few minutes. It will take a while depending upon your size of the video. You can view the status of the video on the Video Manager in your Administration Page.

Once the video conversion is finished, your video will appear on your home page. Click on the video to play. This is how my media site looks in live.

That’s it. Enjoy!

More...Click


______________________________________________________________________________________
Click Back..                                Click Home..
https://docs.google.com/forms/d/1iNRZlJJO6rBFizzPcFmyOTEtfkdjhdVRmpM74IbiT3o/viewform