Ubuntu上安装rvm

<a href="http://creativecommons.org/licenses/by/3.0/" rel="license"><img alt="創用 CC 授權條款" src="http://i.creativecommons.org/l/by/3.0/80x15.png" style="border-width:0"></a>本文采用<a href="http://creativecommons.org/licenses/by/3.0/" rel="license">Creative Commons 3.0 Unported License </a>授权。

 

什么是 rvm ?

 


<span style="font-family:georgia,serif;">  rvm</span> 的全称是 <span style="font-family:georgia,serif;">Ruby Version Manager </span>,是一款由 <a href="http://wayneseguin.us/"><em><span style="font-family:georgia,serif;">Wayne E. Seguin</span></em></a>  开发的一款命令行工具。<span style="font-family:georgia,serif;">rvm </span>能够让你轻松的安装、管理<span style="font-family:georgia,serif;"> ruby </span>生产力环境,诸如不同版本的解释器和<span style="font-family:georgia,serif;"> gem</span> 。


<span style="font-family:georgia,serif;">  rvm</span> 的项目官网是:


<span style="font-family:georgia,serif;">  <a href="https://rvm.beginrescueend.com/">https://rvm.beginrescueend.com/</a></span>


 

安装 rvm

 
  我们在这里只讨论单用户的安装,也就是会把 rvm 装到用户的主文件夹。同时,我们的环境为 Ubuntu 11.04
<span style="font-family:georgia,serif;">  rvm</span> 需要通过<span style="font-family:courier new,courier,monospace;"> curl </span>工具下载一段安装脚本来进行安装,同时,下载完的这段脚本还需要用<span style="font-family:courier new,courier,monospace;"> git </span>从 <span style="font-family:georgia,serif;">GitHub </span>上下载源码。因此,没有安装<span style="font-family:courier new,courier,monospace;"> curl </span>和 <span style="font-family:courier new,courier,monospace;">git </span>的用户,需要先执行下面的命令:
$ sudo apt-get install curl git
  万事具备,通过 <span style="font-family:courier new,courier,monospace;">curl </span>下载并执行安装脚本(请不要使用<span style="font-family:courier new,courier,monospace;"> root </span>执行):


<span style="font-family:courier new,courier,monospace;">$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)</span>


  完成后你就可以看到一大堆信息,介绍如何进行后面的安装。在以前版本的安装中,你需要自己在 <span style="font-family:courier new,courier,monospace;">~/.bashrc </span>文件中添加配置信息,但现在安装脚本智能化的帮你完成了这步。可以参 <span style="color:#0000ff;"><span style="font-family:courier new,courier,monospace;">~/.rvm/src/rvm/scripts/funcionts/installer</span></span> 中的 <span style="color:#0000ff;"><span style="font-family:courier new,courier,monospace;">setup_user_profiles()</span></span> 函数。


  不过最好检查一下你的 <span style="font-family:courier new,courier,monospace;">.bashrc </span>有没有如下的配置信息:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
  重新打开终端(好让他重新加载 <span style="font-family:courier new,courier,monospace;">.bashrc </span>文件),确认已经安装好 <span style="font-family:georgia,serif;">rvm</span> :
$ rvm -v

rvm 1.6.25 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
<span style="font-family:georgia,serif;">  rvm</span> 到这里就算安装完毕了。


 

安装 Ruby

 


  安装 <span style="font-family:georgia,serif;">ruby</span> 之前需要安装一些必要的依赖<sup><span style="color:#0000ff;">可选步骤</span></sup>:
$ sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
  然后是 <span style="font-family:courier new,courier,monospace;">readline</span> ,以前手动编译的时候也要弄这步:
$ rvm pkg install readline
  安装 <span style="font-family:georgia,serif;">ruby-1.9.2-p290 </span>,当然,你也可以安装你需要的版本,<span style="font-family:georgia,serif;">rvm </span>会自动为你下载、编译:
$ rvm install 1.9.2-p290 --with-readline-dir=$rvm_path/usr
  查看已经装好的 <span style="font-family:georgia,serif;">ruby</span> 环境:
$ rvm list

rvm rubies

   ruby-1.9.2-p290 [ i386 ]
  将安装好的 ruby-1.9.2-p290 设置为默认的工作环境:
$ rvm --default use 1.9.2-p290
  欢乐的游戏吧!

修改Empathy新消息提示音

话说Empathy这个声音真的是轻啊,简直和没有差不多,@ghosTM55 发过来的Gtalk,我就坐在电脑前写代码居然没听到。。平时也就算了,万一有个重要事情没听到后果就严重了。因此,我决心要修改Empathy的提示音。Empathy的提示音在哪里修改还真的是没找到,Google后得知,Empathy所有声音都是属于sound-theme-freedesktop这个RPM包的,查询即知,声音都在/usr/share/sounds/freedesktop/stereo下,进入后发现全是oga格式的声音,这个格式对我来说是蛮新鲜的。不知道Linux下如何将通用的MP3格式的声音转化为oga格式,Google后知道Linux有个著名的软件叫gnac,可以做声音格式转换,支持m4a,flac,oga,mp3,wav,spx等格式,官方网站 <a href="http://gnac.sourceforge.net/">gnac.sourceforge.net/</a>,介绍 <a href="http://www.lupaworld.com/article-210899-1.html">www.lupaworld.com/article-210899-1.html</a>(我承认这是在做广告,自由软件,做个广告什么的不非法吧)。下载源码后编译安装(依赖包我已经不记得了,但确实没有什么神奇的,官网的编译说明已经很详细了,反复使用./configure --prefix=/usr命令然后按要求安装依赖包即可,如果遇到了找不到的包就Google),然后即可运行。到这里一切都很简单,然后就发现问题了,格式转换的时候gnac提示需要一个叫做gstreamer element audioconvert的插件,gnac可以自行查询安装这个插件,但是结果失败,也就是说,这个插件可能不存在于Yum中。我Google了一下,猜测这个插件可能在gstreamer-plugins-ugly里,这个包Fedora的官方Yum中没有,我掏出珍藏的RpmFusion包安装:


