I setup Knowledgetree on my WHS because I didn’t like other options and it was free. I didnt want to use the canned installation because I didn’t want Apache and openoffice running in the background taking up my ram.
KT = Knowledgetree
WHS = Windows Home Server
- Setup a shared directory for kt with duplication, in my example I am going to use DMS you can use DMS$ if you want it hidden from browsing
- Add the users that are going to use KT
- Install the WHS PHP Extension
- http://www.mediasmartserver.net/downloads/add-ins/WHSPHP_1.0.4.zip
- Install WHS MySql Extension
- http://www.mediasmartserver.net/downloads/add-ins/MySqlInstallerForWHS_0.0.8.zip
- Change your mysql root password at http://localhost/pma
- Enable curl in php.ini
- Edit c:\php5\php.ini and add extension=php_curl.dll under the other extensions
- Install SUN Java 1.6
- http://www.java.com/en/download/manual.jsp
- Download the KT Source Code its about 60mb, the Windows version.
- http://www.knowledgetree.com/products/opensource/downloadopensource
- Extract KT to d:\dms
- Add full rights for the “Windows Home Server Users” group to d:\dms
- Create a virtual directory under the default website in IIS called DMS and using d:\dms as the document root
- Disable anonymous authentication and enabled basic authentication
- Run the KT setup at http://localhost/dms
- Setup the httpsso for single sign-on to your whs users.
- http://forge.knowledgetree.com/gf/project/httpsso/
- you must first manually make the matching user in KT first.
- Scheduled Tasks
- ktscheduler – runs internal tasks
- Run: c:\php5\php.exe d:\dms\bin\scheduler.php
- Start in: d:\dms\bin
- Run As: NT AUTHORITY\SYSTEM
- Run every 15 minutes for 24 hours
- ktlucene
- Run: “C:\Program Files\Java\jre6\bin\java.exe” -jar D:\DMS\bin\luceneserver\ktlucene.jar
- Start in: D:\DMS\bin\luceneserver
- Run As: NT AUTHORITY\SYSTEM
- Run at system startup
- Uncheck the stop the task if it runs for 72 hours
- ktDbBackup
- Run: C:\php5\php.exe d:\dms\ktdbbackup.php
- Start In: d:\dms
- Run As: Administrator (needs network access for backups)
- Run every 12 hours for 24 hours
#stephen #www.stephenjc.com #kt backup for whs #dump sql backup of kt to document root #dump a quick csv to help convert files back to their original names #ktconfig $ktconfig = parse_ini_file("config/config.ini"); $mysqlLink = mysql_connect($ktconfig["dbHost"],$ktconfig["dbUser"],$ktconfig["dbPass"]); if (!$mysqlLink) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db($ktconfig["dbName"])) { echo "Unable to select mydbname: " . mysql_error(); exit; } #get document location from db $sql = 'SELECT * FROM `config_settings` WHERE item = \'documentRoot\''; $result = mysql_query($sql); if (!$result) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } if (mysql_num_rows($result) == 0) { echo "No rows found, nothing to print so am exiting"; exit; } $row = mysql_fetch_assoc($result); $docHome = $row["value"]; #dump database to document root system('mysqldump --user ' . $ktconfig["dbAdminUser"] . ' --password=' . $ktconfig["dbAdminPass"] . ' ' . $ktconfig["dbName"] . ' >' . $docHome . '\ktdbbackup.sql');
#create csv to restore original documents just in case
$sql = 'select * from documents, document_content_version, users where documents.status_id = 1 and document_content_version.document_id = documents.id and documents.creator_id = users.id';
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
$mycsvBackup = $docHome . "\ktbackup.csv";
$fh = fopen($mycsvBackup, 'w');
fwrite($fh,"Original_Name,KT_StoragePath,Owner,md5hash\n");
while ($row = mysql_fetch_assoc($result)) {
fwrite($fh,$row["filename"] . "," . $row["storage_path"] . "," . $row["username"] . "," . $row["md5hash"] . " \n");
}
fclose($fh);
?>