安裝 Debian 7.6 基本系統(只選標準系統工具跟 ssh)
IP: 172.20.3.12/16GW: 172.20.254.254
DNS: 8.8.4.4 8.8.8.8
root:111111
octtel:111111
需要更改 IP 時:
nano /etc/network/interfaces
安裝相依套件
aptitude update && aptitude -y install sudo ssh bzip2 zip unzip apache2 libapache2-mod-passenger mysql-server libmysqlclient-dev ruby ruby-dev git git-core gitolite libmagickcore-dev libmagickwand-dev libicu-dev imagemagickNew password for the MySQL "root" user: 回答 "111111"
Repeat password for the MySQL "root" user: 回答 "111111"
建立 redmine, gitolite 的使用者
adduser --system --shell /bin/bash --gecos 'Git Administrator' --group --disabled-password --home /opt/gitolite gitadduser --system --shell /bin/bash --gecos 'Redmine Administrator' --group --disabled-password --home /opt/redmine redmine
產生 redmine 的憑證
su redminessh-keygen -t rsa -N '' -f ~/.ssh/redmine_gitolite_admin_id_rsa
(會產生 /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa 跟 /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa.pub)
ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa /opt/redmine/.ssh/id_rsa
ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa.pub /opt/redmine/.ssh/id_rsa.pub
exit
設定 gitolite
dpkg-reconfigure gitoliteSystem username for gitolite: 回答 "git"
Repository path: 回答 "/opt/gitolite"
Administrator's SSH key: 回答 "/opt/redmine/.ssh/redmine_gitolite_admin_id_rsa.pub"
安裝 redmine
sudo su - redminecd ~
wget http://www.redmine.org/releases/redmine-2.5.2.tar.gz
tar zxf redmine-2.5.2.tar.gz
mv redmine-2.5.2/* .
rm -Rf redmine-2.5.2
建立 database 和 user
mysql -u root -p -v -e "CREATE DATABASE redmine CHARACTER SET utf8;CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';"
Enter password: 輸入 "111111"
組態資料跟mail
cd /opt/redmine/configcp database.yml.example database.yml
cp configuration.yml.example configuration.yml
nano database.yml
內容改成如下 (其他項目用 # 標示)
production:
adapter: mysql2
database: redmine
host: localhost
username: root
password: "111111"
encoding: utf8
建立 plugin 資料夾
cd ~mkdir public/plugin_assets
修改 sudoer (為了安全後面會限縮權限,但是這邊安裝需要開放全部)
nano /etc/sudoers
增加
redmine ALL=(ALL) NOPASSWD:ALL
git ALL=(ALL) NOPASSWD:ALL
完成 redmine
sudo gem install bundlerbundle install --without development test postgresql sqlite
rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production rake redmine:load_default_data
設定 sendmail (以 gmail 為例)
修改 /opt/redmine/configuration.ymlemail_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
address: "smtp.gmail.com"
port: 587
domain: "smtp.gmail.com"
authentication: :plain
user_name: "your_email@gmail.com"
password: "your_password"
安裝 gitolite
cd ~/pluginsgit clone https://github.com/jbox-web/redmine_bootstrap_kit.git
git clone https://github.com/jbox-web/redmine_git_hosting.git
cd redmine_git_hosting
git checkout v0.7.7
ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa /opt/redmine/plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa
ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa.pub /opt/redmine/plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa.pub
設定 Key
sudo su - gitsed -i 's/$GL_GITCONFIG_KEYS = ""/$GL_GITCONFIG_KEYS = ".*"/g' /opt/gitolite/.gitolite.rc
exit
設定自動初始化 repository
cd ~git clone git@localhost:gitolite-admin.git
cd gitolite-admin/
echo "repo @all
RW+ = admin" >> conf/gitolite.conf
git commit -m 'Automatic Repository Initialization' conf/gitolite.conf
git push
cd ~
rm -rf gitolite-admin
安裝 plugin 到 redmine
cd ~bundle install --without development
RAILS_ENV=production rake redmine:plugins:migrate
修改 sudoer
nano /etc/sudoers增加
redmine ALL=(git) NOPASSWD:ALL
git ALL=(redmine) NOPASSWD:ALL
修改 Apache mod_passenger 設定
su rootcd /var/www
ln -s /opt/redmine/public redmine
echo "RailsBaseURI /redmine
PassengerUserSwitching on
PassengerUser redmine
PassengerGroup redmine" > /etc/apache2/sites-available/redmine
a2ensite redmine
service apache2 reload
啟用 https
a2ensite default-ssla2enmod ssl
service apache2 restart
其他
git 客戶端無法 clone 未被公證單位認證的憑證提供的 .git,可以執行下列指令不檢查憑證git config --global http.sslverify false
2 則留言:
發現一個小問題
~/redmine/public/javascripts/jstoolbar/lang/jstoolbar-zh-tw.js
要改成
jstoolbar-zh-TW.js
或者是用 ln 建 link
最新的 SVN 已經解決
http://www.redmine.org/issues/4190
張貼留言