<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.creativecommons.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Michaelkrnac</id>
		<title>Creative Commons - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.creativecommons.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Michaelkrnac"/>
		<link rel="alternate" type="text/html" href="https://wiki.creativecommons.org/wiki/Special:Contributions/Michaelkrnac"/>
		<updated>2026-05-09T11:22:56Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>https://wiki.creativecommons.org/index.php?title=Cchost/Developers/Victor%27s_Dev_Setup&amp;diff=22862</id>
		<title>Cchost/Developers/Victor's Dev Setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.creativecommons.org/index.php?title=Cchost/Developers/Victor%27s_Dev_Setup&amp;diff=22862"/>
				<updated>2009-04-27T10:19:59Z</updated>
		
		<summary type="html">&lt;p&gt;Michaelkrnac: /* Configuring Apache */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ccHost]]&lt;br /&gt;
[[Category:ccMixter]]&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Technology]]&lt;br /&gt;
{{cchost_head}}&lt;br /&gt;
{{lowercase}}&lt;br /&gt;
&lt;br /&gt;
I recently had the opportunity to install a new development machine using the latest tools. This is how my ccMixter/ccHost development machine was set up.&lt;br /&gt;
&lt;br /&gt;
==Version Info==&lt;br /&gt;
&lt;br /&gt;
*Ubuntu: 8.04  - the Hardy Heron - released in April 2008.&lt;br /&gt;
*Apache: Apache/2.2.8 (Ubuntu) &lt;br /&gt;
*PHP: PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch &lt;br /&gt;
*mySQL: 5.0.51a (Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2)&lt;br /&gt;
*Subversion: Client 1.4.6&lt;br /&gt;
*RapidSVN 0.9.4&lt;br /&gt;
*Meld: 1.1.5.1&lt;br /&gt;
*ccHost 5.0.1 (Committed revision 11342 Nov. 29, 2008)&lt;br /&gt;
&lt;br /&gt;
==Ubuntu==&lt;br /&gt;
I used the [http://wubi-installer.org/ Wubi installer] to get Ubuntu on my Windows laptop.&lt;br /&gt;
&lt;br /&gt;
I end up as user 'victor' in group 'victor'.&lt;br /&gt;
&lt;br /&gt;
After installation, there were 195 'updates' and I got all of those.&lt;br /&gt;
&lt;br /&gt;
==LAMP==&lt;br /&gt;
I then went out and got and verified the pieces of LAMP:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install apache2&lt;br /&gt;
 sudo apt-get install mysql&lt;br /&gt;
 sudo apt-get install php5 libapache2-mod-php5&lt;br /&gt;
 sudo apt-get install php5-cli&lt;br /&gt;
&lt;br /&gt;
===Configuring Apache===&lt;br /&gt;
Because I'm using the PHP module (not CGI) Apache will perform operations in 'nix as a user in a group that will need write permissions to several directories. In order to ease this problem I change the default group that apache will run in to the same as me ('victor'):&lt;br /&gt;
&lt;br /&gt;
  cd /etc/apache2&lt;br /&gt;
  sudo vi envvars&lt;br /&gt;
&lt;br /&gt;
Then edit the line:&lt;br /&gt;
 &lt;br /&gt;
  export APACHE_RUN_GROUP=www-data&lt;br /&gt;
&lt;br /&gt;
and change '''www-data''' to '''victor'''&lt;br /&gt;
&lt;br /&gt;
I next want to enable mod_rewrite:&lt;br /&gt;
&lt;br /&gt;
  cd /etc/apache2/mods-enabled&lt;br /&gt;
  ln -s ../mods-available/rewrite.load rewrite.load&lt;br /&gt;
&lt;br /&gt;
And you need to enable .htaccess overwrites:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/apache2/sites-available&lt;br /&gt;
 sudo vi default&lt;br /&gt;
&lt;br /&gt;
Under ''&amp;lt;nowiki&amp;gt;&amp;lt;Directory /var/www/&amp;gt;&amp;lt;/nowiki&amp;gt;'' change the line:&lt;br /&gt;
&lt;br /&gt;
  AllowOverride None&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
  &lt;br /&gt;
  AllowOverride All&lt;br /&gt;
&lt;br /&gt;
I prefer to keep my localhost website for junky experiments so I create a virtual Apache host for ccMixter. Create the new file:&lt;br /&gt;
&lt;br /&gt;
  sudo vi /etc/apache2/sites-available/cchost&lt;br /&gt;
&lt;br /&gt;
Enter the following:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;VirtualHost *&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    DocumentRoot &amp;lt;nowiki&amp;gt;/var/www/cchost&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    ServerName cchost&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;/VirtualHost&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then enable it:&lt;br /&gt;
&lt;br /&gt;
  ln -s /etc/apache2/sites-available/cchost /etc/apache2/sites-enabled/cchost&lt;br /&gt;
&lt;br /&gt;
Then map the name for my local machine:&lt;br /&gt;
&lt;br /&gt;
  sudo vi /etc/hosts&lt;br /&gt;
&lt;br /&gt;
Add the line:&lt;br /&gt;
&lt;br /&gt;
  127.0.2.1 cchost&lt;br /&gt;
&lt;br /&gt;
===Setting up the ccHost Database===&lt;br /&gt;
Even though I'm going to mirror the ccMixter database here, it doesn't matter what the names are here locally:&lt;br /&gt;
&lt;br /&gt;
 mysql -p -u root&lt;br /&gt;
 mysql&amp;gt; CREATE DATABASE ccmixter;&lt;br /&gt;
 mysql&amp;gt; GRANT ALL ON ccmixter.* TO 'ccm_user'@'localhost' IDENTIFIED BY 'ccm_password';&lt;br /&gt;
&lt;br /&gt;
===getID3===&lt;br /&gt;
I like '''curl'''&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install curl&lt;br /&gt;
&lt;br /&gt;
I want to make the mirroring with ccMixter smooth so I create a directory that matches where we have getID3 on the ccMixter server:&lt;br /&gt;
&lt;br /&gt;
 sudo mkdir /var/getid3&lt;br /&gt;
&lt;br /&gt;
Then I grab the zip from the net, unzip and do some clean up:&lt;br /&gt;
&lt;br /&gt;
 curl &amp;lt;nowiki&amp;gt;http://internap.dl.sourceforge.net/sourceforge/getid3/getid3-1.7.8b3.zip&amp;lt;/nowiki&amp;gt; &amp;gt; getid3.zip&lt;br /&gt;
 unzip getid3.zip&lt;br /&gt;
 rm getid3.zip&lt;br /&gt;
 rm -f -r demos&lt;br /&gt;
&lt;br /&gt;
==Subversion==&lt;br /&gt;
The Creative Commons code server uses Subversion. There's a very usable and worthwhile GUI on Ubuntu and a fine diff program that I get:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install subversion&lt;br /&gt;
  sudo aptitude install rapidsvn&lt;br /&gt;
  sudo aptitude install meld&lt;br /&gt;
&lt;br /&gt;
===Writable Repository Access===&lt;br /&gt;
Since I need writable access to the CC code repository, I had to register my public key with the system. &lt;br /&gt;
&lt;br /&gt;
If you only plan to do read-only updates from SVN you can skip this section entirely.&lt;br /&gt;
&lt;br /&gt;
If you already have keys registered in your system you can skip this section entirely.&lt;br /&gt;
&lt;br /&gt;
If you don't have ssh keys then you can use ssh-keygen and let the CC folks know about it to get writable access. And you can skip the rest of this section entirely.&lt;br /&gt;
&lt;br /&gt;
My key was originally generated on Windows using the Putty tools. The 'nix system prefers OpenSSH version of the key files so I had to translate the PPK (Putty) version to that. I probably could have gone back to Windows to translate these but instead I installed the 'nix version the Putty tools:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install putty&lt;br /&gt;
&lt;br /&gt;
From my home directory I ran my key file through that to generate the OpenSSH key files:&lt;br /&gt;
&lt;br /&gt;
  puttygen -L victors_key.ppk &amp;gt; .ssh/id_dsa.pub&lt;br /&gt;
  puttygen victors_key.ppk -O private-openssh -o .ssh/id_dsa&lt;br /&gt;
 &lt;br /&gt;
The .ssh/id_dsa naming convention is magic and required, the files must be private read-only:&lt;br /&gt;
&lt;br /&gt;
  chmod 600 .ssh/id_dsa&lt;br /&gt;
  chmod 600 .ssh/id_dsa.pub&lt;br /&gt;
&lt;br /&gt;
The '''ssh-agent''' daemon was already running in my install so all I had to do was register the keys (the passphrase was prompted for):&lt;br /&gt;
&lt;br /&gt;
  ssh-add&lt;br /&gt;
&lt;br /&gt;
From this point on, all SVN access to the CC server would be done passing these keys back and forth and I never had to think about it again.&lt;br /&gt;
&lt;br /&gt;
==Getting the Code==&lt;br /&gt;
Moving to /var/www I got the code:&lt;br /&gt;
&lt;br /&gt;
  svn co svn+ssh://svn@code.creativecommons.org/svnroot/cchost/trunk cchost&lt;br /&gt;
&lt;br /&gt;
If you're only doing read-only updates then its:&lt;br /&gt;
&lt;br /&gt;
  svn co &amp;lt;nowiki&amp;gt;http://code.creativecommons.org/svnroot/cchost/trunk&amp;lt;/nowiki&amp;gt; cchost&lt;br /&gt;
&lt;br /&gt;
''IS THAT RIGHT????''&lt;br /&gt;
&lt;br /&gt;
We need 'cchost' directory writable by the web server. The group is already correct ('victor') because I created it so all we have to do is enable write by the group:&lt;br /&gt;
&lt;br /&gt;
  chmod 775 cchost&lt;br /&gt;
&lt;br /&gt;
For cchost log files we write them to a directory that is not accessible to the web. Just to make the mirroring easier I created a log directory in the same location as ccMixter's on my local machine. (The actual location is different than the one here but the steps are the same):&lt;br /&gt;
&lt;br /&gt;
  sudo mkdir /var/log/cchost&lt;br /&gt;
  sudo chgrp victor /var/log/cchost&lt;br /&gt;
  sudo chmod 775 /var/log/cchost&lt;br /&gt;
&lt;br /&gt;
==Verifying ccHost Install==&lt;br /&gt;
Finally ready to see if our setup is alive. We start by restarting Apache to get our config changes to take hold:&lt;br /&gt;
&lt;br /&gt;
  sudo /etc/init.d/apache2 restart&lt;br /&gt;
&lt;br /&gt;
Kill all instances of the browser, then browse to ''&amp;lt;nowiki&amp;gt;http://localhost/cchost&amp;lt;/nowiki&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
NOTE: You may have to log out of Ubuntu or possibly reboot and get all the config stuff to take.&lt;br /&gt;
&lt;br /&gt;
That brings up the 'cchost has not been properly install...' with a link to ''ccamdin' subdirectory. Follow that link to start the install. &lt;br /&gt;
&lt;br /&gt;
After the install the '''Setting up your PHP environment''' screen tells me that ''/etc/php5/apache2/php.ini'' should be edited with different defaults and I go do that.&lt;br /&gt;
&lt;br /&gt;
Click on the 'One more thing' link. Then rename the /var/www/cchost/ccadmin to something bogus.&lt;br /&gt;
&lt;br /&gt;
Click through all the links and ccHost is up and running with defaults.&lt;br /&gt;
&lt;br /&gt;
==Import ccMixter Config==&lt;br /&gt;
&lt;br /&gt;
I have a bash script that will get the latest config from ccmixter.org and import it into the dev machine. The actual script using tons of piping in just three commands:&lt;br /&gt;
&lt;br /&gt;
 sqlite3 ~/.mozilla/firefox/vkuuxfit.default/cookies.sqlite &amp;quot;SELECT ':1',lastAccessed,':2',value FROM moz_cookies where name = 'lepsog3' and host = 'ccmixter.org'&amp;quot; | sed 's/:1|/ccmixter.org	FALSE	\/	FALSE	/; s/|:2|/	lepsog3	/' &amp;gt; ccm_cookie&lt;br /&gt;
 curl -b ccm_cookie &amp;lt;nowiki&amp;gt;http://ccmixter.org/export&amp;lt;/nowiki&amp;gt; | sed 's/ccmixter.org/cchost.org/; s/Download, Sample, Cut-up, Share./ccHost DEV SITE/' &amp;gt; cch_import&lt;br /&gt;
 cd cchost/bin&lt;br /&gt;
 php -f cc-host-config-import.php ../cch_import&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below I break it up to annotate it.&lt;br /&gt;
&lt;br /&gt;
The first thing I want to do is call &amp;lt;nowiki&amp;gt;http://ccmixter.org/export&amp;lt;/nowiki&amp;gt; while logged in as admin. I can fake this by grabbing the ccMixter cookie out of Mozilla's Firefox. The cookie is usually in a directory like:&lt;br /&gt;
&lt;br /&gt;
  cd ~/.mozilla/firefox/vkuuxfit.default&lt;br /&gt;
&lt;br /&gt;
I run a SQL query on it with place holders to a file called 'x':&lt;br /&gt;
&lt;br /&gt;
  sqlite3 cookies.sqlite \&lt;br /&gt;
    &amp;quot;SELECT ':1',lastAccessed,':2',value FROM moz_cookies where name='lepsog3' and host='ccmixter.org'&amp;quot; \&lt;br /&gt;
    &amp;gt; /var/www/x&lt;br /&gt;
&lt;br /&gt;
I then substitute the place holders so that it forms a proper browser cookie:&lt;br /&gt;
&lt;br /&gt;
 cd /var/www&lt;br /&gt;
 cat x | sed 's/:1|/ccmixter.org'''TAB'''FALSE'''TAB'''\/'''TAB'''FALSE'''TAB'''/; s/|:2|/'''TAB'''lepsog3'''TAB/'''' &amp;gt; ccm_cookie&lt;br /&gt;
&lt;br /&gt;
NOTE: In order to make things clear in this wiki, I've bolded the tab characters - you should replace those with actual tab characters (ascii 7).&lt;br /&gt;
&lt;br /&gt;
I now have a cookie and can use curl to call over to ccMixter and get the config as if I was logged in as admin. I save it to a file called 'xx'&lt;br /&gt;
&lt;br /&gt;
  curl -b ccm_cookie &amp;lt;nowiki&amp;gt;http://ccmixter.org/export&amp;lt;/nowiki&amp;gt; &amp;gt; xx&lt;br /&gt;
  &lt;br /&gt;
The file 'xx' refers to ccmixter.org all over the place so I replace it with my dev domain. I also replace the site description in the banner so I don't forget which site I'm on (!):&lt;br /&gt;
&lt;br /&gt;
  cat xx | sed 's/ccmixter.org/cchost.org/; s/Download, Sample, Cut-up, Share./ccHost DEV SITE/' &amp;gt; cch_import&lt;br /&gt;
&lt;br /&gt;
At this point I could browse to my dev site and using the import command:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;http://cchost.org/import&amp;lt;/nowiki&amp;gt;?i=../cch_import&lt;br /&gt;
&lt;br /&gt;
but that's overkill considering we're right on the machine and can call a script that does the import:&lt;br /&gt;
&lt;br /&gt;
  cd cchost/bin&lt;br /&gt;
  php -f cc-host-config-import.php ../cch_import&lt;br /&gt;
&lt;br /&gt;
==Import ccMixter Data==&lt;br /&gt;
&lt;br /&gt;
To mirror the data I use mysqldump on the CC server, sftp the results down to my dev laptop, then import the sql file using mysql command line. I leave that part as an exercise for the reader. (Just remember to NOT transfer the cc_tbl_config table.)&lt;/div&gt;</summary>
		<author><name>Michaelkrnac</name></author>	</entry>

	<entry>
		<id>https://wiki.creativecommons.org/index.php?title=Cchost/Developers/Victor%27s_Dev_Setup&amp;diff=22834</id>
		<title>Cchost/Developers/Victor's Dev Setup</title>
		<link rel="alternate" type="text/html" href="https://wiki.creativecommons.org/index.php?title=Cchost/Developers/Victor%27s_Dev_Setup&amp;diff=22834"/>
				<updated>2009-04-24T13:55:59Z</updated>
		
		<summary type="html">&lt;p&gt;Michaelkrnac: /* Configuring Apache */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category:ccHost]]&lt;br /&gt;
[[Category:ccMixter]]&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Technology]]&lt;br /&gt;
{{cchost_head}}&lt;br /&gt;
{{lowercase}}&lt;br /&gt;
&lt;br /&gt;
I recently had the opportunity to install a new development machine using the latest tools. This is how my ccMixter/ccHost development machine was set up.&lt;br /&gt;
&lt;br /&gt;
==Version Info==&lt;br /&gt;
&lt;br /&gt;
*Ubuntu: 8.04  - the Hardy Heron - released in April 2008.&lt;br /&gt;
*Apache: Apache/2.2.8 (Ubuntu) &lt;br /&gt;
*PHP: PHP/5.2.4-2ubuntu5.3 with Suhosin-Patch &lt;br /&gt;
*mySQL: 5.0.51a (Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2)&lt;br /&gt;
*Subversion: Client 1.4.6&lt;br /&gt;
*RapidSVN 0.9.4&lt;br /&gt;
*Meld: 1.1.5.1&lt;br /&gt;
*ccHost 5.0.1 (Committed revision 11342 Nov. 29, 2008)&lt;br /&gt;
&lt;br /&gt;
==Ubuntu==&lt;br /&gt;
I used the [http://wubi-installer.org/ Wubi installer] to get Ubuntu on my Windows laptop.&lt;br /&gt;
&lt;br /&gt;
I end up as user 'victor' in group 'victor'.&lt;br /&gt;
&lt;br /&gt;
After installation, there were 195 'updates' and I got all of those.&lt;br /&gt;
&lt;br /&gt;
==LAMP==&lt;br /&gt;
I then went out and got and verified the pieces of LAMP:&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install apache2&lt;br /&gt;
 sudo apt-get install mysql&lt;br /&gt;
 sudo apt-get install php5 libapache2-mod-php5&lt;br /&gt;
 sudo apt-get install php5-cli&lt;br /&gt;
&lt;br /&gt;
===Configuring Apache===&lt;br /&gt;
Because I'm using the PHP module (not CGI) Apache will perform operations in 'nix as a user in a group that will need write permissions to several directories. In order to ease this problem I change the default group that apache will run in to the same as me ('victor'):&lt;br /&gt;
&lt;br /&gt;
  cd /etc/apache2&lt;br /&gt;
  sudo vi envvars&lt;br /&gt;
&lt;br /&gt;
Then edit the line:&lt;br /&gt;
 &lt;br /&gt;
  export APACHE_RUN_GROUP=www-data&lt;br /&gt;
&lt;br /&gt;
and change '''www-data''' to '''victor'''&lt;br /&gt;
&lt;br /&gt;
I next want to enable mod_rewrite:&lt;br /&gt;
&lt;br /&gt;
  cd /etc/apache2/mods-enabled&lt;br /&gt;
  ln -s ../mods-available/rewrite.load rewrite.load&lt;br /&gt;
&lt;br /&gt;
And you need to enable .htaccess overwrites:&lt;br /&gt;
&lt;br /&gt;
 cd /etc/apache2/sites-available&lt;br /&gt;
 sudo vi default&lt;br /&gt;
&lt;br /&gt;
Under ''&amp;lt;nowiki&amp;gt;&amp;lt;Directory /var/www/&amp;gt;&amp;lt;/nowiki&amp;gt;'' change the line:&lt;br /&gt;
&lt;br /&gt;
  AllowOverride None&lt;br /&gt;
&lt;br /&gt;
to:&lt;br /&gt;
  &lt;br /&gt;
  AllowOverride All&lt;br /&gt;
&lt;br /&gt;
I prefer to keep my localhost website for junky experiments so I create a virtual Apache host for ccMixter. Create the new file:&lt;br /&gt;
&lt;br /&gt;
  sudo vi /etc/apache2/sites-available/cchost&lt;br /&gt;
&lt;br /&gt;
Enter the following:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;VirtualHost *&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
    DocumentRoot &amp;lt;nowiki&amp;gt;/var/www/cchost&amp;lt;nowiki&amp;gt;&lt;br /&gt;
    ServerName cchost&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;/VirtualHost&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then enable it:&lt;br /&gt;
&lt;br /&gt;
  ln -s /etc/apache2/sites-enabled/cchost /etc/apache2/sites-available/cchost&lt;br /&gt;
&lt;br /&gt;
Then map the name for my local machine:&lt;br /&gt;
&lt;br /&gt;
  sudo vi /etc/hosts&lt;br /&gt;
&lt;br /&gt;
Add the line:&lt;br /&gt;
&lt;br /&gt;
  127.0.2.1 cchost&lt;br /&gt;
&lt;br /&gt;
===Setting up the ccHost Database===&lt;br /&gt;
Even though I'm going to mirror the ccMixter database here, it doesn't matter what the names are here locally:&lt;br /&gt;
&lt;br /&gt;
 mysql -p -u root&lt;br /&gt;
 mysql&amp;gt; CREATE DATABASE ccmixter;&lt;br /&gt;
 mysql&amp;gt; GRANT ALL ON ccmixter.* TO 'ccm_user'@'localhost' IDENTIFIED BY 'ccm_password';&lt;br /&gt;
&lt;br /&gt;
===getID3===&lt;br /&gt;
I like '''curl'''&lt;br /&gt;
&lt;br /&gt;
 sudo apt-get install curl&lt;br /&gt;
&lt;br /&gt;
I want to make the mirroring with ccMixter smooth so I create a directory that matches where we have getID3 on the ccMixter server:&lt;br /&gt;
&lt;br /&gt;
 sudo mkdir /var/getid3&lt;br /&gt;
&lt;br /&gt;
Then I grab the zip from the net, unzip and do some clean up:&lt;br /&gt;
&lt;br /&gt;
 curl &amp;lt;nowiki&amp;gt;http://internap.dl.sourceforge.net/sourceforge/getid3/getid3-1.7.8b3.zip&amp;lt;/nowiki&amp;gt; &amp;gt; getid3.zip&lt;br /&gt;
 unzip getid3.zip&lt;br /&gt;
 rm getid3.zip&lt;br /&gt;
 rm -f -r demos&lt;br /&gt;
&lt;br /&gt;
==Subversion==&lt;br /&gt;
The Creative Commons code server uses Subversion. There's a very usable and worthwhile GUI on Ubuntu and a fine diff program that I get:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install subversion&lt;br /&gt;
  sudo aptitude install rapidsvn&lt;br /&gt;
  sudo aptitude install meld&lt;br /&gt;
&lt;br /&gt;
===Writable Repository Access===&lt;br /&gt;
Since I need writable access to the CC code repository, I had to register my public key with the system. &lt;br /&gt;
&lt;br /&gt;
If you only plan to do read-only updates from SVN you can skip this section entirely.&lt;br /&gt;
&lt;br /&gt;
If you already have keys registered in your system you can skip this section entirely.&lt;br /&gt;
&lt;br /&gt;
If you don't have ssh keys then you can use ssh-keygen and let the CC folks know about it to get writable access. And you can skip the rest of this section entirely.&lt;br /&gt;
&lt;br /&gt;
My key was originally generated on Windows using the Putty tools. The 'nix system prefers OpenSSH version of the key files so I had to translate the PPK (Putty) version to that. I probably could have gone back to Windows to translate these but instead I installed the 'nix version the Putty tools:&lt;br /&gt;
&lt;br /&gt;
  sudo apt-get install putty&lt;br /&gt;
&lt;br /&gt;
From my home directory I ran my key file through that to generate the OpenSSH key files:&lt;br /&gt;
&lt;br /&gt;
  puttygen -L victors_key.ppk &amp;gt; .ssh/id_dsa.pub&lt;br /&gt;
  puttygen victors_key.ppk -O private-openssh -o .ssh/id_dsa&lt;br /&gt;
 &lt;br /&gt;
The .ssh/id_dsa naming convention is magic and required, the files must be private read-only:&lt;br /&gt;
&lt;br /&gt;
  chmod 600 .ssh/id_dsa&lt;br /&gt;
  chmod 600 .ssh/id_dsa.pub&lt;br /&gt;
&lt;br /&gt;
The '''ssh-agent''' daemon was already running in my install so all I had to do was register the keys (the passphrase was prompted for):&lt;br /&gt;
&lt;br /&gt;
  ssh-add&lt;br /&gt;
&lt;br /&gt;
From this point on, all SVN access to the CC server would be done passing these keys back and forth and I never had to think about it again.&lt;br /&gt;
&lt;br /&gt;
==Getting the Code==&lt;br /&gt;
Moving to /var/www I got the code:&lt;br /&gt;
&lt;br /&gt;
  svn co svn+ssh://svn@code.creativecommons.org/svnroot/cchost/trunk cchost&lt;br /&gt;
&lt;br /&gt;
If you're only doing read-only updates then its:&lt;br /&gt;
&lt;br /&gt;
  svn co &amp;lt;nowiki&amp;gt;http://code.creativecommons.org/svnroot/cchost/trunk&amp;lt;/nowiki&amp;gt; cchost&lt;br /&gt;
&lt;br /&gt;
''IS THAT RIGHT????''&lt;br /&gt;
&lt;br /&gt;
We need 'cchost' directory writable by the web server. The group is already correct ('victor') because I created it so all we have to do is enable write by the group:&lt;br /&gt;
&lt;br /&gt;
  chmod 775 cchost&lt;br /&gt;
&lt;br /&gt;
For cchost log files we write them to a directory that is not accessible to the web. Just to make the mirroring easier I created a log directory in the same location as ccMixter's on my local machine. (The actual location is different than the one here but the steps are the same):&lt;br /&gt;
&lt;br /&gt;
  sudo mkdir /var/log/cchost&lt;br /&gt;
  sudo chgrp victor /var/log/cchost&lt;br /&gt;
  sudo chmod 775 /var/log/cchost&lt;br /&gt;
&lt;br /&gt;
==Verifying ccHost Install==&lt;br /&gt;
Finally ready to see if our setup is alive. We start by restarting Apache to get our config changes to take hold:&lt;br /&gt;
&lt;br /&gt;
  sudo /etc/init.d/apache2 restart&lt;br /&gt;
&lt;br /&gt;
Kill all instances of the browser, then browse to ''&amp;lt;nowiki&amp;gt;http://localhost/cchost&amp;lt;/nowiki&amp;gt;''&lt;br /&gt;
&lt;br /&gt;
NOTE: You may have to log out of Ubuntu or possibly reboot and get all the config stuff to take.&lt;br /&gt;
&lt;br /&gt;
That brings up the 'cchost has not been properly install...' with a link to ''ccamdin' subdirectory. Follow that link to start the install. &lt;br /&gt;
&lt;br /&gt;
After the install the '''Setting up your PHP environment''' screen tells me that ''/etc/php5/apache2/php.ini'' should be edited with different defaults and I go do that.&lt;br /&gt;
&lt;br /&gt;
Click on the 'One more thing' link. Then rename the /var/www/cchost/ccadmin to something bogus.&lt;br /&gt;
&lt;br /&gt;
Click through all the links and ccHost is up and running with defaults.&lt;br /&gt;
&lt;br /&gt;
==Import ccMixter Config==&lt;br /&gt;
&lt;br /&gt;
I have a bash script that will get the latest config from ccmixter.org and import it into the dev machine. The actual script using tons of piping in just three commands:&lt;br /&gt;
&lt;br /&gt;
 sqlite3 ~/.mozilla/firefox/vkuuxfit.default/cookies.sqlite &amp;quot;SELECT ':1',lastAccessed,':2',value FROM moz_cookies where name = 'lepsog3' and host = 'ccmixter.org'&amp;quot; | sed 's/:1|/ccmixter.org	FALSE	\/	FALSE	/; s/|:2|/	lepsog3	/' &amp;gt; ccm_cookie&lt;br /&gt;
 curl -b ccm_cookie &amp;lt;nowiki&amp;gt;http://ccmixter.org/export&amp;lt;/nowiki&amp;gt; | sed 's/ccmixter.org/cchost.org/; s/Download, Sample, Cut-up, Share./ccHost DEV SITE/' &amp;gt; cch_import&lt;br /&gt;
 cd cchost/bin&lt;br /&gt;
 php -f cc-host-config-import.php ../cch_import&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Below I break it up to annotate it.&lt;br /&gt;
&lt;br /&gt;
The first thing I want to do is call &amp;lt;nowiki&amp;gt;http://ccmixter.org/export&amp;lt;/nowiki&amp;gt; while logged in as admin. I can fake this by grabbing the ccMixter cookie out of Mozilla's Firefox. The cookie is usually in a directory like:&lt;br /&gt;
&lt;br /&gt;
  cd ~/.mozilla/firefox/vkuuxfit.default&lt;br /&gt;
&lt;br /&gt;
I run a SQL query on it with place holders to a file called 'x':&lt;br /&gt;
&lt;br /&gt;
  sqlite3 cookies.sqlite \&lt;br /&gt;
    &amp;quot;SELECT ':1',lastAccessed,':2',value FROM moz_cookies where name='lepsog3' and host='ccmixter.org'&amp;quot; \&lt;br /&gt;
    &amp;gt; /var/www/x&lt;br /&gt;
&lt;br /&gt;
I then substitute the place holders so that it forms a proper browser cookie:&lt;br /&gt;
&lt;br /&gt;
 cd /var/www&lt;br /&gt;
 cat x | sed 's/:1|/ccmixter.org'''TAB'''FALSE'''TAB'''\/'''TAB'''FALSE'''TAB'''/; s/|:2|/'''TAB'''lepsog3'''TAB/'''' &amp;gt; ccm_cookie&lt;br /&gt;
&lt;br /&gt;
NOTE: In order to make things clear in this wiki, I've bolded the tab characters - you should replace those with actual tab characters (ascii 7).&lt;br /&gt;
&lt;br /&gt;
I now have a cookie and can use curl to call over to ccMixter and get the config as if I was logged in as admin. I save it to a file called 'xx'&lt;br /&gt;
&lt;br /&gt;
  curl -b ccm_cookie &amp;lt;nowiki&amp;gt;http://ccmixter.org/export&amp;lt;/nowiki&amp;gt; &amp;gt; xx&lt;br /&gt;
  &lt;br /&gt;
The file 'xx' refers to ccmixter.org all over the place so I replace it with my dev domain. I also replace the site description in the banner so I don't forget which site I'm on (!):&lt;br /&gt;
&lt;br /&gt;
  cat xx | sed 's/ccmixter.org/cchost.org/; s/Download, Sample, Cut-up, Share./ccHost DEV SITE/' &amp;gt; cch_import&lt;br /&gt;
&lt;br /&gt;
At this point I could browse to my dev site and using the import command:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;http://cchost.org/import&amp;lt;/nowiki&amp;gt;?i=../cch_import&lt;br /&gt;
&lt;br /&gt;
but that's overkill considering we're right on the machine and can call a script that does the import:&lt;br /&gt;
&lt;br /&gt;
  cd cchost/bin&lt;br /&gt;
  php -f cc-host-config-import.php ../cch_import&lt;br /&gt;
&lt;br /&gt;
==Import ccMixter Data==&lt;br /&gt;
&lt;br /&gt;
To mirror the data I use mysqldump on the CC server, sftp the results down to my dev laptop, then import the sql file using mysql command line. I leave that part as an exercise for the reader. (Just remember to NOT transfer the cc_tbl_config table.)&lt;/div&gt;</summary>
		<author><name>Michaelkrnac</name></author>	</entry>

	</feed>