基本環境
CentOS 7
Apache 2.4
PHP 5.6
MariDB 10
防火牆設定
firewall-cmd –zone=public –add-service=http –permanent
firewall-cmd –reload
firewall-cmd –zone=public –list-services
安裝 Apache 與 MariDB
yum -y install mariadb-server mariadb-devel httpd httpd-devel
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php71w php71w-opcache php71w-fpm yum-plugin-replace php71w-mysql php71w-common
systemctl enable mariadb
systemctl enable httpd
systemctl start mariadb
systemctl start httpd
cat /etc/redhat-release
httpd -v
php-fpm -v
mysql -V
安裝 Ruby 例 2.4.3
cd ~
wget https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.3.tar.gz
tar xvf ruby-2.4.3.tar.gz
cd ruby-2.4.3
./configure –disable-install-doc
make
make install
ruby -v
gem -v
安裝 Ruby 管理工具 bundler
gem install atomic
gem install rails –no-rdoc –no-ri
gem install bundler –no-rdoc –no-ri
gem install passenger –no-rdoc –no-ri
rails -v
bundler -v
passenger -v
passenger-install-apache2-module –auto
安裝 Redmine 必須套件
yum -y groupinstall “Development Tools”
yum -y install epel-release openssl-devel readline-devel zlib-devel curl-devel libyaml-devel libffi-devel ImageMagick ImageMagick-devel ipa-pgothic-fonts sqlite-devel
安裝 Redmine 例3.4.6
cd ~
wget http://www.redmine.org/releases/redmine-3.4.6.tar.gz
tar -zxvf redmine-3.4.6.tar.gz
mv redmine-3.4.6 /usr/local/redmine
cd /usr/local/redmine/
chown -R root:root /usr/local/redmine
chown -R nobody:nobody files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets
ln -s /usr/local/redmine/ /var/www/html/
資料庫設定
vi /etc/my.cnf.d/server.cnf
[mysqld]
character-set-server=utf8
vi /etc/my.cnf.d/client.cnf
[client]
default-character-set=utf8
systemctl restart mariadb
mysql -uroot -p
CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER ‘redmine’@’localhost’ IDENTIFIED BY ‘my_password’;
GRANT ALL PRIVILEGES ON redmine.* TO ‘redmine’@’localhost’;
flush privileges;
show databases;
show variables like ‘character_set%’;
exit;
設定 Apache
passenger-install-apache2-module –snippet
LoadModule passenger_module /usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.2.1/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/2.4.0/gems/passenger-5.2.1
PassengerDefaultRuby /usr/local/bin/ruby
vi /etc/httpd/conf.d/redmine.conf
添加上面顯示的 LoadModule passenger_module 到 内容。
#vi /etc/httpd/conf/httpd.conf
# 找到 DocumentRoot “/var/www/html”
# 改為 DocumentRoot “/var/www/html/redmine/public”
apachectl configtest
Redmine 系統設定
cat /etc/postfix/main.cf | grep “inet_interfaces = localhost”
sed -i -e ‘s/inet_interfaces = localhost/inet_interfaces = all/g’ /etc/postfix/main.cf
cat /etc/postfix/main.cf | grep “inet_interfaces = all”
cd /usr/local/redmine/config
cp configuration.yml.example configuration.yml
vi /usr/local/redmine/config/configuration.yml
找到 ==== SMTP server at using TLS (GMail)
將下列行的最前面 # 拿掉且層次的格式不可變動
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.gmail.com
port: 587
domain: example.net
authentication: :login
user_name: Mail_ID@gmail.com
password: xxxxxx
delivery_method: :sendmail
systemctl restart postfix
cp /usr/local/redmine/config/database.yml.example /usr/local/redmine/config/database.yml
vi /usr/local/redmine/config/database.yml
production:
adapter: mysql2
database: redmine
host: localhost # 非本機即改為目的 IP
username: redmine
password: “my_password”
encoding: utf8
初始化 Redmine ( 初始化數據選擇 zh-TW )
cd /usr/local/redmine/
bundle lock –add-platform x86-mingw32 x64-mingw32 x86-mswin32
bundle install
bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data
Redmine 網站基本設定
網站管理 → 設定 →
顯示 → 預設語言 → 繁體中文
顯示 → 顯示附加檔案的縮圖 → 打勾
儲存
認證 → 註冊選項 → 關閉
認證 → 新用戶使用之預設值 → 時區 → +8 Taipei
儲存
API → 啟用 REST 網路服務技術(Web Service)→ 打勾
API → 啟用 JSONP 支援 → 打勾
儲存
電子郵件提醒選項 → 電子郵件前頭說明 → XXX ( 未定義 )
電子郵件提醒選項 → 電子郵件附帶說明 → 內容改為 ” 請記得前往查看 “
儲存