最近想在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_profiletype 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