前提条件
- CentOS 7.1 minimal インストール
- selinux無効
mariadbのインストール
# yum install -y mariadb mariadb-server mariadb-devel
/etc/my.cnfに以下行を追加します。
[mysqld] +character-set-server=utf8 +[client] +default-character-set = utf8
起動と自動起動の設定
# systemctl start mariadb # systemctl enable mariadb
必要なパッケージのインストール
# yum -y install zlib-devel openssl-devel curl-devel make gcc-c++ wget
必要なリポジトリのインストール
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm # rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt # rpm -K rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm # rpm -i rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
yamlのインストール
# cd /usr/local/src # wget http://pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz # tar zxvf yaml-0.1.6.tar.gz # cd yaml-0.1.6 # ./configure # make # make install
Rubyのインストール
# cd /usr/local/src # wget ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.8.tar.gz # tar zxvf ruby-2.1.8.tar.gz # cd ruby-2.1.8 # ./configure # make # make install
RubyGemのインストール
# cd /usr/local/src # wget https://rubygems.org/rubygems/rubygems-2.5.2.tgz # tar zxvf rubygems-2.5.2.tgz # cd rubygems-2.5.2 # ruby setup.rb
ClamAVのインストール
# yum -y install clamav clamd clamav-devel clamav-db
/etc/clamd.confの下記箇所を変更します。
-User clamav +User root
起動と自動起動の設定
# systemctl start clamd # systemctl enable clamd
ウィルス定義ファイルの更新
# freshclam
ApacheとPassengerのインストール
# yum -y install httpd httpd-devel # gem install passenger # passenger-install-apache2-module
「/etc/httpd/conf.d/passenger.conf」を作成し以下を記述します。
下記内容は「passenger-install-apache2-module」実行時に表示されるメッセージの内容ですので、下記と異なる場合はは表示されたメッセージの内容を優先してください。
LoadModule passenger_module /usr/local/lib/ruby/gems/2.1.0/gems/passenger-5.0.24/buildout/apache2/mod_passenger.so <IfModule mod_passenger.c> PassengerRoot /usr/local/lib/ruby/gems/2.1.0/gems/passenger-5.0.24 PassengerDefaultRuby /usr/local/bin/ruby </IfModule>
「/etc/httpd/conf/deco.conf」に以下を追加します。
<VirtualHost *:80> ServerName deco DocumentRoot /usr/local/deco/public RailsEnv production <Directory /usr/local/deco/public> Require all granted Options -MultiViews </Directory> </VirtualHost>
xsendfileのインストール
# wget --no-check-certificate https://tn123.org/mod_xsendfile/mod_xsendfile.c # apxs -cia mod_xsendfile.c
「/etc/httpd/conf.d/xsendfile.conf」を作成し以下を追加します。
<IfModule mod_xsendfile.c> XsendFile on XsendFilePath /var/deco/files </IfModule>
DECOのインストール
# cd /usr/local # tar xzvf deco.tar.gz # cd deco # gem install bundler # bundle install
「config/database.yml」の「production」の設定を編集(passwordなど)します。
production: adapter: mysql encoding: utf8 database: deco_production pool: 5 host: localhost username: deco password: ******** socket: <%= socket %>
データベースの作成
# mysql -u root > GRANT ALL PRIVILEGES ON deco_production.* TO deco@'127.0.0.0/255.255.255.0' IDENTIFIED BY '********'; > GRANT ALL PRIVILEGES ON deco_production.* TO deco@'localhost' IDENTIFIED BY '********'; > create database deco_production;
テーブルの作成と初期データの挿入
# rake db:migrate RAILS_ENV=production # rake db:seed RAILS_ENV=production
「config/environments/production.rb」に送信用メールサーバー情報の記述を追加します。
ActionMailer::Base.smtp_settings[:address] = "localhost" ActionMailer::Base.smtp_settings[:domain] = "example.com"
JS, CSS, 画像ファイルの初期設定
# rake assets:precompile RAILS_ENV=production
ディレクトリの作成/設定
# chown -R apache:apache /usr/local/deco # mkdir -p /var/deco/files # chown -R apache:apache /var/deco/files
Webサーバの起動と自動起動設定
# systemctl start httpd # systemctl enable httpd
以下のURLにアクセスすると管理画面が表示されますので必要な設定を行います。
(DECOサーバのURL)/sys_top
設定が完了したら以下のURLにアクセスするとDECOの利用ができます。
(DECOサーバのURL)/