Skip to content

Instantly share code, notes, and snippets.

@DarkVss
Last active April 11, 2023 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DarkVss/30bbbab5017154261087ccd96a510226 to your computer and use it in GitHub Desktop.
Save DarkVss/30bbbab5017154261087ccd96a510226 to your computer and use it in GitHub Desktop.
Redmine installation on Debian family distributives

Redmine

Prepare packages

apt-get update -y
apt-get install apt-transport-https ca-certificates dirmngr gnupg2 -y
apt-get install apache2 apache2-dev libapache2-mod-passenger mariadb-server mariadb-client build-essential ruby-dev libxslt1-dev libmariadb-dev libxml2-dev zlib1g-dev imagemagick libmagickwand-dev curl -y

Prepare Redmine app

useradd -r -m -d /opt/redmine -s /usr/bin/bash redmine
usermod -aG www-data redmine
su - redmine
curl https://www.redmine.org/releases/redmine-5.0.0.tar.gz -o redmine.tar.gz
tar -xvzf redmine.tar.gz -C /opt/redmine/ --strip-components=1
cp /opt/redmine/config/configuration.yml{.example,}
cp /opt/redmine/public/dispatch.fcgi{.example,}
cp /opt/redmine/config/database.yml{.example,}
vi /opt/redmine/config/database.yml

Setup next config block

production:
  adapter: mysql2
  database: db_redmine
  host: localhost
  username: usr_redmine
  password: "password"

Prepare Ruby gems

exit
cd /opt/redmine
gem install bundler
su - redmine
bundle install --without development test --path vendor/bundle
bundle exec rake generate_secret_token

Prepare dabatase

exit
mysql

Create database

CREATE DATABASE db_redmine CHARACTER SET utf8mb4;
GRANT ALL PRIVILEGES ON db_redmine.* TO 'usr_redmine'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;

Start migrations

su - redmine
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data

Prepare directories

for i in tmp tmp/pdf public/plugin_assets; do [ -d $i ] || mkdir -p $i; done
chown -R redmine:redmine files log tmp public/plugin_assets
chmod -R 755 /opt/redmine
exit

Setup Apache2

Open config file

vi /etc/apache2/sites-available/redmine.conf

Write config

<VirtualHost *:80>
	ServerName redmine.local
	RailsEnv production
	DocumentRoot /opt/redmine/public

	<Directory "/opt/redmine/public">
	        Allow from all
	        Require all granted
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/redmine.local__error.log
    CustomLog ${APACHE_LOG_DIR}/redmine.local__access.log combined
</VirtualHost>

Update Apache2 instance confs

a2ensite redmine
systemctl reload apache2

Compliting

Go to http://redmine.local into some browser

Login Password
admin admin

Additional setup

Email notification

sudo su
vi /opt/redmine/config/configuration.yml

Setup next config block

default:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      ssl: true
      address: smtp.yandex.ru
      port: 465
      domain: redmine.local
      authentication: :login
      user_name: redmine@redmine.local
      password: password
      enable_starttls_auto: true
      openssl_verify_mode: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment