Installation of GForge is a non-trivial undertaking, since it integrates
with so many different components across your system. A skilled sysadmin 
is required to pull it off, or at the least a great deal of patience.

The result of a complete installation means automatic creation of CVS 
and Subversion repositories, and having access to them controlled by 
GForge and stats gathered from them. CVSWEB and ViewCVS (used for 
Subversion browsing) are two additional integration points.

*
*  PROFESSIONAL SUPPORT
*
*  If you need professional installation, support, etc:
*  http://gforgegroup.com/
*

BASICS OF INSTALLATION
----------------------


SEE THE NEW FILE:


INSTALL.dependencies

	Optional (but highly recommended)
	PHP Accelerator ( http://www.php-accelerator.co.uk/ )

	Optional Gantt Charting and Graphing Support:
	JPGraph: ( http://www.aditus.nu/jpgraph/ )

		(NOTE: An older version of JPGraph may be 
		required - it can be downloaded here: 
		http://gforge.org/frs/download.php/142/jpgraph-1.9.1.tar.gz)

	IPC Run for Perl may be required on some platforms and is hard to find:
	https://gforge.org/frs/download.php/143/IPC-Run-0.78.tar.gz

	ViewCVS (now called ViewVC)
	http://gforge.org/frs/download.php/152/viewvc-1.0-dev-gforge.tar.bz2


OVERVIEW
--------

GForge has a lot of different pieces touching a lot of different components
in the system. Cronjobs are required to maintain the system, touching lots 
of files on a daily and hourly basis, including /etc/* system files.

The plugins that now manage the CVS and SVN functionality have made 
installation slightly harder because even more files have to be moved into
place during installation.

The manual installation of gforge is documented below. Be sure to follow 
each step carefully, check the forums for frequently asked questions, 
and ask your Apache, mailman, and postgresql installation questions in the
corresponding mailing lists rather than on the gforge forums where little
help is available.


  CVS Overview
  ------------
  CVS is now managed via the scmcvs plugin which is included in the 
plugins/ directory in the tarball downloaded from gforge.org. Most 
of the files in scmcvs are intended for auto-installation on debian 
systems and DO NOT APPLY to the majority of users. The scmcvs plugin 
is activated by default in the gforge.sql database.

  Cronjobs for CVS are included in cronjobs/crontab.in, but are commented 
out by default for your security. cronjobs/cvs-cron/* contains the files 
that are executed hourly to build permissions and create blank cvs trees.
Make sure these files are executed as root, and have proper execution bits
set.  Each of these cronjobs has configuration parameters which you may 
have to edit manually the paths in those files for your specific system.

  CVSWeb works easily on most platforms, if you follow the instructions 
below, but the IPCRUN lib may be missing and hard to find. Download it 
here: https://gforge.org/frs/download.php/143/IPC-Run-0.78.tar.gz


  SVN Overview
  ------------

  If you want to use GForge's svn-over-DAV support, apache2 and 
mod_auth_gforge are required.

  SVN is also managed via plugin - the scmsvn plugin is included and 
activated by default in gforge.

  To install mod_auth_gforge, download it from 
http://gforge.org/frs/?group_id=128

  The sample etc/gforge-httpd.conf.example file in this tarball contains 
a COMPLETE AND WORKING vhost for subversion-over-dav. The gforge-install.sh
script will copy this to /etc/gforge/httpd.conf You may have to 
alter the passwords and any other config options, but the sample config 
shown has been used in dozens or even hundreds of installs and DOES WORK.

  Cronjobs - the /cronjobs/dav-svn/create_svn.php creates blank repositories
for subversion. You will likely have to edit this file to get the proper
SVN binary path.

  ViewCVS (ViewVC now) - this is used to browse the SVN repository. 
A modified version of ViewVC can be downloaded from GForge.org here: 
http://gforge.org/frs/download.php/152/viewvc-1.0-dev-gforge.tar.bz2
This should be built using the instructions ( ./viewcvs-install ) 
then the viewcvs.conf should be modified to recognize the svnroots

	root_parents = /svnroot : svn

  The docroot var in viewcvs.conf should also be set to the location that the 
files will be accessible from the web:

	docroot = /plugins/scmsvn/viewcvs/

  The viewcvs.cgi should then be placed in the same location as your 
cvsweb cgi (usually placed into /etc/gforge/). The /etc/gforge/local.inc 
has a path to this cgi, set in the sys_path_to_scmweb='' variable. This 
variable is shared with the cvs plugin as well, so that's why both cvsweb 
and viewcvs.cgi must be in the same location. gforge-install.sh takes care 
of this step if you have viewvc installed in /opt/viewvc

  Finally, the /usr/lib/gforge/www/plugins/scmsvn/viewcvs/ directory should 
be symlinked to the same location that you installed your viewvc/templates/docroot
gforge-install.sh takes care of this step if you have viewvc installed in /opt/viewvc

	cd /usr/lib/gforge/www/plugins/scmsvn/
	ln -s /opt/viewvc/templates/docroot viewcvs


  Apache Modules
  --------------

#
# mod_vhost_alias is used by the 
# <projectname>.projects.gforge.company.com vhosts
# which are commented out by default in the sample apache conf
# 
LoadModule vhost_alias_module modules/mod_vhost_alias.so

#
# these modules are all needed for mod_auth_gforge
#
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
LoadModule auth_gforge_module modules/mod_auth_gforge.so


  CVSTracker Overview
  -------------------
  The cvstracker plugin allows for some integration between CVS 
commits and the bug tracker and task manager. So, for example, 
when you commit, you can reference bug and task IDs in your 
commit message and have the commit linked to the corresponding
bug and task.

  This works by having a script in the cvs server issue a POST 
to the main website ( /plugins/cvstracker/newcommit.php )

  See the plugins/cvstracker/README file for details. This 
plugin is enabled by default in the gforge.sql database file. 
As with the other plugins, you may manually place the config 
files in /etc/gforge/plugins/cvstracker/ and uncomment the 
cronjob in crontab.in.

  You will also have to copy the newcommit.php file to your 
gforge www/plugins/cvstracker/ dir


  PHP
  ---
  The cronjobs require the PHP CGI to be installed and the php.ini 
file to be properly configured with your include_path OR edit the 
crontab.in file to set your include path.

  In addition, you may have to symlink /usr/bin/php to /usr/bin/php4, 
which is where the cronjobs expect your PHP CGI to be located. 
install-gforge.sh takes care of this step for you.


  Mailman
  -------

  Mailman is needed to create and use mailing lists with gforge. 
Mailman is frequently installed in /var/mailman/ and the sample 
vhost shown below will work with this setup without any changes.

  Cronjobs for mailman are located in cronjobs/mail/*

  cronjobs/mail/mailing_lists_create.php is used obviously to 
create new mailing lists. You may have to edit /etc/gforge/local.inc 
to change the location of the mailman bin/ directory.

  For all problems with mailman installation and use, contact 
the mailman mailing lists for help.



STARTING THE INSTALL
--------------------



BLANK DATABASE - FRESH INSTALL
------------------------------

First, make sure you create a 'gforge' user at the unix command prompt:

# adduser gforge

Then create a postgres account for gforge:

[root]# su - postgres

[postgres]# createuser -A -d -E -P gforge

and enter the password for the user.

You may also need to add Pl/Pgsql as a language.  To do so:

[postgres]$ createlang plpgsql template1

[postgres]$ exit

[root]# su - gforge
[gforge]# createdb gforge
[gforge]# psql gforge < db/gforge.sql > import.log

Be sure to watch for any errors during import and check the 
import.log file. For postgresql 7.3 users, you will have to 
use the db/gforge-pgsql7.3.sql file, since the postgres team 
has broken compatibility between releases yet again.

Now, find your pg_hba.conf file and edit it to include these lines:

#local    all         all                                             md5
local    all         all                                             trust

The "trust" setting is much less secure, but will be easier to 
set up for a novice.

You will have to restart postgresql after changing this line so it can 
pick up your configuration change. Usually you can restart by 

[root]# /etc/init.d/postgresql restart


UPGRADING DATABASE - EXISTING INSTALL
-------------------------------------

You will upgrade your database from a prior version by applying 
each database schema change, in order, and applying it only once.
Only apply the schema changes in the db/ folder that are dated 
AFTER your currently installed version!!

This process will apply your upgrades. BE SURE TO WATCH FOR ERRORS!

[gforge]# psql gforge < db/XXXXXXXXXX.sql >> import.log

There may also be migration scripts that have to be run. In the 
db/ folder, look for XXXXXXXXXXX.php scripts and run them AFTER
YOU HAVE SET THE php.ini for your include_path.


WEB SETUP - MANUAL INSTALLATION
-------------------------------

The following are sample commands commonly issued for a manual installation:

tar -xjf gforge-4.5.6.tar.bz2
cd gforge-4.5.6

#
#	BEFORE RUNNING THIS, determine your apacheuser/group 
#	and pass it as an argument as shown below.
#
#	Argument 1: the main hostname you want to use.
#	Argument 2: the apache user
#	Argument 3: the apache group
#	Argument 3: the IP address that you are listening on
#
./gforge-install.sh gforge.company.com apacheuser apachegroup 100.100.100.100

#
#	jpgraph install - use the 1.9.1 version from gforge.org
#	as mentioned above
#
tar -xzf jpgraph-1.9.1.tar.gz
mv jpgraph-1.9.1/src/* /usr/lib/jpgraph/

#you will have to edit jpgraph.php to set USE_CACHE=false
vim /usr/lib/jpgraph/jpgraph.php


#you will likely have to edit the cvsweb.conf file
vim /etc/gforge/plugins/scmcvs/cvsweb.conf

to change the cvsroot location:

'gforge'  => ['GForge-CVS',       '/cvsroot/'],

Now edit the gforge httpd.conf file to change the hostnames 
and IP address to match your setup.

vim /etc/gforge/httpd.conf

Apache will need to have a line added to its httpd.conf:

Include /etc/gforge/httpd.conf

Restart apache when you are done editing the file so the 
changes can be picked up.


PHP setup
---------

You may also add the include_path to the php.ini, as it will be
necessary for your php cgi to run the cron jobs. The crontab.in 
file also can be modified to include this path as well.

register_globals = On
magic_quotes_gpc = On
file_uploads = On
include_path = ".:/usr/lib/gforge/:/usr/lib/gforge/www/include/:/etc/gforge/"


FRS - File Release System
-------------------------

FRS has been radically simplified. Simply create a directory and make
it owned by the webserver-user. Usually "chown -R apache:apache mydir"
will do the trick.

This directory will be referenced in the GForge Config File as $sys_upload_dir


GForge Config File
--------------

Edit the /etc/gforge/local.inc and set any specific variables 
like sys_default_domain and any paths to files that are not right


Site Admin
----------

Site admins are anyone who is an admin of group_id=1

To give the first user "Site Admin" privileges, register a new user,
and confirm it via the email link. Then enter the postgres command
line and issue these commands:

[gforge]# psql gforge

psql> SELECT user_id FROM users WHERE user_name='******MY NEW USERNAME*********';

The result of that query will be put into this next query:

psql> insert into user_group (user_id,group_id,admin_flags) values (*****YOUR NEW NUMERIC USER ID*****,1,'A');


Mail Aliases
------------

This alias was already added by the gforge-install script:

noreply:        /dev/null


PEER RATINGS
------------

Add yourself, and any others you wish, to the "Peer Ratings" project,
which should be at /projects/peerrating/ on the website. Make yourself
an "admin" of the project, and then proceed to "rate" other users on
the website.

Members of the "Peer Ratings" project, who are "admins" of the project
become the first trusted users. This is the only way to prime the pump
for the peer ratings system.


CRON JOBS
---------

Cron jobs are in the cronjobs/ directory and the README file contains
a sample crontab. This gives you the basic cronjobs for updating
certain statistics and data on the site.

/cronjobs/cvs-cron/ contains scripts useful for creating blank cvs 
trees and managing the /etc/groups /etc/passwd and /etc/shadow files.
See /cronjobs/README.root for more info.

/cronjobs/mail/ contains files useful for the creation of new mailing 
lists in mailman and creating the /etc/aliases file.

**************************************************************************
WARNING!!! the following command will blow away any existing root crontab.
**************************************************************************

[root]# crontab cronjobs/crontab.in

Now edit the paths to the cron scripts:

[root]# crontab -e

IMPORTANT!!!! - the cvs-cron/usergroup.php cron script will meddle 
with your /etc/passwd, /etc/group, and /etc/shadow files. By default,
this cron will save these files with a .new extension. You will have 
to edit the cron script to remove the .new extension, but you must 
make sure that it is properly generating your files or your server 
could be unusable.

Once you have manually run the usergroup.php file, look at the 
/etc/*.new files and verify that they contain sensisble information.
When you are confident they are right, you can edit usergroup.php 
to remove the .new extension and uncomment the cronjobs.


JPGRAPH
-------

The installation was shown above. Be sure to use the 1.9.1 version
from gforge.org and set USE_CACHE=false as shown here.

DEFINE("USE_CACHE",false);


MOST COMMON PROBLEMS
--------------------

Q: I get a blank page when I visit http://gforge.company.com/

A: Most often you are missing the php-pgsql library that lets PHP
talk to the postgres database. Find a php-pgsql RPM or recompile 
php to have pgql support.

If you're sure you have php-pgsql support, you can edit 
common/include/database.php and remove the @ symbol from
this line:

	$conn = @pg_connect( 

So that it looks like:

	$conn = pg_connect(

This will let debug output dump to the screen and may let you find
the problem. Search the forums for more solutions.


Q: "Error Occurred In the Logger" or other database permission problems

A: As stated in the installation instructions, the database must be created, 
owned, and accessed by the gforge user. This user is the only one who will 
have total acess to all the tables. Any other user would have to be specifically 
granted permissions with the GRANT commands in postgres.


Q: Reporting or time tracking doesn't work

A: Go to the reporting tab and scroll down so you can choose 
"Initialize/Rebuild Reporting Tables"

You may also be missing GD support or be missing JPGraph or have it installed 
improperly. The jpgraph/src/ directory should be specified accurately in your 
local.inc file, and you should include a / at the end of the path specified.
In addition, you should modify jpgraph.php to set USE_CACHE=false


Q: How do I upgrade my database?

A: As stated above, you must apply the changes that are listed in date order 
in the db/ directory to your database. Only the changes that are not already 
in your old db/ directory should be applied, and they should be applied and 
checked IN ORDER.


Q: I'm getting an error about BaseLanguage.class not being found.

A: Make sure your localization path is correctly specified in the local.inc 
file and that it is readable AND writable by the apache user.


Q: When I click on "/projects/" or "/users/" links, I get the source code
instead of the page I expected.

A: As shown in the example httpd.conf files above, you may have to switch 
to using the <Files> or <Location> directives depending on your server
version.


Q: How do I backup GForge? 

A: The only proper way to backup the gforge database is with pg_dump. 
Any attempt to backup the filesystem while pgsql is running will result
in a useless and corrupt backup. You can backup CVS trees using tar as 
long as they are not actively and heavily used during the backup. 
Mailman and the FRS uploads dir can also be backed up with tar.


Q: Any time i enter an apostrophe in a text box, i get a parse error

A: As stated in the instructions above, you should have magic_quotes_gpc=On
in your php.ini file


Q: Large uploads into FRS or the doc manager fail.

A: Apache and the php.ini file need to have upload limits and possibly 
memory limits increased.



