2015/10/26

redmine with apache on centos7


from:http://www.redmine.org/projects/redmine/wiki/install_Redmine_25x_on_Centos_65_complete
yum -y install nano zip unzip libyaml-devel zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel gcc ruby-devel gcc-c++ make postgresql-devel ImageMagick-devel sqlite-devel perl-LDAP mod_perl perl-Digest-SHA
 

 
 

from:http://blog.maxkit.com.tw/2014/11/centos-6-redmine.html
在/etc/httpd/conf.d/加上redmine.conf,並編輯redmine.conf加入以下的設定。
vi /etc/httpd/conf.d/redmine.conf

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

RailsBaseURI /redmine
<Directory /var/www/redmine/public>
    # This relaxes Apache security settings.
    AllowOverride all
    Options -MultiViews
</Directory>
在DocumentRoot的路徑下加上redmine的symbolic link
ln -s /var/www/redmine/public /var/www/html/redmine
這個設定過程很重要,因為 redmine 官方只提供了以 virtual host 的方式跟 apache 整合,但我們希望用 http://localhost/redmine/ 的網址方式,連結 redmine,努力兩天後,得到上面的解決方案。

之後就是selinux的問題了,tail /var/log/audit/audit.log |audit2allow -M redmine1.pp
PS:因為執行過長,找到解決方法
http://tech.farend.jp/blog/2015/04/21/redmine-selinux/

インストール

“SELinuxを無効にする”の項は無視し、SELinuxをPermissiveモード(監視はするがアクセス制御はしない)にします。







1
setenforce 0
以降、最新版インストールガイド に従い、Redmineを構築します。

SELinuxの有効化と権限の付与

Redmineを構築し終えたら、以下のコマンドを実行します。







1
2
chcon -R -t httpd_sys_content_t /var/www/redmine/
setsebool -P httpd_unified on
Redmineのルートフォルダに対して「httpd_tというラベル付けがされたファイルから読み出される権限」を適用し、httpdによるファイルへの書き込み許可を設定しています。
最後に、SELinuxをEnforcingモードに戻します。







1
setenforce 1
以上です。
還有一個方式,沒有測試能否執行(還是要執行下面指令,為了結合LDAP驗證)
http://qiita.com/duloxetine/items/9a7285fd709e30ad9a62
# grep PassengerAgent /var/log/audit/audit.log | audit2allow -M passengeragent
# semodule -i passengeragent.pp
# grep ruby /var/log/audit/audit.log | audit2allow -M ruby
# semodule -i ruby.pp
# grep utils.rb:108 /var/log/audit/audit.log | audit2allow -M utils
# semodule -i utils.pp
因為LDAP帶來的資料有中文(或者輸入資料有中文問題),需要使用utf-8編碼,但是會遇到index太長的問題
原因:http://samyubw.blog.51cto.com/978243/223773
 得出的結論是:對於創建innodb的組合索引,如果各個列中的長度不超過767,則不再計算所有列的總長度,如果有超過767的,則給出報警,索引最後 創建成功,但是對於超過767字節的列取前綴索引;對於innodb的單列索引,超過767的,給出warning,最終索引創建成功,取前綴索引(取前 255字節)
解決方式:http://se-suganuma.blogspot.tw/2014/02/ruby-redmine-unicorninstallalminium.html
# vi /etc/my.cnf
# for Redmine
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix
# /etc/rc.d/init.d/mysqld restart
# vi config/initializers/adapt_utf8mb.rb
ActiveSupport.on_load :active_record do
  module ActiveRecord::ConnectionAdapters
    class AbstractMysqlAdapter
      def create_table_with_innodb_row_format(table_name, options = {})
        table_options = options.reverse_merge(:options => 'ENGINE=InnoDB ROW_FORMAT=DYNAMIC')
        create_table_without_innodb_row_format(table_name, table_options) do |td|
          yield td if block_given?
        end
      end
      alias_method_chain :create_table, :innodb_row_format
    end
  end
end
Try Again
# RAILS_ENV=production bundle exec rake db:migrate
無事完了。


加上GIT
http://redmine-git-hosting.io/get_started/
其中建立使用者git ,redmine改成apache
# Install dependencies (On Debian/Ubuntu)
root# apt-get install build-essential libssh2-1 libssh2-1-dev cmake libgpg-error-dev

# Install dependencies (On Fedora/CentoS/RedHat)
root# yum groupinstall "Development Tools"
root# yum install libssh2 libssh2-devel cmake libgpg-error-devel
# Switch user
root# su - redmine

# First git clone Bootstrap Kit
redmine$ cd REDMINE_ROOT/plugins
redmine$ git clone https://github.com/jbox-web/redmine_bootstrap_kit.git
redmine$ cd redmine_bootstrap_kit/
redmine$ git checkout 0.2.3

# Then Redmine Git Hosting plugin
redmine$ cd REDMINE_ROOT/plugins
redmine$ git clone https://github.com/jbox-web/redmine_git_hosting.git
redmine$ cd redmine_git_hosting/
redmine$ git checkout 1.1.4

# Install gems and migrate database
redmine$ cd REDMINE_ROOT
redmine$ bundle install --without development test
redmine$ bundle exec rake redmine:plugins:migrate RAILS_ENV=production NAME=redmine_git_hosting
.........
(從該來源網站按步驟)實施就可以正常安裝
第一次建立時,請下:
git init --bare
將git server初始化
至於管制方式,關鍵字:ssh ldap

或者vi /etc/password
將git由bin/bash變成bin/git-shell,原因:
出于安全的考虑,我们最好限制用户只能进行git push/pull,但无法登陆。这可以使用git-shell来完成。

會出現錯誤訊息: hint: ~/git-shell-commands should exist and have read and execute access

錯誤訊息參考:
http://nick.txtcc.com/index.php/linux/1116
  •  cp -Rf /usr/local/share/git-XXXX/contrib/git-shell-commands .
  •  # 再來改變權限
  •  chown -R git: git-shell-commands/
  •  chmod +x git-shell-commands/help
  •  chmod +x git-shell-commands/list


PS:selinux 再補充
https://mbrownnyc.wordpress.com/technology-solutions/rhodecode-and-redmine/part-4-redmine-on-apache/
其中PassengerTempDir:
The passenger_temp_dir option (Nginx) and the PassengerTempDir option (Apache) have been replaced by two config options. On Nginx they are passenger_instance_registry_dir and passenger_data_buffer_dir. On Apache they are PassengerInstanceRegistryDir and PassengerDataBufferDir. On Apache, PassengerUploadBufferDir has been replaced by PassengerDataBufferDir.
測試結果:殘念.....XD  not working..

redmine建立好,設定好,還是一直告知你empty:
http://redmine-git-hosting.io/troubleshooting/

My repository seems empty but I’m sure it is not!


A git clone of the repository gives me files!
root$ su - redmine
redmine$ cd REDMINE_ROOT
redmine$ bundle exec rake redmine_git_hosting:fetch_changesets RAILS_ENV=production




沒有留言:

JPA+complex key+custom Query

  來源: https://www.cnblogs.com/520playboy/p/6512592.html   整個來說,就是有複合主鍵 然後要使用  public interface XxXXxx DAO extends CrudRepository<Tc...