Skip to content

Instantly share code, notes, and snippets.

@therealechan
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save therealechan/412b16ba97ac45e3d2b6 to your computer and use it in GitHub Desktop.

Select an option

Save therealechan/412b16ba97ac45e3d2b6 to your computer and use it in GitHub Desktop.
Deploy Rails Application to Redhat5

NOTICE: 由于Redhat的yum在线更新是收费的,如果没有注册的话是不能使用的,即不能在线安装软件。

解决办法有两种:

安装apt-get 使用CentOS的源 第一种方法在安装时候需要的依赖太多,水太深。所以只能选择第二种了。下面是详细的过程。

更新yum源

删除redhat原有的yum源

$ rpm -aq | grep yum|xargs rpm -e --nodeps

下载新的yum安装包

$ wget http://mirror.centos.org/centos/6.0/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
$ wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-metadata-parser-1.1.2-14.1.el6.i686.rpm
$ wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-3.2.27-14.el6.centos.noarch.rpm
$ wget http://mirror.centos.org/centos/6.0/os/i386/Packages/yum-plugin-fastestmirror-1.1.26-1.el6.noarch.rpm

安装yum

$ rpm -ivh  python-iniparse-0.3.1-2.1.el6.noarch.rpm
$ rpm -ivh  yum-metadata-parser-1.1.2-14.1.el6.i686.rpm
$ rpm -ivh  yum-3.2.27-14.el6.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm

注意: 最后两个安装包要放在一起同时安装,否则会提示相互依赖,安装失败。

更改yum源

$ cd /etc/yum.repos.d/
$ rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
$ rpm -ivh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
$ rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

清理yum缓存

$ yum clean all
$ yum update

搭建Ruby

安装依赖

$ yum install gcc-c++ patch readline readline-devel zlib zlib-devel 
$ yum install libyaml-devel libffi-devel openssl-devel make 
$ yum install bzip2 autoconf automake libtool bison iconv-devel

安装RVM

$ curl -L get.rvm.io | bash -s stable

搭建RVM环境

$ source /etc/profile.d/rvm.sh

安装Ruby

$ rvm install 2.1.3

设置默认Ruby版本

$ rvm use 2.1.3 --default

检查你的Ruby版本

$ ruby --version

安装 Node.js

参考官方文档

https://github.com/joyent/node/wiki/installing-node.js-via-package-manager#enterprise-linux-and-fedora

安装 imagemagick

$ yum install imagemagick

安装 MySQL

添加MySQL的yum源

http://dev.mysql.com/downloads/repo/yum/

$ cd /etc/yum.repos.d/
$ wget http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
$ rpm -ivh sudo mysql-community-release-el6-*.noarch.rpm

安装MySQL

$ yum install mysql mysql-server mysql-libs mysql-server

启动MySQL

$ sudo service mysqld start

NOTICE: 进入mysql打 status 看一下sockets的正确地址。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment