Home / Articles / BSD / FreeBSD / Install Redmine as FastCGI for Apache in FreeBSD

Install Redmine as FastCGI for Apache in FreeBSD

Install Redmine as FastCGI for Apache in FreeBSD
 
Install Redmine as FastCGI for Apache in FreeBSD
  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 5/5 (4 votes cast)

Thank you for rating!

You have already rated this page, you can only rate it once!

Your rating has been changed, thanks for rating!

Log in or create a user account to rate this page.


Before you begin installation and configuration you already need to have Apache and MySQL which have to be installed and configured on the server. If you don't have them, then you can do this by these examples: Apache and MySQL server.

These steps and instructions were done in FreeBSD 9.


Downloading Redmine

Download the latest version of Redmine from official site www.redmine.org. And place it here: /usr/local/www/apache22.

But, it is recommended to download by SVN, this gives you a possibility to update Redmine very quickly without re-install it. To do it you should have SVN in your system, if you don't have SVN you can install it by running following command:

cd /usr/ports/devel/subversion && make install clean

Then take code from official site to download it by SVN and run it:

cd /usr/local/www/apache22
svn co http://redmine.rubyforge.org/svn/branches/2.0-stable redmine

Install Ruby and Ruby Gems

cd /usr/ports/devel/ruby-gems && make install clean

Install ImageMagick

cd /usr/ports/graphics/ImageMagick && make install clean

In the appeared menu, leave default options.

Adding a support Iconv and FastCGI for Ruby

cd /usr/ports/converters/ruby-iconv && make install
cd /usr/ports/www/ruby-fcgi && make install

Install RubyGems components

To make "gem" command available you need to re-open terminal (exit and log in again).

gem install bundler

To make "bundle" command available you need to re-open terminal (exit and log in again).

cd /usr/local/www/apache22/redmine
bundle install --without development test postgresql sqlite

cd /usr/ports/www/fcgi && make install clean
gem install iconv -- --with-iconv-include=/usr/local/include --with-iconv-lib=/usr/local/lib
gem install fcgi -- --with-fcgi-include=/usr/local/include --with-fcgi-lib=/usr/local/lib

Then re-open terminal again.

Install and configure FastCGI module for Apache

cd /usr/ports/www/mod_fastcgi && make install clean

Configure Apache for Redmine

Add the following lines in /usr/local/etc/apache22/httpd.conf file, but be very attentive, you can't put them before "User www" and "Group www" it can produce errors.

<IfModule mod_fastcgi.c>
  FastCgiIpcDir /var/run/fastcgi
</IfModule>

Uncomment the lines in /usr/local/etc/apache22/httpd.conf:

LoadModule fastcgi_module libexec/apache22/mod_fastcgi.so
Include etc/apache22/extra/httpd-vhosts.conf

Add the following lines at the end of /usr/local/etc/apache22/extra/httpd-vhosts.conf file:

<VirtualHost *:80>
  ServerAdmin yourmail@example.com
  DocumentRoot "/usr/local/www/apache22/redmine/public"
  ServerName myredmine.example.com

  FastCgiServer /usr/local/www/apache22/redmine/public/dispatch.fcgi -idle-timeout 120 -initial-env RAILS_ENV=production -initial-env PATH=/usr/local/bin -processes 2

  <Directory "/usr/local/www/apache22/redmine/public/">
    AddHandler fastcgi-script fcgi
    Order allow,deny
    Allow from all
    AllowOverride all
    Options +FollowSymLinks +ExecCGI
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ dispatch.fcgi
  </Directory>

  ErrorLog "/var/log/myredmine.example.com-error_log"
  CustomLog "/var/log/myredmine.example.com-access_log" common
</VirtualHost>

Where:

  • "yourmail@example.com" is your email or the email of server administrator;
  •  "myredmine.example.com" is hostname which is pointer to your server and will be used to get an access to your Redmine system.

If you don't have the registered and pointed hostname you can set it in local PC which you are going to use to get an access to your Redmine system. You can do it like here.

Create database with user in MySQL

Log in like the superuser in MySQL:

mysql -u root -p

After this run the following query:

CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

Where "my_password" should be replaced by your own password for user "redmine" in MySQL.

Configure Redmine

To set database for Redmine, run the following commands: 

cd /usr/local/www/apache22/redmine/config
cp database.yml.example database.yml

Change the following lines in /usr/local/www/apache22/redmine/config/database.yml file:

production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: my_password

Be very attentive, don't forget to replace "my_password" on your own password which you used for create user in MySQL above.

Before you do run next commands, you need to find out a shell type. You can do it by running the following command:

echo $SHELL

Run only the first command if you use "csh" shell, or run only the second command if you use "bash":

setenv RAILS_ENV production
export RAILS_ENV=production

Now you need to generate a session store secret then create the database structure and insert default configuration data in database:

cd /usr/local/www/apache22/redmine
rake generate_secret_token
rake db:migrate
rake redmine:load_default_data

Set permissions for Redmine directories:

cd /usr/local/www/apache22/redmine/public
mkdir plugin_assets
cd /usr/local/www/apache22/redmine
chown -R www:www files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets

Choose a type of launching (FastCGI):

cd /usr/local/www/apache22/redmine/public
cp dispatch.fcgi.example dispatch.fcgi

Set an email configuration:

cd /usr/local/www/apache22/redmine/config
cp configuration.yml.example configuration.yml

Add the following lines in /usr/local/www/apache22/redmine/config/configuration.yml file:

production:
  email_delivery:
    delivery_method: :sendmail

But, be very attentive, the "production:" row mustn't have any characters: spaces or tabs.

First launching of Redmine

Restart Apache to apply changes in configuration files:

/usr/local/etc/rc.d/apache22 restart

Open your browser and run "http://myredmine.example.com" or your hostname if it is different than in this example.

Login: admin
Password: admin


 

Read also

Install Apache in FreeBSD

Install Apache in FreeBSD

Install MySQL server on FreeBSD

Install MySQL server on FreeBSD

Log in or create a user account to post a comment.

easyos.net
117217982212577402640

Quick navigation

General navigation