Skip to content

Latest commit

 

History

History
333 lines (240 loc) · 6.29 KB

README.md

File metadata and controls

333 lines (240 loc) · 6.29 KB

Redmine

Redmine is a flexible project management web application written using Ruby on Rails framework.

More details can be found in the doc directory or on the official website http://www.redmine.org image

OUR Project Management Portal: https://pms.mdgportal.com/

Redmine Installation Step By Step Ubuntu 22.04

Install Required build tools and depenencies

apt install build-essential \
	ruby-dev \
	libxslt1-dev \
	libmariadb-dev \
	libxml2-dev \
	zlib1g-dev \
	imagemagick \
	libmagickwand-dev \
	curl \
	gnupg2 \
	bison \
	libbison-dev \
	libgdbm-dev \
	libncurses-dev \
	libncurses5-dev \
	libreadline-dev \
	libssl-dev \
	libyaml-dev \
	libsqlite3-dev \
	sqlite3 -y

Install Apache Web Server

apt install apache2 libapache2-mod-passenger
systemctl start apache2 && sytsemctl enable apache2

Create Redmine System User

useradd -r -m -d /opt/redmine -s /usr/bin/bash redmine

Apache web server user add to redmine group.

usermod -aG redmine www-data

Install MariaDB

apt install mariadb-server
systemctl start mariadb && systemctl enable mariadb
mysql_secure_installation

Create Redmine Database and Database User

mysql -u root -p
create database redminedb;
grant all on redminedb.* to redmineuser@localhost identified by 'password';
flush privileges;
quit;

Download and Install Redmine

Redmine Download Page

you can download and extract the redmine zip file. If you use wget Example - $VER=5.0.6 redmine version change.

curl -s https://www.redmine.org/releases/redmine-$VER.tar.gz | \ sudo -u redmine tar xz -C /opt/redmine/ --strip-components=1

Configure Redmine

Once you have installed Redmine under the /opt/redmine directory, you can now proceed to configure it.

Create Redmine Configuration files

su - redmine
 cp /opt/redmine/config/configuration.yml.example /opt/redmine/config/configuration.yml
 cp /opt/redmine/config/dispatch.fcgi.example /opt/redmine/config/dispatch.fcgi
 cp /opt/redmine/config/database.yml.example /opt/redmine/config/database.yml

Configure Database Setttings

vim /opt/redmine/config/database.yml

production: adapter: mysql2 database: redminedb host: localhost username: redmineuser password: "P@ssW0rD" # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7 encoding: utf8mb4

save and exit the file and logout redmine user

Install the Redmine Ruby Dependencies

cd /opt/redmine

Install Bundler for managing gem dependencies.

sudo gem install bundler

Next, install the required gems dependencies as redmine user.

su - redmine
bundle config set --local path 'vendor/bundle'
bundle install

Also update the gems;

bundle update

Install updated io-wait and strscan gems;

gem install io-wait strscan webrick --user-install

Generate Secret Session Token

To prevent tempering of the cookies that stores session data, you need to generate a random secret key that Rails uses to encode them.

bundle exec rake generate_secret_token

Create Database Schema Objects

Create Rails database structure by running the command below.Ensure you set the correct database credentials above.

RAILS_ENV=production bundle exec rake db:migrate

Once the database migration is done, insert default configuration data into the database by executing;

RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data

You can safely ignore the Ruby warnings.

Configure FileSystem Permissions

Ensure that the following directories are available on Redmine directory, /opt/redmine.

  • tmp and tmp/pdf
  • public and public/plugin_assets
  • log
  • files

If they do not exist, simply create them and ensure that they are owned by the user used to run Redmine.

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

Testing Redmine Installation

You can now test Redmine using WEBrick by executing the command below

su - redmine

Add webrick to Gemfile

echo 'gem "webrick"' >> Gemfile

Install webrick gem and test the installation

bundle install 
bundle exec rails server -u webrick -e production

Sample Output

=> Booting WEBrick => Rails 6.1.7.6 application starting in production http://0.0.0.0:80 => Run `bin/rails server --help` for more startup options [2023-11-12 18:54:22] INFO WEBrick 1.8.1 [2023-11-12 18:54:22] INFO ruby 3.0.2 (2021-07-07) [x86_64-linux-gnu] [2023-11-12 18:54:22] INFO WEBrick::HTTPServer#start: pid=8940 port

Navigate to the browser and enter the address, http://server-IP. Replace the server-IP accordingly.

Configure Apache For Redmine

next, create Redmine Apache VirtualHost configuration file.

Redmine Apache Configuration

Below is a sample Apache configuration for hosting Redmine on port 80.

Listen 80
<VirtualHost *:80>
    ServerName your_domain.com
    RailsEnv production
    DocumentRoot /opt/redmine/public

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

    ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
    CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined
</VirtualHost>

Disable the default site configuration.

a2dissite 000-default.conf

Check Apache configuration for errors.

apachectl configtest

Ensure that Passenger module is loaded.

apache2ctl -M | grep -i passenger
passenger_module (shared)

If not enabled, run the command below to enable it.

a2enmod passenger

Enable Redmine site.

sudo a2ensite redmine

Reload Apache

 systemctl restart apache2