ubuntu14.04装ruby和rails

新手学习ruby,记录下学习过程。

虚拟机版本:VMware 11
ubuntu 14.04

1.装置一些必需的库和工具
sudo apt-get install build-essential openssl libreadline6
libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev
libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev
ncurses-dev automake libtool bison subversion
2.收获公钥(可能是因为访问外国的问题,我先是天平素不成事,第二天一下就可以了)
gpg –keyserver hkp://keys.gnupg.net –recv-keys
409B6B1796C275462A1703113804BB82D39DC0E3
3.安装rvm
curl -L get.rvm.io | bash -s stable
4.查看是否安装成功(我的本子:2.2.3)
rvm -v
5.替换rvm的资源为Taobao源
sed -i -e
‘s/ftp\.ruby-lang\.org\/pub\/ruby/ruby\.taobao\.org\/mirrors\/ruby/g’
~/.rvm/config/db
6.查看可以安装的ruby版本
rvm list known
7.安装ruby
rvm install ruby(只写ruby是潮流版本)
注意:404 errors should be fixed for rvm to proceed. Check your sources
configured in:
    /etc/apt/sources.list
    /etc/apt/sources.list.d/*.list
\n’
There has been error while updating ‘apt-get’, please give it some time
and try again later.
404 errors should be fixed for rvm to proceed. Check your sources
configured in:
    /etc/apt/sources.list
    /etc/apt/sources.list.d/*.list

++ return 100
报这些错,就运行一下:rvm autolibs disable
再运行:rvm install ruby就行了
8.查看ruby版本(我的本子:2.2.3)
ruby -v
9.查看gem版本(我的版本:2.4.5.1)
gem -v
10.替换天猫源
gem source -a https://ruby.taobao.org
gem source -r https://rubygems.org/
gem source
结果:*** CURRENT SOURCES ***

https://ruby.taobao.org/
(保证只有那么些)
11.安装rails
gem install rails
并发错误:
ERROR:  While executing gem … (Gem::FilePermissionError)
    You don’t have write permissions for the /var/lib/gems/2.2.0
directory.
不曾对文本的权柄
到/var/lib/gems目录查看发现只有root具有读写权限
据此运行:sudo gem install rails
12.查看rails版本
rails -v

13.设置imagemagick
(在开发中相见一个图形上传不可能运行的一无是处,安装那么些就行了)
sudo apt-get install imagemagick

网站地图xml地图