Difference between revisions of "Installing FGdb"

From FreekiWiki
Jump to navigation Jump to search
(add title)
 
(54 intermediate revisions by 8 users not shown)
Line 1: Line 1:
FGdb is actively being developed. There are some quirks in getting it up and running that will get worked out over time. For now, however, these instructions should let anyone with a FreekBox install without too much trouble. For those without a FreekBox, these instructions might also be useful. (In that case, you'll want to start with a standard woody based debian install, and you may need to run down some extra dependencies.)
+
[http://git.freegeek.org/?p=fgdb.rb;a=blob_plain;f=doc/README_FOR_APP;hb=HEAD README_FOR_APP]
  
NOTE: This still refers to a lot of MySQL stuff. We're now using PostgreSQL and will need to change all that.
+
[[Category: Coders]][[Category: FGdb]]
=Set up=
 
* Start with a FreekBox or a base server from Free Geek. ''(Since this is based on debian sarge, any sarge box should do, but there might be additional packages you need to install.)''
 
* Become root
 
* Change the hostname of your freekbox to something you want. (For the some of the examples in these instructions, we use the name 'database' as the hostname.):
 
# hostname YOUR_HOSTNAME_HERE
 
and edit /etc/hostname to match.
 
* Then edit /etc/hosts to say YOUR_HOSTNAME_HERE instead of freekbox as well.
 
* Bring up networking
 
database:/etc/apache# ifup eth0
 
 
 
=Package installation=
 
* Now update and install all the needed packages:
 
database:/etc/apache# apt-get update
 
database:/etc/apache# apt-get install smarty libphp-adodb php4 apache vim postgresql postgresql-cliend php4-mysql php4-pgsql rsync
 
(You don't really need vim in there, but I find it easier to use than the nvi or whatever is already on the FreekBox.) The above commands will pull in dependencies, depending on what you already have installed on the box.
 
* You can allow the install to reconfigure apache to use PHP or do it yourself according to instructions.
 
 
 
=Apache configuration=
 
* Now make *certain* that apache is configured correctly by editing /etc/apache/httpd.conf.
 
Uncomment the lines:
 
AddType application/x-httpd-php .php
 
AddType application/x-httpd-php-source .phps
 
Also, uncomment the line:
 
LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
 
Now make sure the document root is set to:
 
DocumentRoot /var/www/html
 
And be sure to include index.php in your directory index:
 
DirectoryIndex index.php index.html index.htm index.shtml index.cgi
 
* Save your changes, and then perform this SANITY CHECK:
 
database:/etc/apache# grep php httpd.conf
 
LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
 
    DirectoryIndex index.php index.html index.htm index.shtml index.cgi
 
    # distribution - see http://www.php.net) will typically use:
 
    #AddType application/x-httpd-php3 .php3
 
    #AddType application/x-httpd-php3-source .phps
 
    AddType application/x-httpd-php .php
 
    AddType application/x-httpd-php-source .phps
 
 
 
If your config files doesn't look something like that, fix it before proceeding.
 
 
 
=Getting FGdb=
 
* Now check out the fgdb and fglib projects from CVS. Here's a "read-only" way:
 
 
 
Create a temporary directory (I did this in root's home):
 
database:/etc/apache# cd ~
 
database:/etc/apache# mkdir freegeekdatabase
 
database:/etc/apache# cd freegeekdatabase
 
 
 
Now check out the projects:
 
database:/etc/apache# cvs -d :pserver:anoncvs@cvs.freegeek.org:/var/lib/cvs co fgdb fglib
 
 
 
* At this point, you might want to look at the version of this documenation (in the fgdb/doc directory) to see if it's changed at all.
 
 
 
=Installing an configuring FGdb=
 
* Go to the fglib directory and run the install script
 
database:/etc/apache# cd fglib
 
database:/etc/apache# ./install.sh
 
* Go to the fgdb directory and run the install script
 
database:/etc/apache# cd ../fgdb
 
database:/etc/apache# ./install.sh
 
* The installation script will create a configuration directory called /etc/fgdb/. Go to that directory:
 
database:/etc/apache# cd /etc/fgdb
 
* There should be three files there (db.inc.php fgdb.inc.php fgdbconnection.php). If they're not there, copy them in from the conf directory of the fgdb project.
 
 
 
fgdb.inc.php:
 
<?php
 
$mode='TEST';
 
$base_url='http://flowers/fgdb';
 
$howto_base = 'http://web.freegeek.org/howto';
 
?>
 
 
 
db.inc.php:
 
<?php
 
$dbtype='mysql';
 
$hostname='localhost';
 
$userid='DB_USERNAME_HERE';
 
$passwd='DB_PASSWORD_HERE';
 
$database='DB_NAME_HERE';
 
?>
 
 
 
fgdbconnection.php:
 
<?php
 
require_once("/etc/fgdb/db.inc.php");
 
require_once("adodb/adodb.inc.php");
 
require_once("adodb/drivers/adodb-mysql.inc.php");
 
global $userid, $passwd;
 
//
 
// FGDBConnection
 
//
 
class FGDBConnection extends ADODB_mysql
 
{
 
    // override the generic member var connection parameters
 
    // with Free Geek DB specific ones
 
    var $database = "DB_NAME_HERE";
 
    var $host = "localhost";
 
    var $user = 'DB_USERNAME_HERE';
 
    var $password = 'DB_PASSWORD_HERE';
 
    var $dbtype = "mysql";
 
}
 
?>
 
 
 
=Getting the database set up=
 
* After editing the above files, so that the placeholders contain your real values, the software is now installed and configured. However, you need to get the database itself set up.
 
database:/etc/apache# mysql
 
Welcome to the MySQL monitor.  Commands end with ; or \g.
 
Your MySQL connection id is 3 to server version: 3.23.49-log
 
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
 
 
mysql> create database DB_NAME_HERE;
 
Query OK, 1 row affected (0.00 sec)
 
 
 
mysql> GRANT ALL PRIVILEGES ON DB_NAME_HERE.* TO 'DB_USERNAME_HERE'@'localhost' IDENTIFIED BY 'DB_PASSWORD_HERE' WITH GRANT OPTION;
 
 
 
Query OK, 0 rows affected (0.01 sec)
 
 
 
* Now populate the database:
 
database:~# cd ~/freegeekdatabase/fgdb/sql/
 
database:~/freegeekdatabase/fgdb/sql# mysql DB_NAME_HERE < fgdbinit.sql
 
* Edit php.ini to have the correct include_path:
 
database:/etc/apache# cd /etc/php4/apache/       
 
database:/etc/php4/apache# vi php.ini
 
include_path = ".:/var/www/php/includes:/usr/share:/usr/share/php:/usr/lib"
 
 
 
=Final touches=
 
* Now, restart apache
 
database:/etc/apache# /etc/init.d/apache restart
 
Reloading apache modules[Wed Mar 17 17:39:29 2004] [alert]
 
apache: Could not determine the server's fully qualified domain
 
name, using 127.0.0.1 for ServerName
 
* Point your browser to the database: http://YOUR_HOSTNAME_HERE/fgdb/
 
* That should show you the main page to the FGdb database application.
 

Latest revision as of 14:08, 26 November 2009