Ubuntu 24.04 プロジェクト管理ツール Redmine をインストールする方法

2024年8月20日

環境
Ubuntu 24.04
Apache2
PostgreSQL

1.必要なパッケージをインストールしておきます。

# apt -y install ruby-dev postgresql-server-dev-all libxslt1-dev libxml2-dev libpq-dev libcurl4-openssl-dev zlib1g-dev apache2-dev gcc g++ make patch imagemagick

2.Redmine 用のユーザーとデータベースを作成します。
# [password] は任意のパスワードを設定

# su - postgres
$ createuser redmine
$ createdb redmine -O redmine
$ psql -c "alter user redmine with password 'password'"
ALTER ROLE

3.Redmine をダウンロードしてインストールします。最新版を確認してダウンロードしてください。
⇒ http://www.redmine.org/projects/redmine/wiki/Download
# curl -O https://www.redmine.org/releases/redmine-5.1.3.tar.gz
# tar zxvf redmine-5.1.3.tar.gz
# mv redmine-5.1.3 /var/www/redmine
# cd /var/www/redmine
# vi config/database.yml

#以下の内容で新規作成
production:
  adapter: postgresql
  # データベース名
  database: redmine
  host: localhost
  # データベースユーザー
  username: redmine
  # データベースユーザーのパスワード
  password: password
  encoding: utf8

# vi config/configuration.yml
# 以下の内容で新規作成 (SMTP の設定)

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "localhost"
      port: 25
      domain: 'arkgame.com'

# bundler インストール
# gem install bundler

Redmine で使用する Gem をインストール

# bundle config set --local without 'development test mysql sqlite'
# bundle install

# 秘密鍵の生成
# bundle exec rake generate_secret_token
# テーブル生成
# bundle exec rake db:migrate RAILS_ENV=production
# Passenger インストール
# gem install passenger
# Apache2 用モジュールインストール

# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v6.0.22.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.

.....
.....

--------------------------------------------
Almost there!

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /var/lib/gems/3.2.0/gems/passenger-6.0.22/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /var/lib/gems/3.2.0/gems/passenger-6.0.22
     PassengerDefaultRuby /usr/bin/ruby3.2
   </IfModule>

After you restart Apache, you are ready to deploy any number of web
applications on Apache, with a minimum amount of configuration!

Press ENTER when you are done editing.

--------------------------------------------

Validating installation...

 * Checking whether this Passenger install is in PATH... 
 * Checking whether there are no other Passenger installations... 
 * Checking whether Apache is installed... 
 * Checking whether the Passenger module is correctly configured in Apache... (!)

   You did not specify 'LoadModule passenger_module' in any of your Apache
   configuration files. Please paste the configuration snippet that this
   installer printed earlier, into one of your Apache configuration files, such
   as /etc/apache2/apache2.conf.


Detected 0 error(s), 1 warning(s).
Press ENTER to continue.

--------------------------------------------

Deploying a web application

To learn how to deploy a web app on Passenger, please follow the deployment
guide:

  https://www.phusionpassenger.com/library/deploy/apache/deploy/

Enjoy Phusion Passenger, a product of Phusion® (www.phusion.nl) :-)
https://www.phusionpassenger.com

4.Passenger を実行するための Apache2 の設定です。当例ではバーチャルホスト環境で設定します。
# vi /etc/apache2/conf-available/passenger.conf
# 以下の内容で新規作成

SetEnv LD_LIBRARY_PATH /usr/lib64
LoadModule passenger_module /var/lib/gems/3.2.0/gems/passenger-6.0.22/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
    PassengerRoot /var/lib/gems/3.2.0/gems/passenger-6.0.22
    PassengerDefaultRuby /usr/bin/ruby3.2
</IfModule>

<VirtualHost *:80>
    ServerName redmine.arkgame.com
    DocumentRoot /var/www/redmine/public
</VirtualHost>

<Directory "/var/www/redmine/public">
    Options FollowSymLinks
    AllowOverride All
</Directory>

# chown -R www-data:www-data /var/www/redmine
# a2enconf passenger

apache2を再起動します

# systemctl reload apache2

 

IT

Posted by arkgame