備忘録。 Redmine, Jenkins, Gitlab, Centos

CentOS 6.4
iso
ftp://ftp.iij.ad.jp/pub/linux/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-bin-DVD1.iso
ftp://ftp.iij.ad.jp/pub/linux/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-bin-DVD2.iso

Desktop install

vmtools install

sudo setting
add this line
# visudo
%takahashi ALL=(ALL) ALL

# yum install screen
http://www.limy.org/program/screen.html

        • *----*----*----*----*----*----*----*----

ruby install

epel install
http://www.tooyama.org/yum-addrepo-epel.html
$ wget http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

$ sudo yum install --enablerepo=epel make gcc zlib-devel openssl-devel readline-devel ncurses-devel gdbm-devel db4-devel libffi-devel tk-devel libyaml-devel

rvm install
http://morizyun.github.com/blog/rvm-install-centos-ruby-rails/

$ \curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable

add
$ vim .bashrc
source $HOME/.rvm/scripts/rvm

$ reboot now

$ rvm install 1.9.3
$ rvm use 1.9.3 --default
$ rvm list

rvm rubies

=* ruby-1.9.3-p392 [ x86_64 ]

$ ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]

        • *----*----*----*----*----*----*----*----

Redmine install

http://blog.redmine.jp/articles/2_3/installation_centos/
$ sudo vim /etc/sysconfig/selinux
SELINUX=enforcing

SELINUX=disabled

$ reboot

$ sudo vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
$ service iptables restart

$ sudo yum install mysql-server mysql-devel httpd httpd-devel ImageMagick ImageMagick-devel ipa-pgothic-fonts

MySQL Setup
$ sudo yum install openssl-devel readline-devel zlib-devel curl-devel libyaml-devel
$ sudo vim /etc/my.cnf
[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

$ sudo service mysqld start
$ sudo chkconfig mysqld on
$ sudo 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)

Set root user password and delete amonus user
# mysql -uroot
mysql> use mysql;
mysql> update user set password=password('********') where user = 'root';
mysql> delete from user where user = '';
mysql> flush privileges;
mysql> exit;

Create database and users
# mysql -uroot -p
mysql> create database db_redmine default character set utf8;
mysql> grant all on db_redmine.* to 'user_redmine'@'localhost' identified by '********';
mysql> flush privileges;
mysql> exit;

Install
$ cd /home/user/download/
$ wget http://rubyforge.org/frs/download.php/76867/redmine-2.3.0.tar.gz
$ tar zxvf redmine-2.3.0.tar.gz
$ su
# mv redmine-2.3.0 /var/lib/redmine
# cd /var/lib/redmine

# cp config/database.yml.example config/database.yml
# vim config/database.yml
production:
adapter: mysql2
database: db_redmine
host: localhost
username: user_redmine
password: "********"
encoding: utf8

# cp config/configuration.yml.example config/configuration.yml
# vim config/configuration.yml
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: "localhost"
port: 25
domain: 'redmine.com'

rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf

# bundle install --without development test
# bundle exec rake generate_secret_token
# RAILS_ENV=production bundle exec rake db:migrate


Passenger install
# gem install passenger --no-rdoc --no-ri
# passenger-install-apache2-module
The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /home/takahashi/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /home/takahashi/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19
PassengerRuby /home/takahashi/.rvm/wrappers/ruby-1.9.3-p392/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

Press ENTER to continue.

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:


ServerName www.yourhost.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /somewhere/public

# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews

And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

/home/takahashi/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/doc/Users guide Apache.html

Apache Setup

# vim /etc/httpd/conf/httpd.conf
# Passengerの基本設定。
# passenger-install-apache2-module --snippet を実行して表示される設定を使用。
# 環境によって設定値が異なりますので以下の3行はそのまま転記しないでください。
#

LoadModule passenger_module /home/takahashi/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /home/takahashi/.rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19
PassengerRuby /home/takahashi/.rvm/wrappers/ruby-1.9.3-p392/ruby

# 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
RailsFrameworkSpawnerIdleTime 0
# service httpd start
# chkconfig httpd on

Settings for running the Redmine with Passenger on Apache
# chown -R apache:apache /var/lib/redmine
# vim /etc/httpd/conf/httpd.conf
NameVirtualHost *:80

ServerName redmine.com
DocumentRoot /var/lib/redmine/public

AllowOverride all
Options -MultiViews


# /etc/init.d/httpd configtest
# /etc/init.d/httpd graceful

if this error