You are hereHow to install VideoCache?
New version 1.9.2 of Videocache has added support for new URLs/domains being used by Youtube and Metacafe to serve videos. 1.9.2 performs much better as compared to all previous versions and will not eat up your CPU :-) Proceed to right now and enjoy caching. See notes about 1.9.2 here.
How to install VideoCache?
Requirements
Videocache requires following packages to work.
- Squid >= 2.6
- Python >= 2.4
- Python-urlgrabber (urlgrabber module of python)
- Python-iniparse (iniparse module of python)
- Apache (httpd) Web Server
You should have these packages installed and properly configured on your system. In case you don't have these packages installed check the respective links above.
Download
Download the latest version of videocache from the .
Note : For detailed instruction on installing videocache on Ubuntu/Debian or Debian derivatives, check this tutorial on ubuntuforums.
Installation
Login to root user and install the rpm using the following command.
[root@localhost root]# rpm -ivh videocache-x.x-x.noarch.rpm
If the installation was successful, add the following lines to your squid.conf .
# --BEGIN-- videocache config for squid url_rewrite_program /usr/bin/python /usr/share/videocache/videocache.py url_rewrite_children 7 acl videocache_allow_url url_regex -i \.youtube\.com\/get_video\? acl videocache_allow_url url_regex -i \.youtube\.com\/videoplayback \.youtube\.com\/videoplay \.youtube\.com\/get_video\? acl videocache_allow_url url_regex -i \.youtube\.[a-z][a-z]\/videoplayback \.youtube\.[a-z][a-z]\/videoplay \.youtube\.[a-z][a-z]\/get_video\? acl videocache_allow_url url_regex -i \.googlevideo\.com\/videoplayback \.googlevideo\.com\/videoplay \.googlevideo\.com\/get_video\? acl videocache_allow_url url_regex -i \.google\.com\/videoplayback \.google\.com\/videoplay \.google\.com\/get_video\? acl videocache_allow_url url_regex -i \.google\.[a-z][a-z]\/videoplayback \.google\.[a-z][a-z]\/videoplay \.google\.[a-z][a-z]\/get_video\? acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/videoplayback\? acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/videoplay\? acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/get_video\? acl videocache_allow_url url_regex -i proxy[a-z0-9\-][a-z0-9][a-z0-9][a-z0-9]?\.dailymotion\.com\/ acl videocache_allow_url url_regex -i vid\.akm\.dailymotion\.com\/ acl videocache_allow_url url_regex -i [a-z0-9][0-9a-z][0-9a-z]?[0-9a-z]?[0-9a-z]?\.xtube\.com\/(.*)flv acl videocache_allow_url url_regex -i bitcast\.vimeo\.com\/vimeo\/videos\/ acl videocache_allow_url url_regex -i va\.wrzuta\.pl\/wa[0-9][0-9][0-9][0-9]? acl videocache_allow_url url_regex -i \.files\.youporn\.com\/(.*)\/flv\/ acl videocache_allow_url url_regex -i \.msn\.com\.edgesuite\.net\/(.*)\.flv acl videocache_allow_url url_regex -i media[a-z0-9]?[a-z0-9]?[a-z0-9]?\.tube8\.com\/ mobile[a-z0-9]?[a-z0-9]?[a-z0-9]?\.tube8\.com\/ acl videocache_allow_url url_regex -i \.mais\.uol\.com\.br\/(.*)\.flv acl videocache_allow_url url_regex -i \.video[a-z0-9]?[a-z0-9]?\.blip\.tv\/(.*)\.(flv|avi|mov|mp3|m4v|mp4|wmv|rm|ram) acl videocache_allow_url url_regex -i video\.break\.com\/(.*)\.(flv|mp4) acl videocache_allow_dom dstdomain .mccont.com .metacafe.com .redtube.com .cdn.dailymotion.com acl videocache_deny_url url_regex -i http:\/\/[a-z][a-z]\.youtube\.com http:\/\/www\.youtube\.com url_rewrite_access deny videocache_deny_url url_rewrite_access allow videocache_allow_url url_rewrite_access allow videocache_allow_dom redirector_bypass on # --END-- videocache config for squid
Now follow the instructions on to configure videocache using the configuration file /etc/videocache.conf . Please don't overlook the critical options like , etc.
Now restart your Apache(httpd) webserver. And then restart squid server.
Untar the downloaded archive using the following command
[root@localhost root]# tar -xvzf videocache-x.x.tar.gz
Go to videocache-x.x directory and customize the setup script in accordance with your system. Open setup.py script in your favorite editor (vim) and check for the following variables.
squid_user = 'squid' squid_group = 'squid' apache_conf_dir = '/etc/httpd/conf.d/'
A brief explanation about each variable is as follows.
squid_user
- The user which runs squid proxy server. By default its squid unless you change it. If you didn't change anything in default squid installation, you need not worry about it.
squid_group
- The group name of squid proxy server's process. By default this is also squid.
apache_conf_dir
-
This is the tricky one. This is the directory where other applications stores their configurations files for Apache. This is /etc/httpd/conf.d/ on Red Hat and its derivatives like Fedora, CentOS etc. And for Debian and Ubuntu, its /etc/apache2/conf.d/ . So put the correct value for your operating system.
Once you are done with setting the correct value for these variables, you are ready to run the setup script as root.
[root@localhost videocache-x.x]# python setup.py install
All the activities and errors of the setup script are logged in videocache-setup.log file. Please check the logfile for exact information in case setup gives any errors.
If the setup was successful, add the following lines to your squid.conf
# --BEGIN-- videocache config for squid url_rewrite_program /usr/bin/python /usr/share/videocache/videocache.py url_rewrite_children 7 acl videocache_allow_url url_regex -i \.youtube\.com\/get_video\? acl videocache_allow_url url_regex -i \.youtube\.com\/videoplayback \.youtube\.com\/videoplay \.youtube\.com\/get_video\? acl videocache_allow_url url_regex -i \.youtube\.[a-z][a-z]\/videoplayback \.youtube\.[a-z][a-z]\/videoplay \.youtube\.[a-z][a-z]\/get_video\? acl videocache_allow_url url_regex -i \.googlevideo\.com\/videoplayback \.googlevideo\.com\/videoplay \.googlevideo\.com\/get_video\? acl videocache_allow_url url_regex -i \.google\.com\/videoplayback \.google\.com\/videoplay \.google\.com\/get_video\? acl videocache_allow_url url_regex -i \.google\.[a-z][a-z]\/videoplayback \.google\.[a-z][a-z]\/videoplay \.google\.[a-z][a-z]\/get_video\? acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/videoplayback\? acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/videoplay\? acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/get_video\? acl videocache_allow_url url_regex -i proxy[a-z0-9\-][a-z0-9][a-z0-9][a-z0-9]?\.dailymotion\.com\/ acl videocache_allow_url url_regex -i vid\.akm\.dailymotion\.com\/ acl videocache_allow_url url_regex -i [a-z0-9][0-9a-z][0-9a-z]?[0-9a-z]?[0-9a-z]?\.xtube\.com\/(.*)flv acl videocache_allow_url url_regex -i bitcast\.vimeo\.com\/vimeo\/videos\/ acl videocache_allow_url url_regex -i va\.wrzuta\.pl\/wa[0-9][0-9][0-9][0-9]? acl videocache_allow_url url_regex -i \.files\.youporn\.com\/(.*)\/flv\/ acl videocache_allow_url url_regex -i \.msn\.com\.edgesuite\.net\/(.*)\.flv acl videocache_allow_url url_regex -i media[a-z0-9]?[a-z0-9]?[a-z0-9]?\.tube8\.com\/ mobile[a-z0-9]?[a-z0-9]?[a-z0-9]?\.tube8\.com\/ acl videocache_allow_url url_regex -i \.mais\.uol\.com\.br\/(.*)\.flv acl videocache_allow_url url_regex -i \.video[a-z0-9]?[a-z0-9]?\.blip\.tv\/(.*)\.(flv|avi|mov|mp3|m4v|mp4|wmv|rm|ram) acl videocache_allow_url url_regex -i video\.break\.com\/(.*)\.(flv|mp4) acl videocache_allow_dom dstdomain .mccont.com .metacafe.com .redtube.com .cdn.dailymotion.com acl videocache_deny_url url_regex -i http:\/\/[a-z][a-z]\.youtube\.com http:\/\/www\.youtube\.com url_rewrite_access deny videocache_deny_url url_rewrite_access allow videocache_allow_url url_rewrite_access allow videocache_allow_dom redirector_bypass on # --END-- videocache config for squid
Now follow the instructions on to configure videocache using the configuration file /etc/videocache.conf . Please don't overlook the critical options like , etc.
Now restart squid and httpd (Apache) servers. And you are ready to cache videos from several domains.
The following installation steps are valid for any Linux/Unix system like Red Hat and derivatives, Debian and derivatives, FreeBSD, OpenBSD, Mac OS X.
Untar the downloaded source archive archive
[root@localhost ~]# tar -xvzf videocache-x.x.tar.gz
Go to videocache-x.x directory
[root@localhost ~]# cd videocache-x.x
Copy videocache-httpd.conf to /etc/httpd/conf.d/videocache.conf.
[root@localhost videocache-x.x]# cp videocache-httpd.conf /etc/httpd/conf.d/videocache.conf
Copy videocache-sysconfig.conf to /etc/videocache.conf.
[root@localhost videocache-x.x]# cp videocache-sysconfig.conf /etc/videocache.conf
Copy update-vc to /usr/sbin/update-vc and change permission to executable.
[root@localhost videocache-x.x]# cp update-vc /usr/sbin/update-vc [root@localhost videocache-x.x]# chmod 744 /usr/sbin/update-vc
Copy vccleaner to /usr/sbin/vccleaner and change permission to executable.
[root@localhost videocache-x.x]# cp vccleaner /usr/sbin/vccleaner [root@localhost videocache-x.x]# chmod 744 /usr/sbin/vccleaner
Copy videocache directory to /usr/share/
[root@localhost videocache-x.x]# cp -r videocache /usr/share/
Create directories to cache videos
[root@localhost root]# cd /var/spool/ [root@localhost spool]# mkdir videocache [root@localhost spool]# mkdir videocache/tmp videocache/youtube videocache/metacafe videocache/dailymotion videocache/google videocache/redtube videocache/xtube videocache/vimeo videocache/wrzuta videocache/youporn videocache/soapbox videocache/tube8 videocache/tvuol videocache/bliptv videocache/break [root@localhost spool]# chown -R squid:squid videocache [root@localhost spool]# chmod -R 755 videocache
Create logs directory /var/log/videocache/ and change permissions and ownership
[root@localhost ~]# mkdir -p /var/log/videocache [root@localhost ~]# chmod -R 755 /var/log/videocache/ [root@localhost ~]# chown -R squid:squid /var/log/videocache/
After all those commands, add the following lines to your squid.conf .
# --BEGIN-- videocache config for squid url_rewrite_program /usr/bin/python /usr/share/videocache/videocache.py url_rewrite_children 7 acl videocache_allow_url url_regex -i \.youtube\.com\/get_video\? acl videocache_allow_url url_regex -i \.youtube\.com\/videoplayback \.youtube\.com\/videoplay \.youtube\.com\/get_video\? acl videocache_allow_url url_regex -i \.youtube\.[a-z][a-z]\/videoplayback \.youtube\.[a-z][a-z]\/videoplay \.youtube\.[a-z][a-z]\/get_video\? acl videocache_allow_url url_regex -i \.googlevideo\.com\/videoplayback \.googlevideo\.com\/videoplay \.googlevideo\.com\/get_video\? acl videocache_allow_url url_regex -i \.google\.com\/videoplayback \.google\.com\/videoplay \.google\.com\/get_video\? acl videocache_allow_url url_regex -i \.google\.[a-z][a-z]\/videoplayback \.google\.[a-z][a-z]\/videoplay \.google\.[a-z][a-z]\/get_video\? acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/videoplayback\? acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/videoplay\? acl videocache_allow_url url_regex -i (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/get_video\? acl videocache_allow_url url_regex -i proxy[a-z0-9\-][a-z0-9][a-z0-9][a-z0-9]?\.dailymotion\.com\/ acl videocache_allow_url url_regex -i vid\.akm\.dailymotion\.com\/ acl videocache_allow_url url_regex -i [a-z0-9][0-9a-z][0-9a-z]?[0-9a-z]?[0-9a-z]?\.xtube\.com\/(.*)flv acl videocache_allow_url url_regex -i bitcast\.vimeo\.com\/vimeo\/videos\/ acl videocache_allow_url url_regex -i va\.wrzuta\.pl\/wa[0-9][0-9][0-9][0-9]? acl videocache_allow_url url_regex -i \.files\.youporn\.com\/(.*)\/flv\/ acl videocache_allow_url url_regex -i \.msn\.com\.edgesuite\.net\/(.*)\.flv acl videocache_allow_url url_regex -i media[a-z0-9]?[a-z0-9]?[a-z0-9]?\.tube8\.com\/ mobile[a-z0-9]?[a-z0-9]?[a-z0-9]?\.tube8\.com\/ acl videocache_allow_url url_regex -i \.mais\.uol\.com\.br\/(.*)\.flv acl videocache_allow_url url_regex -i \.video[a-z0-9]?[a-z0-9]?\.blip\.tv\/(.*)\.(flv|avi|mov|mp3|m4v|mp4|wmv|rm|ram) acl videocache_allow_url url_regex -i video\.break\.com\/(.*)\.(flv|mp4) acl videocache_allow_dom dstdomain .mccont.com .metacafe.com .redtube.com .cdn.dailymotion.com acl videocache_deny_url url_regex -i http:\/\/[a-z][a-z]\.youtube\.com http:\/\/www\.youtube\.com url_rewrite_access deny videocache_deny_url url_rewrite_access allow videocache_allow_url url_rewrite_access allow videocache_allow_dom redirector_bypass on # --END-- videocache config for squid
Now follow the instructions on to configure videocache using the configuration file /etc/videocache.conf . Please don't overlook the critical options like , etc.
Now restart squid and httpd (Apache) servers. And you are ready to cache videos from several domains.

