0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

岩舘電気の中の人が Redmine 4 から 6 へバージョンアップしたメモ

0
Last updated at Posted at 2026-03-07

岩舘電気では、ウエブからの問い合わせを管理するのに Redmine を使っています。
もともとは Windows 上に Bitnami Redmine stack 4.2.2 をサクッっとインストールし長年使っていましたが、重い腰を上げて Ubuntu Sever 24 minimized 上に docker で 6系 を入れ環境移行したので手順を公開します。ただしテーマやプラグインなどはここでは扱いません。

移行先作成

Ubuntu server 24 minimized をインストールした移行先サーバに docker をインストール

bash
sudo apt update
sudo apt install ca-certificates curl gnupg -y
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo $VERSION_CODENAME) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

sudo systemctl enable docker

Redmine インストール先ディレクトリ作成。

bash
mkdir redmine
cd redmine

docker-compose.yml を編集。

docker-compose.yml
services:
  db:
    image: mariadb:11
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: redmine
      MYSQL_DATABASE: redmine
      MYSQL_USER: redmine
      MYSQL_PASSWORD: redmine
    volumes:
      - db_data:/var/lib/mysql

  redmine:
    image: redmine:6
    restart: always
    ports:
      - "80:3000"
    environment:
      REDMINE_DB_MYSQL: db
      REDMINE_DB_USERNAME: redmine
      REDMINE_DB_PASSWORD: redmine
    depends_on:
      - db
    volumes:
      - ./files:/usr/src/redmine/files
      - ./configuration.yml:/usr/src/redmine/config/configuration.yml

volumes:
  db_data:

configuration.yml を編集しメールの取得設定をしておきます。your.smtp.jp your.e-maildomain.jp sender-username sender-password は適宜読み替えてください。

configuration.yml
default:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "your.smtp.jp"
      port: 587
      domain: 'your.e-maildomain.jp'
      authentication: :login
      user_name: 'sender-username'
      password: 'sender-password'
      enable_starttls_auto: true

Redmine 起動

bash
docker compose up -d

ブラウザでhttp://ip-address にアクセスし、 Redmine が動いていることを確認します。

移行元からデータ抽出

続いて、移行元からデータを抽出

cmd
cd C:\Bitnami\redmine-4.2.2-1\mysql\bin
mysqldump -u bitnami -p --default-character-set=utf8mb4 --no-tablespaces bitnami_redmine > C:\temp\backup.sql
(DB の password が求められるので入力)

得られた backup.sql と、C:\Bitnami\redmine-4.2.2-1\apps\redmine\htdocs\files にあるファイルを、移行先のサーバにコピーします。フォルダ名はバージョンに合わせて読み替えてください。
なお files フォルダには4桁の西暦の入ったフォルダが並んでいるはずです。
ここでは、~/redmine/migrationbackup.sql を、files フォルダを ~/redmine/files にコピーしたものとします。

データのインポート

移行先のパーミッションを調整します。

bash
cd ~/redmine
sudo chown -R 999:999 ~/redmine/files
sudo chmod -R 755 ~/redmine/files

DBインポート。

bash
sudo docker compose exec -T db mariadb -u root -predmine redmine < migration/backup.sql

Rails の Migration を実行しデータベースのスキーマを ver.6 用に移行します。

bash
sudo docker compose exec redmine bundle exec rake db:migrate RAILS_ENV=production

ここまででデータの移行作業は終了です。

メール自動取得のため cron 設定

問い合わせメールを自動取得できるように crontab を設定します。home directory などは適切に設定してください。

bash
sudo apt install cron -y
sudo systemctl enable cron
sudo systemctl start cron

sudo crontab -e
crontab
*/5 * * * * cd /home/(home directory)/redmine/; docker compose exec -T redmine bundle exec rake redmine:email:receive_imap RAILS_ENV=production host=your.popserver.jp username=login@email.jp password=pop-password project=your-project-id allow_override=project

追記:ホームの変更

Bitnami の場合、トップ画面のURLが http://hostname/redmine ですが、今回のインストールでは http://hostname/ になってしまいます。Redmine にホームを設定する場所があるので変更を行います。変更は、管理 > 設定 > 全般 > ホスト名とパス から行います。

以上です。参考になれば幸いです。

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?