ubuntu安装ruby环境

sudo apt-get install gcc g++ build-essential libssl-dev libreadline-gplv2-dev zlib1g-dev libcurl4-openssl-dev linux-headers-generic libyaml-dev libxslt1-dev libmysqlclient-dev;
sudo apt-get install imagemagick libmagickwand-dev;
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz;
tar -xzf ruby-1.9.3-p327.tar.gz;
cd ruby-1.9.3-p327;
./configure --prefix=/usr/local/ruby;
make && sudo make install;
 
$ sudo vi /etc/environment
将Ruby的路径加入环境变量 中并保存/etc/environment,如下面内容:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"
修改了环境变量文件后,需要通过source命令让修改马上生效,命令如下:
$ source /etc/environment
为了检查安装是否成功,可以输入下面的命令进行测试 :
$ruby –v
 
sudo ln -s /usr/local/ruby/bin/ruby /usr/local/bin/ruby;
sudo ln -s /usr/local/ruby/bin/gem /usr/bin/gem;

安装Rails

sudo gem install rails -v 3.0.15

安装passenger

sudo apt-get install libgd2-xpm libgd2-xpm-dev libgeoip-dev libpam0g-dev;
 
sudo gem install passenger;
 
passenger-config --root
重新编译nginx 加入passenger module
--add-module=/usr/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/nginx;
 
wget http://web.iti.upv.es/~sto/nginx/ngx_http_auth_pam_module-1.2.tar.gz;
tar -zxvf ngx_http_auth_pam_module-1.2.tar.gz;
git clone https://github.com/gnosek/nginx-upstream-fair.git;
git clone https://github.com/agentzh/echo-nginx-module.git nginx-echo;
git clone https://github.com/arut/nginx-dav-ext-module.git;
./configure \
--prefix=/etc/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-log-path=/var/log/nginx/access.log \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--lock-path=/var/lock/nginx.lock \
--pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module \
--with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module \
--with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module \
--with-http_ssl_module --with-http_sub_module --with-http_xslt_module \
--with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl \
--with-mail --with-mail_ssl_module \
--add-module=/opt/build/modules/ngx_http_auth_pam_module-1.2 \
--add-module=/opt/build/modules/nginx-echo \
--add-module=/opt/build/modules/nginx-upstream-fair \
--add-module=/opt/build/modules/nginx-dav-ext-module \
--add-module=/usr/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/nginx;
sudo vi /etc/nginx/nginx.conf;
http {
#增加
        passenger_root /usr/local/ruby/lib/ruby/gems/1.9.1/gems/passenger-3.0.19;
        passenger_ruby /usr/local/ruby/bin/ruby;
 
}
 
sudo vi /etc/nginx/sites-enabled/default;
server {
        listen 8888;
        root /mnt/shared/java/workspace/website/trunk/public;
        server_name test.mydomain.com;
        passenger_enabled on;
        rails_env development;
}

原创文章,转载请注明: 转载自海波无痕

本文链接地址: ubuntu安装ruby环境

文章的脚注信息由WordPress的wp-posturl插件自动生成

此条目发表在server分类目录,贴了, , , , , , 标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

评论链接可以 移除 nofollow.