Support #747
Install Redmine on FreeBSD
Description
- Table of contents
- Prepare the Environment
- Install MariaDB server
- Install Redmine
- Install Nginx
- Resources
This is a guide on installing Redmine with MariaDB and Nginx on FreeBSD 10.
Prepare the Environment¶
- Make sure that pkg is set to use the latest packages. Create the pkg repo config file:
mkdir -p /usr/local/etc/pkg/repos vi /usr/local/etc/pkg/repos/FreeBSD.conf
- And add the following:
FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", enabled: yes }
- And add the following:
- Make sure everything is up to date using the following command:
pkg update -f && pkg upgrade
- Create a redmine user:
pw add user -n redmine -m -s /sbin/nologin -c "Redmine"
- Install a few dependencies:
pkg install portmaster gcc llvm36 cmake scons ImageMagick rubygem-mime-types1 rubygem-sass-rails
Install MariaDB server¶
- Start by installing the mariadb100-server and mariadb100-client packages:
pkg install mariadb100-{server,client}
- Copy a base MariaDB configuration to use:
cp /usr/local/share/mysql/my-small.cnf /var/db/mysql/my.cnf
- Edit the mariadb config to change the max packet size:
vi /var/db/mysql/my.cnf
- and modify
max_allowed_packet
to 32Mmax_allowed_packet = 32M
- and modify
- Enable and start MariaDB
echo 'mysql_enable="YES"' >> /etc/rc.conf service mysql-server start
- Prepare the database for use by running the secure installation:
mysql_secure_installation
- NOTE: Choose a strong root password and answer yes to all questions.
Create MariaDB Databases and Users¶
- Login to MariaDB and create appropriate databases and users.
mysql -u root -p
- and run the following SQL queries to create the redminedb database and redmineuser user:
CREATE DATABASE redminedb CHARACTER SET utf8; CREATE USER 'redmineuser'@'localhost' IDENTIFIED BY 'SuperSecretPassword'; GRANT ALL PRIVILEGES ON redminedb.* TO 'redmineuser'@'localhost'; FLUSH PRIVILEGES; quit
- and run the following SQL queries to create the redminedb database and redmineuser user:
Install Redmine¶
- Install redmine:
portmaster www/redmine
- NOTE: Make sure to enable
[X]PASSENGER
while configuring redmine
- NOTE: Make sure to enable
- Copy config/database.yml.example to config/database.yml:
cp /usr/local/www/redmine/config/database.yml.example /usr/local/www/redmine/config/database.yml
- Edit the redmine database config:
vi /usr/local/www/redmine/config/database.yml
- And modify the production database settings:
production: adapter: mysql2 database: redminedb host: localhost username: redmineuser password: "SuperSecretPassword" encoding: utf8
- And modify the production database settings:
- Install gem dependencies:
cd /usr/local/www/redmine bundle install --without development test postgres --path vendor/bundle
- Generate a secret token:
bundle exec rake generate_secret_token
- Create the database structure:
env RAILS_ENV=production bundle exec rake db:migrate
- Change the redmine site ownership:
chown -R redmine:www /usr/local/www/redmine
Install Nginx¶
- Install nginx with passenger support:
portmaster www/nginx
- NOTE: Make sure to enable
[X]PASSENGER
while configuring nginx
- NOTE: Make sure to enable
- Install Passenger
portmaster www/rubygem-passenger
- NOTE: Make sure to enable
[X]NGINX
while configuring rubygem-passenger - NOTE: Enabling [X]SYMLINK makes upgrading passenger easier later on.
- NOTE: Make sure to enable
- Add the redmine user to the www group:
pw usermod redmine -G www
- Start and enable nginx at boot:
echo 'nginx_enable="YES"' >> /etc/rc.conf service nginx start
- Create a configuration directory to make managing individual server blocks easier
mkdir /usr/local/etc/nginx/conf.d
- Edit the main nginx config file:
vi /usr/local/etc/nginx/nginx.conf
- And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
worker_processes 1; error_log /var/log/nginx-error.log; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; # Load Phusion Passenger module globally passenger_root /usr/local/lib/ruby/gems/2.2/gems/passenger; passenger_ruby /usr/local/bin/ruby22; passenger_max_pool_size 15; passenger_pool_idle_time 300; # Load config files from the /etc/nginx/conf.d directory include /usr/local/etc/nginx/conf.d/*.conf; }
- And strip down the config file and add the include statement at the end to make it easier to handle various server blocks:
- Add a redmine.example.com server block:
vi /usr/local/etc/nginx/conf.d/redmine.example.com.conf
- Add the following:
server { listen 80; server_name redmine.example.com; root /usr/local/www/redmine/public; access_log /var/log/redmine.example.com-access.log; error_log /var/log/redmine.example.com-error.log; passenger_enabled on; passenger_user redmine; passenger_group redmine; }
- Add the following:
- Restart nginx:
service nginx restart
- Open a web browser and go to http://redmine.example.com. The admin username is admin and password is admin.
Resources¶
Updated by Daniel Curtis almost 9 years ago
- Description updated (diff)
- Status changed from New to In Progress
- % Done changed from 0 to 50
Updated by Daniel Curtis almost 9 years ago
- Description updated (diff)
- Status changed from In Progress to Resolved
- % Done changed from 50 to 100