Adrian Moya's picture

[update 2011-10-30] (Jeremy) - Thanks for your great work on this patch Adrian! Please see here for an updated version.

Hi! Do you want your own private youtube? you got it! This TKLPatch will convert Turnkey Core Lucid into a video streamming server running the latests version of clipbucket, all preconfigured and working for you! 
Someone pointed this software in the forums and I found that it can be a nice TKL so I decided to take a look. Developing this patch was harder than I imagined, with lots of retries trying to make a good compilation of ffmpeg that the program liked and listed "all green checks". But finally, as I'm not installing from svn trunk, the program won't detect the version of ffmpeg. It expects a "SVN-rNNNNN" version, but the compilation ends up with "0.6". It doesn't matter as it works perfectly. I could fool the program setting a version "by hand", but I don't see the point. If I could get the exact version from the tarball I'd do this, but they use a script that gets info from .svn folders which don't exist in the tarball sources. 
Other challenge was to simulate the install, because it didn't include an automatic installer script. I also detected a bug in the ffmpeg modules detection which was reported in the forums. Finally, after some frustration and hard work, here it is! It needs testing a lot, as I just made the basics tests. 
If anyone with more experience in this software consider I should include other codecs in the compilation of ffmpeg, comments are welcome. I focused on including the ones that the software marked as required. 
I decided to user the tarball over the SVN-trunk to make this patch more "stable". The version for the package generated and installed is "0.6+src20100615", composed by the version, the source and the date that the tarball was published. But comments are welcome. As I'm using checkinstall to create a deb, you can easily remove it with apt-get remove ffmpeg and compile your own from SVN trunk if you want. 


- Clipbucket 2.0.91
- http and https access. 
- ffmpeg compiled with required codecs. 

What it does:

1. Set Hostname
echo "$HOSTNAME" > /etc/hostname
sed -i "s| \(.*\)| $HOSTNAME|" /etc/hosts
hostname clipbucket
2. Add multiverse repository, needed for libfaac-dev. 
sed -i "s|# deb lucid-updates multiverse|deb lucid-updates multiverse|" /etc/apt/sources.list.d/sources.list
sed -i "s|# deb lucid multiverse|deb lucid multiverse|" /etc/apt/sources.list.d/sources.list
3. Update package information
apt-get update
4. Install required packages
install apache2 php5 mysql-server php5-mysql flvtool2 gpac php5-cli php5-gd ssl-cert libx264-dev libtheora-dev libfaac-dev libmp3lame-dev libvorbis-dev libxvidcore-dev build-essential yasm checkinstall
5. Download and compile ffmpeg from tarball release
cd /usr/local/src
tar xzf ffmpeg-0.6.tar.gz
cd ffmpeg-0.6
./configure --enable-libx264 --enable-libxvid --enable-libfaac --enable-libvorbis --enable-libmp3lame --enable-libtheora --enable-postproc --enable-pthreads --enable-gpl --enable-nonfree
checkinstall --pkgname=ffmpeg --pkgversion "0.6+src20100615" --backup=no --default
6. Download clipbucket
cd /usr/local/src
wget -O
7. Unzip and move clipbucket
unzip -q 
mv upload/ /var/www/clipbucket
8. Create database and database user
mysqladmin -u root create clipbucket
mysql -u root <<-END_PRIVS
GRANT ALL PRIVILEGES ON clipbucket.* TO clipbucket@localhost IDENTIFIED BY "clipbucket";
flush privileges;
9. Enable apache modules
a2enmod rewrite ssl
10. Enable site
a2dissite default
a2ensite clipbucket
a2ensite clipbucket-ssl
11. Simulate install. Here I'm using an extra sql file overlayed in /tmp
cd /var/www/clipbucket
chmod 777 files files/conversion_queue files/logs files/original files/temp files/thumbs files/videos files/mass_uploads files/temp/ images images/avatars images/backgrounds images/category_thumbs images/groups_thumbs cache install 
chmod 755 includes
cp install/dbconnect.php includes/dbconnect.php
sed -i "s/_DB_HOST_/localhost/" includes/dbconnect.php
sed -i "s/_DB_NAME_/clipbucket/" includes/dbconnect.php
sed -i "s/_DB_USER_/clipbucket/" includes/dbconnect.php
sed -i "s/_DB_PASS_/clipbucket/" includes/dbconnect.php
sed -i "s/_TABLE_PREFIX_/cb_/" includes/dbconnect.php
sed "s/{tbl_prefix}/cb_/" install/cb_v2.sql > install/cb_v2_turnkey.sql
sed -i "s/(154, 'use_subs', '0');//" install/cb_v2_turnkey.sql
mysql -u root clipbucket < install/cb_v2_turnkey.sql
mysql -u root clipbucket < /tmp/cbturnkey.sql
cp install/install.lock files/install.lock
cp install/clipbucket.php includes/clipbucket.php
rm files/temp/
12. Stop services
service apache2 stop
service mysql stop
13. Clean
apt-get clean

Wow , it's a too nice application

Jeremy Davis's picture

I will definitely have a use for this at work for a range of training videos we have. I need to see how I can get the videos into a usable format first though (damn DRM). 

Jeremy Davis's picture

I have updated Adrian's patch. Please see here.

@Habib - I'm not sure what's happening there. It doens't do that for me, although I didn't actually test this patch at all (just my update). But unless there has been a change in the ClipBucket software itself (and that was how it used to behave but has changed) Adrian's patch shouldn't do that IMO. Perhaps try my updated patch?

Jeremy Davis's picture

I do a fair bit of patching and so I have a dedicated TKL Core VM for doing this. I would recommend that you do likewise and patch an ISO (inside the Core VM) and then install from the ISO.

So my workflow is like this:

  1. Install Core to VM (VBox is a good free desktop one)
  2. Inside Core - install TKLPatch
    apt-get update && apt-get install tklpatch
  3. Download/upload relevant ISO
    download direct into appliance using wget - OR
    download in your web browser and upload into Core via SFTP (I prefer Filezilla)
  4. Download the patch - I always do this inside Core - I have on occasion had patches corrupted by web browser. get the web address of patch by right-clicking it >> Copy Link Location
    wget http://web-address...
  5. Apply patch to ISO:
    tklpatch patch.tar.gz iso-filename.iso
  6. Copy out the ISO using SFTP and test in VirtualBox

Also I have created an updated version of this patch - see here

Jeremy Davis's picture

So you won't find it as an official appliance in any format. But you may be able to apply the patch to an exisiting TKL OVZ template. I had a crack at creating an update of this but never got it finished and got sidetracked elsewhere....

I have also documented (and tested) applying a patch to an OVZ template (rather than an ISO) which may be worth a shot. Have a read here.

Add new comment