ubuntu rbenv、ruby、rails开发环境搭建
#!/usr/bin/sh
#Ubuntu系统下安装ruby/rails必要的库和编译环境
sudoapt-getupdate
sudoapt-getinstall-ybuild-essentialopensslcurllibcurl3-devlibreadline6libreadline6-devgit-corezlib1gzlib1g-devlibssl-devlibyaml-devlibxml2-devlibxslt-devautoconfautomakelibtoolimagemagicklibmagickwand-devlibpcre3-devlibsqlite3-dev
#rbenv环境安装
gitclonehttps://github.com/sstephenson/rbenv.git~/.rbenv
echo'exportPATH="$HOME/.rbenv/bin:$PATH"'>>~/.bashrc
echo'eval"$(rbenvinit-)"'>>~/.bashrc
source~/.bashrc
typerbenv
gitclonehttps://github.com/sstephenson/ruby-build.git~/.rbenv/plugins/ruby-build
#ruby环境安装,首先列出可安装的版本,然后选择后进行下载编译
rbenvinstall-l
rbenvinstall1.9.3-p448
#设置当前使用的ruby版本并将gem的源改为淘宝镜像
rbenvglobal1.9.3-p448
gemsources--removehttps://rubygems.org/
gemsources-ahttp://ruby.taobao.org/
#安装rails
geminstallbundlerrails
#检查安装后的软件版本
ruby-v
gem-v
rake-V
rails-v
#安装JAVA
sudoadd-apt-repositoryppa:webupd8team/java
sudoapt-getupdate
sudoapt-getinstalloracle-java6-installer
#升级
#sudoupdate-java-alternatives-sjava-6-oracle
#设置JAVA环境变量
sudoapt-getinstalloracle-java6-set-default
#设置JAVA字符
sudomkdir/usr/lib/jvm/java-6-oracle/jre/lib/fonts/fallback
cd/usr/lib/jvm/java-6-oracle/jre/lib/fonts/fallback
sudoln-s/usr/share/fonts/truetype/wqy/wqy-microhei.ttcwqy-microhei.ttf
sudoln-s/usr/share/fonts/truetype/wqy/wqy-zenhei.ttcwqy-zenhei.ttf
#安装node.js(已经包含npm)
sudoadd-apt-repositoryppa:chris-lea/node.js
sudoapt-getupdate
sudoapt-getinstallnodejs