読者です 読者をやめる 読者になる 読者になる

VMのCentOS5.5-x86_64に Rails3.1環境を作成する

sshインストール

yum install openssh-server

adminユーザーがsudoコマンドを使用できるようにする

## Allow root to run any commands anywhere
root ALL=(ALL) ALL
admin ALL=(ALL) ALL <-- 1行追加

sambaインストール

yum install samba

共有ディレクトリ作成

cd ~
cd mkdir/samba
chmod 777 samba

sambaアクセスユーザ作成

pdbedit -a admin
tdbsam_open: Converting version 0 database to version 3.
new password:
retype new password:

selinux無効化

vi /etc/sysconfig/selinux 

SELINUX=enforcing -> SELINUX=disabled 

iptables無効化

sudo /etc/init.d/iptables stop
sudo chkconfig iptables off


/etc/samba/smb.conf


[homes]
comment = Home Directories
browseable = no
writable = yes
path = /home/admin/samba

sudo /etc/init.d/smb restart
sudo chkconfig smb on

Ruby, Rails環境

# ファイルの取得
$ cd /usr/local/src
$ sudo wget http://dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
$ sudo wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt

# rpmパッケージのインストール
$ sudo rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

$ sudo vi /etc/yum.repos.d/rpmforge.repo


#enabled = 1
enabled = 0

関連パッケージのインストール

sudo yum install --enablerepo=rpmforge curl.x86_64 curl-devel.x86_64 git.x86_64

RVMインストール

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

sudo yum install gcc-c++.x86_64 patch.x86_64 readline.x86_64 readline-devel.x86_64 zlib.x86_64 zlib-devel.x86_64 libyaml-devel.x86_64 libffi-devel.x86_64 openssl-devel.x86_64 make.x86_64 bzip2.x86_64 iconv-devel.x86_64 sqlite-devel.x86_64

source .bashrc

rvm install 1.9.2
rvm use 1.9.2
Using /home/admin/.rvm/gems/ruby-1.9.2-p290

rvm gemset create rails31
rvm gemset use rails31

sqlite-rubyのインストール

cd /tmp
wget http://www.sqlite.org/sqlite-autoconf-3070400.tar.gz
tar zxvf sqlite-autoconf-3070400.tar.gz
cd sqlite-autoconf-3070400
./configure --prefix=/usr/local
make
make install

Railsイントール

gem install rails

rails new test
cd test

GemFile


gem 'execjs'
gem 'therubyracer'

group :production do
gem 'therubyracer-heroku', '0.8.1.pre3' # you will need this too
gem 'pg'
end

bundle install


.rvmrc


rvm use 1.9.2@rails31

rails s

ImageMagickインストール

sudo yum install ImageMagick-devel

herokuの設定

gem install heroku taps

cd ~
ssh-keygen -t rsa -C "sample@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/admin/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/admin/.ssh/id_rsa.
Your public key has been saved in /home/admin/.ssh/id_rsa.pub.
The key fingerprint is:
e9:0d:8d:e6:cb:01:19:40:9d:4f:02:02:37:1c:77:ad takao.taira@gmail.com

heroku keys:add

cd samba/sample
heroku create sample
git init
git add .
git commit -m 'init'
git push heroku master

postgresql

sudo yum install postgresql-devel