ファイルストレージDECOのインストール

「徳島県自治体クラウド(文書管理(文書交換)システム(DECO))」は、大容量のファイルをブラウザで安心・簡単に送受信できるウェブアプリケーションです。

  • ファイルを送りたい時にも、送ってもらいたい時にも利用可能
  • メールに添付できない大容量ファイルの交換が可能
  • ファイルを送信してしまった後でもファイルの削除が可能
  • セキュリティ対策も万全
  • CSVファイルによる受取人情報の一括入力が可能
  • 送信ファイルの圧縮・暗号化が可能
  • 管理者機能により様々な設定が可能

DOCOインストール履歴

AlmaLinux9で構築しました。ディストリビューションのアップデートによって、下記情報は誤りを含む可能性があります。

Docoインストール前提条件

管理ページは固定IPアドレス制限
ドメイン「aquila.jp」
ホスト名「deco.aquila.jp」
MySQLのログイン情報「ID: deco / PW: password」
Postfixによるメール送信(安全に届けるためにSPF/DKIM/DMARCは必須)
ApacheによるSSL送信
ウイルス対策ソフトは有償のものを利用

Decoをダウンロード

mysql -u root -p

mysql> CREATE USER 'deco'@'127.0.0.%' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON deco_production.* TO 'deco'@'127.0.0.%';
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye

必要なパッケージのインストール

dnf -y install zlib-devel openssl-devel readline-devel rpm-build curl-devel make gcc gcc-c++ wget tar

dnf module list nodejs

Last metadata expiration check: 0:50:33 ago on Mon 22 Jun 2026 02:07:13 PM JST.
AlmaLinux 9 - AppStream
Name Stream Profiles Summary<br>nodejs 18 common [d], development, minimal, s2i Javascript runtime
nodejs 20 common [d], development, minimal, s2i Javascript runtime
nodejs 22 common [d], development, minimal, s2i Javascript runtime
nodejs 24 common [d], development, minimal, s2i Javascript runtime

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

dnf module -y install nodejs:24/common

curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo

[yarn]
name=Yarn Repository
baseurl=https://dl.yarnpkg.com/rpm/
enabled=1
gpgcheck=1
gpgkey=https://dl.yarnpkg.com/rpm/pubkey.gpg

dnf -y install yarn

dnf -y install libyaml
Last metadata expiration check: 0:01:50 ago on Mon 22 Jun 2026 02:59:41 PM JST.
Package libyaml-0.2.5-7.el9.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

dnf config-manager --set-enabled crb
dnf install -y libyaml-devel libffi-devel

cd /usr/local/src/
wget wget --no-check-certificate https://ftp.ruby-lang.org/pub/ruby/4.0/ruby-4.0.5.tar.gz
tar zxvf ruby-4.0.3.tar.gz
cd ruby-4.0.3
./configure -disable-install-doc --disable-install-rdoc
make
make install

Apache開発ツールとPassengerをインストール

dnf install -y httpd-devel apr-devel apr-util-devel
gem install passenger
passenger-install-apache2-module

passenger-install-apache2-module

Welcome to the Phusion Passenger Apache 2 module installer, v6.1.5.

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.
1

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

Which languages are you interested in? 1[ENTER]

Use <space> to select.
If the menu doesn't display correctly, press '!'

    Ruby
     Python
     Node.js
     Meteor

[ENTER]

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/httpd/conf/httpd.conf.


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

[ENTER]

vi /etc/httpd/conf.d/passenger.conf

LoadModule passenger_module /usr/local/lib/ruby/gems/4.0.0/gems/passenger-6.1.5/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
    PassengerRoot /usr/local/lib/ruby/gems/4.0.0/gems/passenger-6.1.5
    PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>

xsendfileをインストール

dnf -y install mod_xsendfile
vi /etc/httpd/conf.d/xsendfile.conf

XsendFile on
XsendFilePath /var/deco/files

deco用バーチャル設定

vi /etc/httpd/conf.d/deco.conf

<VirtualHost *:80>
  ServerName deco.aquila.jp
  DocumentRoot /var/www/deco/public
</VirtualHost>
<VirtualHost *:443>
  ServerName deco.trbank.jp
  DocumentRoot /var/www/deco/public
  SSLEngine on
  Protocols h2 http/1.1

  SSLCertificateFile /etc/letsencrypt/live/deco.aquila.jp/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/deco.aquila.jp/privkey.pem

  RailsEnv production

  <Directory /var/www/deco/public>
    Require all granted
    Options MultiViews
  </Directory>
    ErrorLog logs/deco-error_log
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
    TransferLog logs/deco-access_log
</VirtualHost>

Decoの設定

cd /var/www
tar xzvf (DECOプログラムファイル)
cd deco

bundle install

DBの設定
cp config/database.yml.sample config/database.yml
vi config/database.yml

production:
  <<: *default
  database: deco_production
  username: deco
  password: <%= Rails.application.credentials.dig(:deco, :database_password) %>

credentials設定
EDITOR=vi rails credentials:edit -e production


deco:
  database_password: あなたのDBパスワード

smtp:
  address: "127.0.0.1"
  port: 25
  domain: "aquila.jp"
  enable_starttls: false
  openssl_verify_mode: "none"

RAILS_ENV=production rails runner "p Rails.application.credentials.deco"
RAILS_ENV=production rails credentials:show

secret_key_base: f5888xxxxxxxxxxxxxxxxxxxxx
smtp:
  address: 127.0.0.1
  port: 25
  domain: aquila.jp
  enable_starttls: false
  openssl_verify_mode: none
  authentication: none
deco:
  database_password: password

確認

ファイル保存先作成(ウイルス対策必須)
mkdir -p /var/deco/files

DB作成・初期化
RAILS_ENV=production rails db:create
RAILS_ENV=production rails db:migrate
RAILS_ENV=production rails db:seed

最後の仕上げ
chown -R apache:apache /var/www/deco
chown -R apache:apache /var/deco/files
chown apache:apache config/master.key
chmod 600 config/master.key

systemctl restart httpd

systemctl restart httpd

https://(サーバ)/sys_top

おまけ

1.管理ページのIP制限がかかってしまった場合の追加方法

SELECT * FROM app_envs WHERE `key` = 'PERMIT_OPERATION_IPS';

INSERT INTO app_envs (`key`, `value`, `created_at`, `updated_at`)
VALUES ('PERMIT_OPERATION_IPS', 'あなたのIP', NOW(), NOW());

2.FROMアドレスに日本語名称を追加したい

SELECT * FROM app_envs WHERE `key` LIKE '%MAIL%' OR `key` LIKE '%FROM%' OR `key` LIKE '%SENDER%';
自分でUPDATE