rodrigc@
Developer
The following HOWTO describes step-by-step how to set up Redmine under FreeBSD.
PREPARATION
INSTALL NGINX PORT
INSTALL REDMINE PORT
CONFIGURE NGINX
INSTALLING POSTGRES
CONFIGURE REDMINE
Log rotation
Add the following line to /etc/newsyslog.conf
See the following link for more information about rotating Redmine logs:
http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Logging-configuration
START NGINX
FURTHER REFERENCES
PREPARATION
- Add a redmine user with the adduser utility.
# adduser
- Before building any of the Ruby ports, make sure that the locale is set properly. For example, if we are using the en_US.UTF-8 locale:
For sh, ksh, zsh, bash:
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
or for csh, tcsh:
setenv LANG en_US.UTF-8
setenv LC_ALL en_US.UTF-8
If you run the locale command, you should see something like:
Code:[cmd]locale[/cmd] LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_ALL=en_US.UTF-8
If all these variables are not set properly, you may see weird failures when building RubyGems from ports, such as mail/rubygem-mail. - Update your ports tree.
portsnap fetch
portsnap extract
- Make sure that ports-mgmt/portmaster is installed:
cd /usr/ports/ports-mgmt/portmaster
make
make install
make clean
INSTALL NGINX PORT
- Configure the Nginx port, build it, and install it.
portmaster --force-config www/nginx
- Make sure that PASSENGER is enabled in the Nginx options. PASSENGER is used to run Ruby on Rails applications.
INSTALL REDMINE PORT
- Configure, build, and install the Redmine port.
portmaster --force-config www/redmine
- In the config, make sure that PASSENGER is enabled in the options, and THIN is unchecked.
- After the config is done, the Redmine port and dependent ports will be built.
- When the rubygem-passenger port is built, make sure that Build with nginx support is checked.
- When the rubygem-rails port is built, make sure that FastCGI backend and Passenger backend are checked.
- Install RubyGem to interface with PostgreSQL:
portmaster --force-config databases/rubygem-pg
CONFIGURE NGINX
- Run the following command to determine where the root directory of the Passenger gem is:
passenger-config --root
- Edit /usr/local/etc/nginx/nginx.conf and make sure the following lines are in the config:
Code:http { ... passenger_root /usr/local/lib/ruby/gems/1.9/gems/passenger-4.0.10; passenger_ruby /usr/local/bin/ruby19; passenger_user redmine; passenger_group redmine; server { listen 80; ... location / { root /usr/local/www/redmine/public; passenger_enabled on; } ... }
- Make sure that everything under /usr/local/www/redmine is owned by the redmine user:
# chmod -R redmine:redmine /usr/local/www/redmine
- Add to /etc/rc.conf:
Code:nginx_enable="YES"
INSTALLING POSTGRES
- Find out what version of the PostgreSQL client was installed, due to dependencies on previously installed ports.
# pkg info -g 'postgresql*'
- Install the PostgreSQL server of the same version as the client which is installed. If postgresql90-client is installed, then:
# portmaster --force-config databases/postgresql90-server
- Add to /etc/rc.conf:
Code:postgresql_enable="YES"
- Initialize the PostgreSQL database and start it:
# service postgresql initdb
# service postgresql start
- Log in as the pgsql user:
# su pgsql
- Create a database:
# /usr/local/bin/createdb redminedb
- Set a password for the pgsql user.
passwd
CONFIGURE REDMINE
- Create a database.yml file.
# cp /usr/local/www/redmine/config/database.yml.example /usr/local/www/redmine/config/database.yml
- Add the following config section to database.yml:
Code:# PostgreSQL configuration example production: adapter: postgresql database: redminedb host: localhost username: pgsql password: my_password encoding: utf8
- Follow the setup instructions at the Redmine setup instructions at: http://www.redmine.org/wiki/redmine/RedmineInstall
Log rotation
Add the following line to /etc/newsyslog.conf
Code:
/usr/local/www/redmine/log/production.log 644 3 3000 * J
See the following link for more information about rotating Redmine logs:
http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Logging-configuration
START NGINX
- Start Nginx:
# service start nginx
- Make sure that Passenger is running properly:
passenger-status
passenger-memory-stats
- Test the Redmine installation by accessing your installation at http://localhost.
FURTHER REFERENCES
- Redmine installation documentation: http://www.redmine.org/wiki/redmine/RedmineInstall
- Redmine install notes: http://daemon-notes.com/articles/web/redmine/configuration
- Passenger documentation: http://www.modrails.com/documentation/Users guide Nginx.html
- PostgreSQL install notes: http://www.freebsddiary.org/postgresql.php