Some time ago I was looking for an open source YouTube clone when I came across something called osTube. When I recently vistited the osTube site again I found that osTube development had been discontinued. Its successor is ViMP which bills itself as the solution for Social Media, Web TV and Video Communities. It has a host of features and the good news (for me) is that it handles H.264/MP4.
Just to be clear though the ViMP Community edition is not open source – the code is encrypted by a PHP encoder called Source Guardian (which must be installed to use ViMP). Hopefully you are OK with that?
You will need to register at the ViMP site to download it (the current version is 2.0.6). Extract the ViMP tar-ball and you will find an Installation Guide for Debian in the doc folder. Most of this guide is good for an Ubuntu installation but we will make some changes for our Ubuntu install.
My starting point is a virtual machine with a minimal Ubuntu Server installation with the SSH role. So, let’s install ViMP:
Fisrt update repositories:
sudo apt-get update
Install nano (terminal based text editor) and wget (file downloader):
sudo apt-get install nano wget
Install Apache2 web server:
sudo apt-get install apache2
Enable mod_rewrite and then restart Apache2:
sudo a2enmod rewrite sudo /etc/init.d/apache2 restart
sudo apt-get install libapache2-mod-php5
Install additional PHP packages:
sudo apt-get install php5-cli php5-mysql php5-gd php5-xsl php5-curl
Install the MySQL database server:
sudo apt-get install mysql-server
You will be prompted to provide a root password for MySQL. Make a note of this password for later!
Add the Medibuntu repository to your server:
sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
Install the transcoding software:
sudo apt-get install mplayer mencoder ffmpeg flvtool2
Install video codecs for popular proprietary formats:
For 32 bit,
sudo apt-get install w32codecs
or for 64 bit,
sudo apt-get install w64codecs
Create directories for ViMP installation:
sudo mkdir -p /var/www/showvid/data sudo mkdir -p /var/www/showvid/logs sudo chown -R www-data:www-data /var/www/showvid
Create a configuration file for the Apache virtual host:
cd /etc/apache2/sites-available sudo nano showvid
Copy and paste the following into the /etc/apache2/sites-available/showvid file you just created:
<VirtualHost *:80> DocumentRoot "/var/www/showvid/data/web"ServerName showvid.com ServerAlias www.showvid.com <Directory "/var/www/showvid/data/web"> AllowOverride All RewriteEngine On Options -Indexes FollowSymLinks </Directory> ErrorLog /var/www/showvid/logs/error.log CustomLog /var/www/showvid/logs/access.log combined LogLevel error </VirtualHost>
Save the file and exit nano.
Enable the showvid virtual host and restart Apache:
sudo a2ensite showvid sudo /etc/init.d/apache2 reload
Disable the default virtual host and restart Apache:
sudo a2dissite default sudo /etc/init.d/apache2 reload
Next we need to configure some PHP values. Edit both of the files listed below and change the upload_max_filesize, post_max_size and memory_limit values as per the bullet points:
sudo nano /etc/php5/apache2/php.ini sudo nano /etc/php5/cli/php.ini
• upload_max_filesize = 1024M
• post_max_size = 1024M
• memory_limit = 512M
sudo /etc/init.d/apache2 restart
Create a MySQL database called showvid:
sudo mysqladmin -p create showvid
Enter your MySQL password.
Enter the MySQL console as the root user:
mysql -u root -p
Enter your MySQL password again. You should now be at the MySQL prompt:
Create a user called showvid. Change <password> in the first command below to a strong password for the showvid user. Make a note of this password.
CREATE USER showvid@localhost IDENTIFIED BY '<password>'; GRANT ALL PRIVILEGES ON showvid.* TO showvid; FLUSH PRIVILEGES; exit
Change directories to your user directory:
Upload ViMP to your server – I used WinSCP to do this.
Copy the ViMP tar-ball to /var/www/showvid/data/ and then extract it:
sudo cp vimp.framework-<version>.tar.gz /var/www/showvid/data/ cd /var/www/showvid/data/ sudo tar xvzf vimp.framework-<version>.tar.gz sudo rm vimp.framework-<version>.tar.gz
Make the symfony file in /var/www/showvid/data/ executable:
sudo chmod +x symfony
At this point we would normally be able to execute the symfony file but because we are using the Community edition of ViMP we must install SourceGuardian. To do this we will need to know the version of PHP that we have installed:
Now that we know what version of PHP we are using we can copy and extract the Source Guardian loaders that are supplied with ViMP.
First create a temporary directory to work in:
cd /home/<username>/ mkdir temp cd temp/
Now extract the file /var/www/showvid/data/data/loader.tar.gz to the current directory:
tar xfz /var/www/showvid/data/data/loader.tar.gz
For the next step you will need to look in either the Linux_x86-32 folder (if your installation is 32 bit) or the Linux_x86-64 folder (for 64 bit). Assuming that you are running PHP 5.3.2 like me you will want the Source Guardian ixed.5.3.lin loader file .
Now that we have matched a loader to our version of PHP we need to make a folder in /usr/lib/php5/ that we can copy the Source Guardian loader to. The format of the folder is year, month, date +lfs. I don’t think that it really matters what date we choose, so I used the one provided in the Debian installation guide:
sudo mkdir /usr/lib/php5/20060613+lfs
Copy the loader file ixed.5.3.lin to the /usr/lib/php5/20060613+lfs/ folder:
sudo cp Linux_x86-32/ixed.5.3.lin /usr/lib/php5/20060613+lfs/
Create a Source Guardian configuration file:
sudo nano /etc/php5/conf.d/sourceguardian.ini
Add the following two lines to sourceguardian.ini:
sudo /etc/init.d/apache2 restart
Source Guardian installation is now complete.
Change directory back to /www/showvid/data and run symfony – just make sure that you change <password> to the password you defined for the showvid user earlier on:
cd /var/www/showvid/data sudo ./symfony framework:init mysql://showvid:<password>@localhost /showvid
Finally we need to set up a cronjob that runs every minute to convert uploaded videos to the right format. Edit the crontab:
sudo crontab -e
Copy and paste the following line at the bottom:
*/1 * * * * /var/www/showvid/data/scripts/sync_new_uploads.sh > /dev/null 2>&1
You can now access ViMP with a web browser. The password for the admin account is ‘admin’ – so you might want to change that after you log in.
That’s it, now sit back and enjoy your own video community!