在ubuntu操作系统中安装ruby,rails,mysql的详细步骤(一)
来源:互联网 发布:指绘软件meidbang 编辑:程序博客网 时间:2024/05/24 06:51
Ruby语言现在正在成为社会的主流语言之一,因为他全部采用面向对象的思想,使得变成比起其他语言要来得方便,本人亲自试过,一个相同的功能用ruby和java来写,明显可以看到ruby只要写java的一半就可以实现了。 好了,废话不多说了,一开始接触ruby的时候是比较烦恼的,以为他有诸多的配置要安装,接下来我来给大家讲述一下详细的安装步骤:
第一:安装ruby(推荐大家用rvm安装ruby)
先讲讲选择rvm的原因:RVM的主要作用是方便的管理系统中的多个ruby版本而不至于混乱,如果是其他安装就只能够安装一种版本,但是对于ruby开发人员来说一种版本是远远不够的。
第一步:安装rvm需要curl,首先要先看一下ubuntu系统里面有没有安装curl,使用命令dpkg -s curl检查一下。
如果出现以下显示说明已经有了curl:
proper@ubuntu:~$ dpkg -s curlPackage: curlStatus: install ok installedPriority: optionalSection: webInstalled-Size: 364Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>Architecture: i386Version: 7.21.3-1ubuntu1.5Replaces: curl-sslProvides: curl-sslDepends: libc6 (>= 2.7), libcurl3 (>= 7.16.2-1), zlib1g (>= 1:1.1.4)Description: Get a file from an HTTP, HTTPS or FTP server curl is a client to get files from servers using any of the supported protocols. The command is designed to work without user interaction or any kind of interactivity. . curl offers a busload of useful tricks like proxy support, user authentication, ftp upload, HTTP post, file transfer resume and more.Homepage: http://curl.haxx.seOriginal-Maintainer: Ramakrishnan Muthukrishnan <rkrishnan@debian.org>
如果出现以下显示说明还没有curl:
proper@ubuntu:~$ dpkg -s curlPackage `curl' is not installed and no info is available.Use dpkg --info (= dpkg-deb --info) to examine archive files,and dpkg --contents (= dpkg-deb --contents) to list their contents.
那我们就必须要执行命令:sudo apt-get install curl 安装curl软件包(附带卸载curl的方法:sudo apt-get remove curl),安装完成后我们就可以安装rvm了
执行命令:curl -L get.rvm.io | bash -s stable 安装rvm,安装完成后会显示如下:
proper@ubuntu:~$ curl -L get.rvm.io | bash -s stable % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 10956 100 10956 0 0 1109 0 0:00:09 0:00:09 --:--:-- 6873Downloading RVM from wayneeseguin branch stable % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 1243k 100 1243k 0 0 76097 0 0:00:16 0:00:16 --:--:-- 138k
Installing RVM to /home/proper/.rvm/ RVM PATH line found in /home/proper/.bashrc /home/proper/.zshrc. RVM sourcing line found in /home/proper/.bash_profile /home/proper/.zprofile.
# RVM: Shell scripts enabling management of multiple ruby environments.# RTFM: https://rvm.io/# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)# Cheatsheet: http://cheat.errtheblog.com/s/rvm/# Screencast: http://screencasts.org/episodes/how-to-use-rvm
# In case of any issues read output of 'rvm requirements' and/or 'rvm notes'
Installation of RVM in /home/proper/.rvm/ is almost complete:
* To start using RVM you need to run `source /home/proper/.rvm/scripts/rvm`(这边提示我们接下来我们应该要运行这一命令,请看下面) in all your open shell windows, in rare cases you need to reopen all shell windows.
# proper,## Thank you for using RVM!# I sincerely hope that RVM helps to make your life easier and# more enjoyable!!!## ~Wayne
显示内容中提示我们要运行命令:source /home/proper/.rvm/scripts/rvm(这行命令千万不能直接复制我的,一定要到自己的上面显示的内容里面找到对应的,千万不能照搬,要不然会出大事的)
现在可以查看自己安装的rvm的版本:
通过命令:rvm -v
得到如下显示:
proper@ubuntu:~$ rvm -v
rvm 1.17.6 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]我的版本是1.17.6的。
接下来看似不重要其实是非常之重要的,要不然你会在以后安装的时候出错的,通过rvm requirements命令,可以察看安装各版本时候的前提条件。
显示如下:
proper@ubuntu:~$ rvm requirements
Requirements for Linux "Ubuntu 11.04"
NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X) This is the *original* / standard Ruby Language Interpreter 'ree' represents Ruby Enterprise Edition 'rbx' represents Rubinius
bash >= 4.1 requiredcurl is requiredgit is required (>= 1.7 for ruby-head)patch is required (for 1.8 rubies and some ruby-head's).
To install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head),then you must install and use rvm 1.8.7 first.
Additional Dependencies:# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following: ruby: /usr/bin/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 pkg-config(其中这句是需要关注的。这是安装依赖的第三方包,没有这个安装不成功岂不是很悲剧?因此接下来就是要安装这个安装包,当然和前面一样,不要拷贝我的,要找到你自己对应的,如果不安装,之后就无法安装rails,会很蛋疼的,而且找不到错误所在)
# For JRuby, install the following: jruby: /usr/bin/apt-get install curl g++ openjdk-6-jre-headless jruby-head: /usr/bin/apt-get install ant openjdk-6-jdk
# For IronRuby, install the following: ironruby: /usr/bin/apt-get install curl mono-2.0-devel
# For Opal, install the following: opal: /usr/bin/apt-get install nodejs npm
因此接下来就应该是安装上面所说的第三方包:sudo /usr/bin/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 pkg-config
(一定要对应好了哟,千万别忘了开头的sudo)
这样一来,安装ruby的准备工作就完成了。接下来就是要安装ruby了,请看《在ubuntu操作系统中安装ruby,rails,mysql的详细步骤(二)》
- 在ubuntu操作系统中安装ruby,rails,mysql的详细步骤(一)
- 在ubuntu操作系统中安装ruby,rails,mysql的详细步骤(二)
- 在ubuntu操作系统中安装ruby,rails,mysql的详细步骤(三)
- ruby on rails 在ubuntu下的安装
- 在Ubuntu上安装Ruby On Rails
- 在Ubuntu上安装Ruby On Rails
- 在Ubuntu上安装Ruby On Rails
- ubuntu 14.04中安装ruby on rails环境(填坑版)
- Ruby on Rails安装步骤
- Ruby on rails 安装步骤
- Windows下ruby、rails、mysql 的安装
- Windows下ruby、rails、mysql 的安装
- Ubuntu server 10.04安装apache+passenger+ruby+rails+mysql环境
- ubuntu 10.04 安装ruby & rails
- Ubuntu 安装ruby on rails
- 使用RVM在ubuntu下安装ruby&rails
- 在 Ubuntu 12.04 Server 上安装 Ruby on Rails 环境
- 如何在ubuntu下安装ruby on rails
- iOS学习基础学习之动态添加Button和监听UIAlertView按钮
- git - 简易指南
- javascript 获取屏幕、页面尺寸
- C++中模板类的输入输出流重载函数实现
- n4
- 在ubuntu操作系统中安装ruby,rails,mysql的详细步骤(一)
- 使用MyBatis链接MySQL
- Vmware上安装Vxworks 5.5
- cwe error
- 电脑控制手机的另一选择 - android vnc server
- 没事写了两个函数,php中gbk和utf-8中文无乱码截取
- 黑马程序员_java交通灯系统
- n2
- 第02讲:正确使用织梦(DEDECMS)后台的数据备份与还原功能