1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS6.2でRailsを動作させるまでのメモ。

Last updated at Posted at 2012-03-19

CentOS 6.2はVMware上にBasicServerでインストール。

プロキシの設定。

/etc/profile.d/proxy.csh
setenv http_proxy http://hoghoge:8080/
setenv ftp_proxy http://hoghoge:8080/
setenv HTTP_PROXY http://hoghoge:8080/
setenv FTP_PROXY http://hoghoge:8080/
/etc/profile.d/proxy.sh
export http_proxy=http://hoghoge:8080/
export ftp_proxy=http://hoghoge:8080/
export HTTP_PROXY=http://hoghoge:8080/
export FTP_PROXY=http://hoghoge:8080/

vmware-toolsをインストールしたけど/etc/init.d/vmware-toolsがない。要調査。

cd /mnt/
mkdir cdrom
/dev/cdrom /mnt/cdrom
cd cdrom
cp VMwareTools-8.8.0-471268.tar.gz  ~/
cd
tar xzvf VMwareTools-8.8.0-471268.tar.gz
cd vmware-tools-distrib/
./vmware-install.pl
reboot

ネットワーク設定
DHCPを使用。

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
/etc/rc.d/init.d/network restart

インストール済みのパッケージを更新。

yum -y update

とりあえずファイアーウォールをOFF。

system-config-firewall-tui

上記だとそれ用のツールが立ちが上がるけど、インストール時のモードによっては入らないようなのでその場合は下記の通りにコマンドを実行する。

/etc/rc.d/init.d/iptables stop 
chkconfig iptables off 
chkconfig ip6tables off 

SELinuxを無効にする。

vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#   enforcing - SELinux security policy is enforced.
#   permissive - SELinux prints warnings instead of enforcing.
#   disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#   targeted - Only targeted network daemons are protected.
#   strict - Full SELinux protection.
SELINUXTYPE=targeted

再起動。

reboot

SELinuxの状態確認。
Disabledなら無効になっている。

getenforce

ユーザ追加。

useradd hoge
passwd hoge

追加したユーザでsudoできるようにする。

visudo
hoge	ALL=(ALL)	ALL

gitインストール

sudo yum -y install git

githubを使えるようにする

鍵を生成。

cd
ssh-keygen -t rsa

生成された~/.ssh/id_rsa.pubをgithubに登録。

接続確認。

ssh -t git@github.com

自身の環境をgithubから取ってきてあれやこれやした。

cd
git clone git@github.com:toshinori/dotfiles.git

vimprocをビルドしようとしたらgccがなかったのでインストール。

su
yum -y install gcc
cd ~/vim/bundle/vimproc
make -f make_gcc.mak

tmuxをインストール。

関連ライブラリをインストール。

yum -y install ncurses-devel
yum -y install libevent-devel

本体をインストール。

mkdir /usr/loca/src/tmux
cd /usr/loca/src/tmu
wget http://jaist.dl.sourceforge.net/project/tmux/tmux/tmux-1.5/tmux-1.5.tar.gz
tar zxf tmux-1.5.tar.gz
cd tmux-1.5
./configure
make
make install

RVMをインストール。

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

関連ライブラリをインストール。

su
yum -y install readline-devl
yum -y install openssl-devel
yum -y install sqlite-devel

RubyとRailsをインストール。

rvm install 1.9.3
rvm use 1.9.3
rvm gemset create RAILS_3_2_2
rvm use ruby-1.9.3-p125@RAILS_3_2_2 --default
gem install rails 

migrateに失敗したので追加であれやこれやをインストール。

gem install execjs
gem install therubyracer

therubyracerのインストールに失敗したので更にインストール。

su
yum -y install gcc-c++
gem install therubyracer

さらに該当プロジェクトのGemfileを修正(therubyracerのコメントアウトを解除)

group :assets do                                                                                                      
  gem 'sass-rails',   '~> 3.2.3'                                                                                      
  gem 'coffee-rails', '~> 3.2.1'                                                                                      
                                                                                                              
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes                                      
  gem 'therubyracer'                                                                                                  
  gem 'uglifier', '>= 1.0.3'                                                                                          
end  
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?