プロジェクト

全般

プロフィール

« 前 - バージョン 2/19 (差分) - 次 » - 最新版


Ubuntu 20.04系にredmine4.2をインストール

概要
詳細

本記事の目的(対象とする読者)

  • Ubuntuサーバの基礎設定は終わったので、redmineをインストールしたい。
  • 取り敢えず動くところまで確認したい。

本記事で実施すること

  1. redmineを動かすためのパッケージがインストールできるように準備をします。
  2. redmineを動かすためのパッケージ(Ruby/データベース/Webサービスなど)をインストールします。
  3. データベースやWebサービスの基礎設定を行います。
  4. redmineの動作確認を行います。

特記事項

  • インストールするredmineのバージョンは4.2です。
  • 5.x系にしないのは「筆者が使いたいプラグインが4.2系まででしか動作確認できなかった(2023年1月現在)」という単純にして重要な理由です。

手順

前提

  • Ubuntuサーバの初期設定が終わった直後の状態を想定します。
  • 環境は以下の通りです。
    • Apache系
    • MySQL
    • Ruby 2.7
  • また、パッケージ管理としてaptitudeを用いています。aptが好みの方はこちらに読み替えてください。

必要なパッケージをインストールします。

sudo aptitude update

sudo aptitude install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev libffi-dev mysql-server mysql-client apache2 apache2-dev libapr1-dev libaprutil1-dev imagemagick libmagick++-dev fonts-takao-pgothic subversion git ruby libruby ruby-dev libmysqlclient-dev

apacheの追加モジュールをインストールします。

sudo aptitude install libapache2-mod-passenger

rubyのパッケージ管理(gem)を用いて必要なライブラリをインストールします。

sudo gem install bundler racc mysql2
# 「3 gems installed」が表示されればインストール成功です。

mysqlの初期設定を行います。

mysql設定変更

sudo mkdir /etc/old
# 各種設定ファイルのバックアップをここに格納します。

sudo cp -pi /etc/mysql/mysql.conf.d/mysqld.cnf /etc/old/mysqld.cnf.$(date +%Y%m%d)
# .$(date +%Y%m%d)をつけることで、バックアップファイルは当日日付(YYYYMMDD形式)で記録されます

diff -u /etc/mysql/mysql.conf.d/mysqld.cnf /etc/old/mysqld.cnf.$(date +%Y%m%d)
# バックアップが取れていることを「差分が存在しないこと」で確認します

echo -e "default_authentication_plugin=mysql_native_password" | sudo tee -a /etc/mysql/mysql.conf.d/mysqld.cnf
# mysqld.cnfに追記をします

設定後の差分確認

diff -u /etc/old/mysqld.cnf.$(date +%Y%m%d) /etc/mysql/mysql.conf.d/mysqld.cnf
+default_authentication_plugin=mysql_native_password

設定反映

sudo systemctl restart mysql.service

mysql rootパスワード変更

mysql -u root -p
# 未設定のためパスワードは不要です
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
#''passwordは任意のものを入力ください

flush privileges;

exit

mysql_secure_installation

sudo mysql_secure_installation

質問事項

Enter password for user root: 
# 上記で設定したパスワードを入力します

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: 
# Yを入力してEnter

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG:
# ポリシーに合わせて0/1/2を入力

Estimated strength of the password: 50 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : 
# 既に設定しているのでn

By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : 
# anonymousユーザーを削除するためY

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : 
# rootユーザのリモートログインを禁止するためY

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : 
# テストDBを削除するためY

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : 
# 設定を反映するためy

mysqlでDBとユーザーを設定します。

sudo mysql -u root -p
# 上記で設定した「mysqlのrootパスワード」を入力し、mysqlにログインします
CREATE DATABASE redmine character set utf8mb4;
# DB "redmine" を作成します

CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'password';
# ユーザ "redmine"を作成し、パスワードを設定します
# この'password'は任意のパスワードに変更してください

GRANT ALL ON redmine.* TO 'redmine'@'localhost';
# DB "redmine"の権限をユーザ "redmine"に委譲します

flush privileges;
# 設定を反映させます

exit
トップへ
クリップボードから画像を追加 (サイズの上限: 50 MB)