linux centos install ruby

最近想在Linux环境中开发ruby, 本人的环境是windows系统,所以按照了一个linux(centos)的VM。

一、安装curl和git

curl是一个利用URL规则在命令行下工作的文件传输工具。它支持文件的上传和下载,所以是综合传输工具,但按传统,习惯称url为下载工具。
git是一个开源的版本管理工具。

yum install curl

二、安装RVM

RVM(Ruby Version Manager)是Ruby版本管理系统,可以方便的帮我们安装和管理多个版本的Ruby,不幸的是没有deb包。不过使用脚本安装依旧非常方便。
运行的时候一定要加上sudo,有点文章中写的时候没有写sudo,大家要注意了
sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )

RVM requires to add relevant users to it’s group

RVM需要追加相应的用户去他的group中去。打开文件如下:
sudo vim /etc/group
修改rvm的group,如下:
rvm:x:503:your_username


    安装好了之后,为了可以让任何用户都可以运行这个软件,需要做一下操作:
            
echo '[[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm"  # This loads RVM into a shell session.' >> ~/.bash_profile 
source ~/.bash_profile 

type rvm | head -1
    

三、安装Ruby

按照上面的方式,rvm安装的目录:/usr/local/rvm
运行rvm的方法:
sudo rvm install ruby 1.9.3

四、安装apache

1 setup apache2

下载:httpd-2.2.10.tar.gz

步骤:

tar xzvf httpd-2.2.10.tar.gz

cd httpd-2.2.10

./configure --enable-module=so --enable-module=rewrite

make

sudo make install

2 setup passenger †

#gem install passenger


3 setup apache2

下载:httpd-2.2.10.tar.gz

tar xzvf httpd-2.2.10.tar.gz

cd httpd-2.2.10

./configure --enable-module=so --enable-module=rewrite

make

sudo make install


4 setup passenger †

#gem install passenger


5 setup module †

#passenger-install-apache2-module


press 1 to continue, you will get

Checking for required software...

* GNU C++ compiler... found at /usr/bin/g++

* Ruby development headers... found

* OpenSSL support for Ruby... found

* RubyGems... found

* Rake... found at /usr/local/bin/rake

* Apache 2... found at /usr/sbin/httpd

* Apache 2 development headers... found at /usr/sbin/apxs

* Apache Portable Runtime (APR) development headers... found at /usr/bin/apr-1-config

* fastthread... found

* rack... foundsetup module †

#passenger-install-apache2-module


press 1 to continue, you will get


Checking for required software...

* GNU C++ compiler... found at /usr/bin/g++

* Ruby development headers... found

* OpenSSL support for Ruby... found

* RubyGems... found

* Rake... found at /usr/local/bin/rake

* Apache 2... found at /usr/sbin/httpd

* Apache 2 development headers... found at /usr/sbin/apxs

* Apache Portable Runtime (APR) development headers... found at /usr/bin/apr-1-config

* fastthread... found

* rack... found

注意点:

1 安装mysql2的时候,报错误:

mysql.h is missing. please check your installation of mysql and try again.

解决办法:

yum install mysql-devel


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值