如何在 Debian 9 (Stretch) 上安裝 Redmine¶
從 Debian 套件安裝¶
Debian 提供官方的 Redmine 套件。截至 2018 年 7 月,Debian 9 支援穩定版本 3.4.11。
如果您要在需要長期支援和穩定性的生產環境中使用 Redmine,建議使用官方套件。您將會收到自動的功能和安全性更新。
如需詳細說明,請參閱Debian Wiki 上的 Redmine 文件。
從原始碼安裝¶
如果您想要最新的 Redmine 版本,並且習慣手動升級和系統管理,請按照以下步驟從原始碼安裝 Redmine。
1. 安裝 Redmine 及其所有套件的先決條件。
sudo apt install gcc build-essential zlib1g zlib1g-dev zlibc ruby-zip libssl-dev libyaml-dev \ libcurl4-openssl-dev ruby gem libapache2-mod-passenger apache2 apache2-dev libapr1-dev \ libxslt1-dev checkinstall libxml2-dev ruby-dev vim libmagickwand-dev imagemagick sudo rails
2. 安裝您選擇的資料庫。
apt install postgresql
3. 如果安裝 Postgres,請安裝 dev。
apt install postgresql-server-dev-9.6
4. 選擇要安裝 Redmine 的目錄。在此範例中,使用 /opt。您可以使用其他位置,但您需要根據您的選擇更新以下步驟。
在 /opt 中安裝 Redmine
cd /opt mkdir redmine cd redmine
取得 Redmine - 使用下載頁面並查看您需要的功能,以確定適合您的版本。
wget https://redmine.dev.org.tw/releases/redmine-3.4.11.tar.gz
解壓縮
tar xzf ./redmine-3.4.11.tar.gz
5. 以預設的 postgres 使用者身份登入,並建立新的角色和資料庫。請使用您自己的密碼。
sudo -u postgres psql postgres CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'your_password' NOINHERIT VALID UNTIL 'infinity'; CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
然後按 CTRL-D 退出 shell。
編輯 /etc/postgresql/9.6/main/pg_hba.conf
並將 Postgres 設定為信任
"local all postgres trust " sudo service postgresql reload
6. 使用以下內容建立 /opt/redmine/redmine-3.4.11/config/database.yml
檔案…
production: adapter: postgresql database: redmine host: localhost username: redmine password: your_password
請注意,此檔案中的間距很重要。「Production」行下方的每一行都必須縮排兩個空格,而不是定位點。將 your_password 替換為上面指定的密碼。記得儲存。請記住,Postgresql 密碼不能以 @ 字元(或其他非字母數字)開頭。
7. 接著,設定資料庫結構描述並載入初始資料庫。
cd /opt/redmine/redmine-3.4.11/config/ 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
8. 使用 webrick 進行快速測試,以確認 Redmine 是否正常運作。
bundle exec ruby /usr/bin/rails server -b your_ip webrick -e production
現在嘗試透過瀏覽器連線到 http://your_ip:3000
。Webrick 不適用於生產系統。不過,這是在開始使用 Apache 之前檢查事情的好方法。
9. 接著,讓我們設定 Apache。
cd /opt/ sudo chown -R www-data:www-data /opt/redmine cd /opt/redmine/redmine-3.4.11 sudo chmod -R 755 files log tmp public/plugin_assets sudo chown www-data:www-data Gemfile.lock
9.1 建立一個符號連結,從 Apache 工作目錄指向 Redmine 公用資料夾
sudo ln -s /opt/redmine/redmine-3.4.11/public/ /var/www/html/redmine
9.2 建立新的虛擬主機設定
sudo nano /etc/apache2/sites-available/master.conf
並貼上
<VirtualHost *:80> ServerAdmin admin@example.com Servername hostname DocumentRoot /var/www/html/ <Location /redmine> RailsEnv production RackBaseURI /redmine Options -MultiViews </Location> </VirtualHost>
然後,執行
sudo a2dissite 000-default.conf sudo a2ensite master.conf
9.3 將此行新增到 /etc/apache2/mods-available/passenger.conf
的文件主體中,而不僅僅是第一行。
PassengerUser www-data
重新啟動 Apache Web 伺服器
sudo service apache2 restart
10. 開啟瀏覽器並瀏覽至:http://your-ip-address/redmine
。
希望您現在已經開始運作了。
資料來源其他資源
2018 年更新的教學(2018 年 1 月 10 日),法文版,從 Debian Stretch 9 官方儲存庫中提供的套件開始,逐步重複 Redmine 的安裝步驟。
https://www.visionduweb.eu/wiki/index.php?title=Installer_Redmine_sur_Debian
由 Gael Porte 於 4 年多前 更新 · 8 個版本