在RHEL 5.5配置Rails环境

DB SERVER

msyql

1
2
3
4
yum install mysql-server
service mysqld start
chkconfig mysqld on
/usr/bin/mysql_secure_installation

mysql -uroot -p

GRANT ALL PRIVILEGES ON . TO root@myip IDENTIFIED BY 'rootpassword' WITH GRANT OPTION;

vi /etc/sysconfig/iptables -A RH-Firewall-1-INPUT -s intranet_local -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT

redis

yum install redis vi /etc/redis.conf bind intranet_local

vi /etc/sysconfig/iptables -A RH-Firewall-1-INPUT -s intranet_local -m state –state NEW -m tcp -p tcp –dport 6379 -j ACCEPT

APP SERVER

add epel repo

1
2
3
wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm

install ruby via rvm

1
2
3
4
5
6
7
yum install git
curl -L https://get.rvm.io | bash
rvm requirements
rvm install 2.0
rvm use 2.0 --default
gem sources --remove https://rubygems.org/
gem sources -a http://ruby.taobao.org/

install mysql2 gem

1
2
yum install mysql-devel
gem install mysql2

install nodejs

yum install python26

1
2
3
$ mkdir -p $HOME/bin
$ ln -s /usr/bin/python26 $HOME/bin/python
$ echo 'export PATH=$HOME/bin:$PATH' >> ~/.bashrc
1
2
wget http://nodejs.org/dist/node-latest.tar.gz
tar zxf node-latest.tar.gz

Run configure script with newly installed python binary

./configure

Compile Node

make -j5

Install Node

make install

Verify installation (should print "v0.10.22")

node --version

chown to apache

chown -R apache:apache /var/www/rails_apps

Squid

yum install

1
yum install squid

config

1
vi /etc/squid/squid.conf
1
visible_hostname your_host_ip_or_hostname
1
2
acl intranet_local src 192.168.2.0/24
http_access allow intranet_local
1
2
service squid start
service squid on

vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -s intranet_local -m state –state NEW,ESTABLISHED,RELATED -m tcp -p tcp –dport 3128 -j ACCEPT

usage

1
vi /etc/yum.conf
1
2
multilib_policy=best
proxy=http://your_proxy_server:3128/
1
eport http_proxy=http://your_proxy_server:3128/