Support #747
Updated by Daniel Curtis almost 9 years ago
{{>toc}} This is a guide on installing Redmine with MariaDB and Nginx on FreeBSD 9. h2. Prepare the Environment * Before installation of the components, make sure everything is up to date using the following command: <pre> pkg update -f && pkg upgrade </pre> * Install portmaster: <pre> pkg install portmaster pkg2ng </pre> * Create a redmine user: <pre> pw add user -n redmine -m -s /bin/sh -c "Redmine" </pre> h2. Install Nginx * Install nginx with passenger support: <pre> portmaster www/nginx </pre> #* *NOTE*: Make sure to enable *@[X]PASSENGER@* while configuring _nginx_ * Install Passenger <pre> portmaster www/rubygem-passenger </pre> #* *NOTE*: Make sure to enable *@[X]NGINX@* while configuring rubygem-passenger #* *NOTE*: Enabling *[X]SYMLINK* makes upgrading passenger easier later on. * Add the redmine user to the www group: <pre> pw usermod redmine -G www </pre> * Start and enable nginx at boot: <pre> echo 'nginx_enable="YES"' >> /etc/rc.conf service nginx start </pre> * Create a configuration directory to make managing individual server blocks easier <pre> mkdir /usr/local/etc/nginx/conf.d </pre> * Edit the main nginx config file: <pre> vi /usr/local/etc/nginx/nginx.conf </pre> #* And strip down the config file and add the include statement at the end to make it easier to handle various server blocks: <pre> 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.1/gems/passenger; passenger_ruby /usr/local/bin/ruby21; 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; } </pre> * Restart nginx: <pre> service nginx restart </pre> --- h2. h1. Install MariaDB server * Start by installing the mariadb100-server and mariadb100-client packages: <pre> pkg install mariadb100-{server,client} </pre> * Copy a base MariaDB configuration to use: <pre> cp /usr/local/share/mysql/my-small.cnf /var/db/mysql/my.cnf </pre> * Edit the mariadb config to change the max packet size: <pre> vi /var/db/mysql/my.cnf </pre> #* and modify @max_allowed_packet@ to 32M <pre> max_allowed_packet = 32M </pre> * Enable and start MariaDB <pre> echo 'mysql_enable="YES"' >> /etc/rc.conf service mysql-server start </pre> * Prepare the database Database for use by running the secure installation: <pre> mysql_secure_installation </pre> #* *NOTE*: +Choose a strong root password+ and answer +yes+ to all questions. h3. Create MariaDB Databases and Users * Login to MariaDB and create appropriate databases and users. <pre> mysql -u root -p </pre> #* and run the following SQL queries to create the *redminedb* database and *redmineuser* user: <pre> CREATE DATABASE redminedb CHARACTER SET utf8; CREATE USER 'redmineuser'@'localhost' IDENTIFIED BY 'SuperSecretPassword'; GRANT ALL PRIVILEGES ON redminedb.* TO 'redmineuser'@'localhost'; FLUSH PRIVILEGES; quit </pre> --- h2. Install Redmine * Install redmine: <pre> portmaster www/redmine </pre> #* *NOTE*: Make sure to enable *@[X]PASSENGER@* while configuring redmine * Change the redmine site ownership: <pre> chown -R redmine:www /usr/local/www/redmine </pre> * Add a *redmine.example.com server block*: <pre> vi /usr/local/etc/nginx/conf.d/redmine.example.com.conf </pre> #* Add the following: <pre> 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 www; } </pre> * Restart nginx to load the website config: <pre> service nginx restart </pre>