Skip to content

Instantly share code, notes, and snippets.

@legnoh
Created February 8, 2014 19:40
Show Gist options
  • Save legnoh/8889027 to your computer and use it in GitHub Desktop.
Save legnoh/8889027 to your computer and use it in GitHub Desktop.
rbenv,CentOS6.5で作るredmine環境 ref: http://qiita.com/legnoh/items/835ad5d1fa06a333348e
Host legnoh
User root
HostName legnoh.jp
Port 10022
IdentityFile ~/.ssh/id_rsa
ForwardAgent yes
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: "localhost"
port: 25
domain: 'rm.legnoh.jp'
rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf
production:
adapter: mysql2
database: db_redmine
host: localhost
username: user_redmine
password: †††††††††
encoding: utf8
$ ssh root@legnoh.jp
$ mkdir .ssh
$ touch ~/.ssh/authorized_keys
...(セキュリティ上、SCPせずに手打ちでコピペする)
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorized_keys
$ vim /etc/ssh/sshd_config
chmod o+x /root/.rbenv/
$ rbenv exec gem install bundler --no-rdoc --no-ri
$ rbenv rehash
$ vim /etc/my.cnf
$ service mysqld start
$ chkconfig mysqld on
$ service mysqld start
$ chkconfig mysqld on
$ mysql -uroot
mysql> show variables like 'character_set%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
mysql> use mysql;
mysql> update user set password=password('********') where user = 'root';
mysql> delete from user where user = '';
mysql> create database db_redmine default character set utf8;
mysql> grant all on db_redmine.* to user_redmine identified by '†††††††††';
mysql> flush privileges;
mysql> exit;
$ wget http://www.redmine.org/releases/redmine-2.4.3.tar.gz
$ tar zxf redmine-2.4.3.tar.gz
$ mv redmine-2.4.3 /var/lib/redmine
$ vim /var/lib/redmine/config/database.yml
$ vim /var/lib/redmine/config/configuration.yml
$ vim /var/lib/redmine/config/configuration.yml
$ cd /var/lib/redmine
$ bundle install --without development test
$ bundle exec rake generate_secret_token
$ RAILS_ENV=production bundle exec rake db:migrate
$ cd /var/lib/redmine
$ rbenv local 2.1.0
$ rbenv rehash
$ ruby -v
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
$ bundle install --without development test
$ bundle exec rake generate_secret_token
$ RAILS_ENV=production bundle exec rake db:migrate
$ rbenv exec gem install passenger --no-rdoc --no-ri
$ rbenv rehash
$ passenger-install-apache2-module
(Enter連打)
$ passenger-install-apache2-module --snippet
$ vim /etc/httpd/conf.d/passenger.conf
$ service httpd configtest
$ service httpd start
$ chkconfig httpd on
$ chown -R apache:apache /var/lib/redmine
$ service httpd configtest
$ service httpd start
$ chkconfig httpd on
$ chown -R apache:apache /var/lib/redmine
rm A (IPアドレス)
rm A (IPアドレス)
$ service httpd configtest
$ service httpd start
$ rbenv exec gem install redcarpet
$ rbenv rehash
$ git clone https://github.com/alminium/redmine_redcarpet_formatter.git /var/lib/redmine/plugins/redmine_redcarpet_formatter
$ cd redmine_redcarpet_formatter
$ git checkout v2.0.1
$ service httpd restart
$ service sshd restart
$ git clone git://github.com/makotokw/redmine-theme-gitmike.git /var/lib/redmine/gitmike
$ service httpd restart
$ mkdir ~/code
$ git clone https://github.com/legnoh/rm_gh.git ~/code
$ vim .ssh/config
$ yum install -y openssl-devel readline-devel zlib-devel curl-devel libyaml-devel
$ yum install -y mysql-server mysql-devel
$ yum install -y httpd httpd-devel
$ yum install -y ImageMagick ImageMagick-devel
$ yum install -y ipa-pgothic-fonts
$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
$ type rbenv
#=> "rbenv is a function"
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ rbenv install -l
...
2.0.0-p195
2.0.0-rc2
2.1.0
2.1.0-dev
2.1.0-preview1
2.1.0-preview2
2.1.0-rc1
...
$ rbenv install 2.1.0
$ rbenv rehash
NameVirtualHost *:80
<VirtualHost *:80>
ServerName legnoh.jp
DocumentRoot /var/www/html
</VirtualHost>
<VirtualHost *:80>
ServerName rm.legnoh.jp
DocumentRoot /var/lib/redmine/public
</VirtualHost>
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server=utf8
# 任意設定
innodb_file_per_table
query-cache-size=16M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[mysql]
default-character-set=utf8
LoadModule passenger_module /root/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/passenger-4.0.37/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /root/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/passenger-4.0.37
PassengerDefaultRuby /root/.rbenv/versions/2.1.0/bin/ruby
</IfModule>
# Passengerが追加するHTTPヘッダを削除するための設定(任意)。
#
Header always unset "X-Powered-By"
Header always unset "X-Rack-Cache"
Header always unset "X-Content-Digest"
Header always unset "X-Runtime"
# 必要に応じてPassengerのチューニングのための設定を追加(任意)。
# 詳しくはPhusion Passenger users guide(http://www.modrails.com/documentation/Users%20guide%20Apache.html)をご覧ください。
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 3600
PassengerHighPerformance on
PassengerStatThrottleRate 10
PassengerSpawnMethod smart
RailsAppSpawnerIdleTime 86400
PassengerMaxPreloaderIdleTime 0
Port 10022
PermitRootLogin without-password
PasswordAuthentication no
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment