Ubuntu操作系统下rbenv、ruby、rails开发环境搭建

  1. # ! /usr/bin/sh
  2. # Ubuntu系统下安装ruby/rails必要的库和编译环境
  3. sudo apt-get update
  4. sudo apt-get install -y build-essential openssl curl libcurl3-dev libreadline6 libreadline6-dev git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf automake libtool imagemagick libmagickwand-dev libpcre3-dev libsqlite3-dev
  5. # rbenv环境安装
  6. git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
  7. echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
  8. echo 'eval "$(rbenv init -)"' >> ~/.bashrc
  9. source ~/.bashrc
  10. type rbenv
  11. git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
  12. # ruby环境安装,首先列出可安装的版本,然后选择后进行下载编译
  13. rbenv install -l
  14. rbenv install 1.9.3-p448
  15. # 设置当前使用的ruby版本并将gem的源改为淘宝镜像
  16. rbenv global 1.9.3-p448
  17. rbenv rehash
  18. gem sources --remove https://rubygems.org/
  19. gem sources -a http://ruby.taobao.org/
  20. # 安装rails
  21. gem install bundler rails
  22. # 检查安装后的软件版本
  23. ruby -v
  24. gem -v
  25. rake -V
  26. rails -v
  27. # 安装JAVA
  28. sudo add-apt-repository ppa:webupd8team/java
  29. sudo apt-get update
  30. sudo apt-get install oracle-java6-installer
  31. # 升级
  32. #sudo update-java-alternatives -s java-6-oracle
  33. # 设置JAVA环境变量
  34. sudo apt-get install oracle-java6-set-default

  35. # 设置JAVA字符
  36. sudo mkdir /usr/lib/jvm/java-6-oracle/jre/lib/fonts/fallback
  37. cd /usr/lib/jvm/java-6-oracle/jre/lib/fonts/fallback
  38. sudo ln -s /usr/share/fonts/truetype/wqy/wqy-microhei.ttc wqy-microhei.ttf
  39. sudo ln -s /usr/share/fonts/truetype/wqy/wqy-zenhei.ttc wqy-zenhei.ttf

  40. # 安装node.js(已经包含npm)
  41. sudo add-apt-repository ppa:chris-lea/node.js
  42. sudo apt-get update
  43. sudo apt-get install nodejs

你可能感兴趣的:(Ubuntu操作系统下rbenv、ruby、rails开发环境搭建)