Menu Home

Install Redmine 3.4 on FreeBSD 11.2 with Apache, Passenger and MySQL

TLDR for Redmine on FreeBSD 11.2

install redmine and a bunch of dependencies

UPDATE 2019/03/11 redmine pkg is currently not available on quaterly mirror (make sure you use latest branch in /etc/pkg/FreeBSD.conf)

pkg install redmine apache24 mysql56-server mysql56-client rubygem-passenger-apache
vim /usr/local/etc/apache24/httpd.conf

add the following lines to your httpd.conf or Inlcudes/redmine.conf

LoadModule passenger_module /usr/local/lib/ruby/gems/2.4/gems/passenger-6.0.0/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/2.4/gems/passenger-6.0.0
PassengerRuby /usr/local/bin/ruby24

#to use ssl uncomment the following lines and set Listen port to 443
#LoadModule ssl_module libexec/apache24/mod_ssl.so
#SSLEngine on
#SSLCertificateFile "/usr/local/etc/apache24/YOUR_SSL.crt"
#SSLCertificateKeyFile "/usr/local/etc/apache24/YOUR_SSL.key"

RailsEnv production
PassengerDefaultUser www
DocumentRoot /usr/local/www/redmine/public/
<Directory "/usr/local/www/redmine/public/">
    Allow from all
    Options -MultiViews
    Require all granted
</Directory>

enable the MySQL server

sysrc mysql_enable=YES
service mysql-server start
mysql -u root

If the authorization fails, check MySQL installation docs for FreeBSD (you might need to use the /root/.mysql_secret for -p option)

CREATE DATABASE redmine CHARACTER SET utf8;
#CREATE DATABASE redmine_dev CHARACTER SET utf8;
#CREATE DATABASE redmine_test CHARACTER SET utf8;

CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'YourRedminePassword';

GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
#GRANT ALL PRIVILEGES ON redmine_dev.* TO 'redmine'@'localhost';
#GRANT ALL PRIVILEGES ON redmine_test.* TO 'redmine'@'localhost';
FLUSH PRIVILEGES;

configure the database connector

vim /usr/local/www/redmine/config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: YourRedminePassword
  encoding: utf8

test:
  adapter: mysql2
  database: redmine_test
  host: localhost
  username: redmine
  password: YourRedminePassword
  encoding: utf8

development:
  adapter: mysql2
  database: redmine_dev
  host: localhost
  username: redmine
  password: YourRedminePassword
  encoding: utf8

do some magic ruby $#!+ and set permissions

cd /usr/local/www/redmine/
bundle install --without development test
bundle exec rake generate_secret_token
setenv RAILS_ENV production
setenv REDMINE_LANG en
bundle exec rake db:migrate
bundle exec rake redmine:load_default_data
mkdir -p tmp tmp/pdf public/plugin_assets
chown -R www:www files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets
find files log tmp public/plugin_assets -type f -exec chmod -x {} +

for testing: spawn ruby webserver

bundle exec rails server webrick -e production

for production: enable and start apache24

sysrc apache24_enable=YES
service apache24 start

Post Installation

Please make sure you set a password for mysql root, disable remote login (mysq_secure_installation) etc. (I dont’t want write to install guide #362672 so just look at HowToForge)

Categories: freebsd

hackacad