环境配置前操作
mac: app_store安装x-code
ubuntu: 终端->配置文件->首选项->命令->以shell方式登录
安装RVM
mac:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" $ brew install libxml2 libxslt libiconv
ubuntu:
$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 $ curl -sSL https://get.rvm.io | bash -s stable 或者 $ curl -L https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable
以下操作相同
载入环境:
$ source ~/.rvm/scripts/rvm
修改下载源:(原因不做描述)
$ echo "ruby_url=https://cache.ruby-china.org/pub/ruby" > ~/.rvm/user/db
检查一下是否安装正确
$ rvm -v
安装支持库
$ rvm requirements
mac:
$ brew update $ brew install -y software-properties-common wget unzip vim build-essential openssl libreadline6 libreadline6-dev libsqlite3-dev libmysqlclient-dev libpq-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf automake cmake libtool imagemagick libmagickwand-dev libpcre3-dev language-pack-zh-hans libevent-dev libgmp-dev libgmp3-dev redis-tools nodejs htop
ubuntu:
$ sudo apt-get update $ sudo apt-get install -y software-properties-common wget unzip vim build-essential openssl libreadline6 libreadline6-dev libsqlite3-dev libmysqlclient-dev libpq-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf automake cmake libtool imagemagick libmagickwand-dev libpcre3-dev language-pack-zh-hans libevent-dev libgmp-dev libgmp3-dev redis-tools nodejs htop
安装ruby版本(这里安装的2.3.0)
$ rvm install 2.3.0 --disable-binary
检查是否成功
$ ruby -v
$ gem install rails $ gem install rails --no-ri --no-rdoc
检查是否成功
$ rails -v
安装数据库(这里以MySQL为例)
检查是否安装
$ sudo netstat -tap | grep mysql
未安装看下面:
ubuntu:
$ sudo apt-get install mysql-server mysql-client
mac:
$ brew install mysql-server mysql-client
接下来就要安装编辑器了,个人觉得rubymine适合新手
在此给出rubymine的安装方式
首先安装jdk8(记得都选yes)
ubuntu:
$ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get install oracle-java8-installer
mac不用
去官网下载rubymine (http://www.jetbrains.com/ruby/)
激活码:
9DK8FDSOS2-eyJsaWNlbnNlSWQiOiI5REs4RkRTT1MyIiwibGljZW5zZWVOYW1lIjoi5b285bK4IHNvZnR3YXJlMSIsImFzc2lnbmVlTmFtZSI6IiIsImFzc2lnbmVlRW1haWwiOiIiLCJsaWNlbnNlUmVzdHJpY3Rpb24iOiJGb3IgZWR1Y2F0aW9uYWwgdXNlIG9ubHkiLCJjaGVja0NvbmN1cnJlbnRVc2UiOmZhbHNlLCJwcm9kdWN0cyI6W3siY29kZSI6IklJIiwicGFpZFVwVG8iOiIyMDE4LTExLTA0In0seyJjb2RlIjoiUlMwIiwicGFpZFVwVG8iOiIyMDE4LTExLTA0In0seyJjb2RlIjoiV1MiLCJwYWlkVXBUbyI6IjIwMTgtMTEtMDQifSx7ImNvZGUiOiJSRCIsInBhaWRVcFRvIjoiMjAxOC0xMS0wNCJ9LHsiY29kZSI6IlJDIiwicGFpZFVwVG8iOiIyMDE4LTExLTA0In0seyJjb2RlIjoiREMiLCJwYWlkVXBUbyI6IjIwMTgtMTEtMDQifSx7ImNvZGUiOiJEQiIsInBhaWRVcFRvIjoiMjAxOC0xMS0wNCJ9LHsiY29kZSI6IlJNIiwicGFpZFVwVG8iOiIyMDE4LTExLTA0In0seyJjb2RlIjoiRE0iLCJwYWlkVXBUbyI6IjIwMTgtMTEtMDQifSx7ImNvZGUiOiJBQyIsInBhaWRVcFRvIjoiMjAxOC0xMS0wNCJ9LHsiY29kZSI6IkRQTiIsInBhaWRVcFRvIjoiMjAxOC0xMS0wNCJ9LHsiY29kZSI6IlBTIiwicGFpZFVwVG8iOiIyMDE4LTExLTA0In0seyJjb2RlIjoiQ0wiLCJwYWlkVXBUbyI6IjIwMTgtMTEtMDQifSx7ImNvZGUiOiJQQyIsInBha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