su -c "rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm"
su -c "rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm"
但是并没有解决问题,我把Fedora 14升了下级,依旧没有解决。不得以,干脆发邮件了,与开发者直接交流不是开源软件一直宣传的理念么,邮件地址:<a href="mailto:gnac-list@gnome.org">gnac-list@gnome.org</a>,内容如下,额。本人英语超烂,勿嘲笑


i am a fedora 14 user, i need to convert some mp3 to oga, but gnac needs an additional plugin called gstreamer element audioconvert. gnac tried to search it by itself, but it is failed, and i alse dont know which rpm it need. so please help me, thank you.


一天后,回复


audioconvert is part of the gstreamer-plugins-base package. 
I’ve seen several people with fedora 14 complaining about audioconvert in relation to totem…but since it’s a general dependency issue, I’ll redirect you to the thread that supposedly solves the issue. You may just need to reinstall gs-plugins-base.
apologies to the devs for posting a thread about totem, but it seemed like the easiest thing. <a href="http://forums.fedoraforum.org/showthread.php?p=1429783" style="color: rgb(0, 0, 204); " target="_blank">http://forums.<wbr>fedoraforum.org/showthread.<wbr>php?p=1429783</a>


<wbr><wbr>



    <wbr><wbr>
<wbr><wbr>

    <wbr><wbr> 
<wbr><wbr><wbr><wbr>

    <wbr><wbr>
<wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr> 
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr> 
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr> 
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr> 
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr> 
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr> 
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr> 
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>

    <wbr><wbr> 
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr>
<div>
    我立即访问了给出的网页,第一帖给出了一个方案</div>
<div>
    <pre class="brush: bash">yum install gstreamer-ffmpeg gstreamer-plugins* -x *devel*</pre>
</div>

    下了上百MB的安装文件,但依然没有解决,继续看那张网页,#2中有这样一句话,basically remove the ~/.gstreamer-x.x/registry*.*,于是立即运行了
<pre class="brush: bash">rm ~/.gstreamer-0.10/registry*.*</pre>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<meta content="text/html; charset=utf-8" http-equiv="content-type">

    然后运行gnac来格式转换,瞬间完成,替换/usr/share/sounds/freedesktop/stereo下的message-new-instant.oga,测试,成功!这样Empathy的提示音就被替换成功。

    很高兴上星期天在本校举办的的Ubuntu 11.04 Release Party(详细可见:<a href="http://wowubuntu.com/shanghai-natty-party-review.html">http://wowubuntu.com/shanghai-natty-party-review.html</a>),我本人也算是组织者之一吧,Release Party前多次协助组织者uifiddle的工作。会中贡献了自己的电脑,不过没派上什么用场,演讲者一个个都自带笔记本电脑,由于台子小,全把电脑压在了我的电脑上,不仅被压,还被学校那该死的投影仪插,插到后来Ubuntu 11.04索性花屏了,重启到Fedora下才解决。

    <img alt="" src="http://ww4.sinaimg.cn/bmiddle/6b701daejw1dgzqszhha8j.jpg" style="width: 440px; height: 318px; ">
<meta content="text/html; charset=utf-8" http-equiv="content-type">

    <a href="http://wowubuntu.com/wp-content/uploads/2011/05/6b701daejw1dgzvm73y5vj.jpg"><img alt="" src="http://wowubuntu.com/wp-content/uploads/2011/05/6b701daejw1dgzvm73y5vj.jpg" style="width: 648px; height: 388px; "></a>

    投影仪里这台电脑就是我的哦。

    <img alt="" src="http://ww3.sinaimg.cn/bmiddle/6b701daejw1dgzsefzx59j.jpg" style="width: 440px; height: 263px; ">

    会场照片,知道哪个是我么?

    会后收获很大。私吞一个Canonical官方出的Ubuntu的2G U盘,很漂亮,一个U盘集线器,一张Ubuntu 10.10 官方的光盘,N多纪念贴纸贴满整个寝室,蛮疯狂的说。还和SHLUG人一起吃汉堡王,认识了ghosTM55,LTN,雨蒼,Shell Xu等一系列牛人。

    雨蒼不愧是台湾人(中华民国台湾地区),言语中都散发着中华民国人民特有的魅力,这种魅力在我们从小生活在中国大陆的人身上是从没有见过的,事实上上次的拥抱HTML5技术大会上就已经见识过另一个台湾人布丁(hlb)的演讲,幽默的话语,自由的气息,图文并茂的Slides,还有些对GFW的讽刺,已经构成了我对中华民国的主要印象。