在linux上安装ruby on rails用于开发的最佳方式

时间:2021-05-25 23:33:57

I would like to install Linux for development of Ruby on Rails apps. I would like to know your recommendations for this. E.g.:

我想安装Linux来开发Ruby on Rails应用程序。我想知道你对此的建议。例如:

  1. Which distribution of Linux?
  2. 哪的Linux发行版?
  3. What is good to have for development? (Nginx, php as a service, ...?)
  4. 对发展有什么好处?(Nginx, php as a service,…?)
  5. What about requirements for machine?
  6. 机器的要求是什么?

I would like to install it properly for the best confort in developing. I'm now developing on windows, and it is horrible... (e.g. too slow, ...)

我想把它适当地安装在发展中最好的康福特。我现在正在windows上开发,这太可怕了……(如太慢,…)

I am not decided to develop on Windows 7 with Virtual machine or Linux (with less equipment). What about you? What do you like and what you could recommend and whot you couldn't? Is there really any advantage to developing on Unix systems?

我不打算在Windows 7上开发虚拟机或Linux(设备更少)。你呢?你喜欢什么,能推荐什么,不能推荐什么?在Unix系统上开发真的有什么好处吗?

I am quite novice, I tried to install Linux for developing, but I did not recognize any difference.

我是一个新手,我尝试安装Linux进行开发,但是我没有发现任何区别。

Do you have any recommendations how to develop properly?

你对如何正确发展有什么建议吗?

I'm using on Windows 7: Sublime2, SmartGit, RailsInstaller, ConEmu and Xampp as a mysql server.

我在Windows 7上使用Sublime2、SmartGit、RailsInstaller、ConEmu和Xampp作为mysql服务器。


//please make the point bold, what are you answered

//请大胆地指出这一点,你的回答是什么

5 个解决方案

#1


3  

I think the Virtual Machine is the best solution because it is pretty light, can be easily exported/copied (saved in Dropbox also!) and can be destroyed easily too.

我认为虚拟机是最好的解决方案,因为它很轻,可以很容易地导出/复制(保存在Dropbox中!),也可以很容易地销毁。


This is my setup on my personal computer that I use sometimes when I work from home :

这是我在个人电脑上的设置,我在家工作时有时会用到:

  • OS: Windows 7 with Oracle's Virtual Box to manage a virtual machine
  • 操作系统:使用Oracle的虚拟框来管理虚拟机
  • 1 Virtual Machine with Ubuntu 12.04 (I hate the desktop on the new ones and I use gnome-fallback-session)
  • 使用Ubuntu 12.04的虚拟机(我讨厌新版本的桌面,我使用gnome- fallbacksession)
  • Yakuake as terminal manager (very handy: use ctrl+F12 anytime to open a dropdown window containing terminals)
  • Yakuake作为终端管理器(非常方便:使用ctrl+F12随时打开包含终端的下拉窗口)
  • RubyMine as editor to code my stuff
  • RubyMine作为编辑来编写我的代码
  • Thin as the web server (I think this is the default one included in Rails, no need for extra install)
  • 瘦如web服务器(我认为这是Rails中包含的默认服务器,不需要额外安装)
  • git-gui to manage my stuff with Git
  • 用Git来管理我的东西
  • rvm as Ruby Version Manager (means you can work on projects using different ruby versions for each project)
  • rvm作为Ruby版本管理器(意味着您可以为每个项目使用不同的Ruby版本)

My computer is a Asus UX32VD (Notebook), 6 Go RAM, CPU is a small i7. I gave 3 Go of RAM to my Virtual Machine, 1 processor core, and it works great! Very smooth, unless you open tons of tabs and watch several 1080p videos at the same time.

我的电脑是华硕UX32VD(笔记本),6 Go RAM, CPU是一个小i7。我给了我的虚拟机3个内存,一个处理器内核,它工作得很好!非常平滑,除非你打开大量的标签页,同时观看几个1080p的视频。


Some links:

一些链接:

#2


2  

  1. Ubuntu 14.04 works fine. I recommend to use LTS versions. I use VM but as form me it's better for performance to use Ubuntu on your local machine. System requirements for OS you can find here.
  2. Ubuntu 14.04没问题。我建议使用LTS版本。我使用VM,但是作为表单,最好在本地机器上使用Ubuntu。系统对操作系统的要求可以在这里找到。
  3. The rails server command launches a small web server named WEBrick which comes bundled with Ruby. It's enought for development for me. Just use rails s command.
  4. rails服务器命令启动一个名为WEBrick的小型web服务器,它与Ruby绑定在一起。这对我来说是一种发展。只需使用rails的命令。
  5. I use RubyMine and it's brilliant IDE. Strongly recommended for Ruby.
  6. 我用的是RubyMine,它是很棒的IDE。强烈建议为Ruby。
  7. Also I recommend to install Ruby via rvm. It's very simple.
  8. 我还建议通过rvm安装Ruby。很简单。

Run terminal and use following commands:

运行终端,使用以下命令:

Install dependencies for Ruby:

安装Ruby的依赖关系:

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties -y 

Install Ruby

安装Ruby

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev -y
curl -L https://get.rvm.io | bash -s stable

source ~/.rvm/scripts/rvm

echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc

rvm install 2.1.2

rvm use 2.1.2 --default

Speed up your gem installations and have less clutter in your system, remove the rdoc and ri when installing new gems

加速您的gem安装,减少系统中的混乱,在安装新的gems时删除rdoc和ri

echo "gem: --no-ri --no-rdoc" > ~/.gemrc

Install Rails

安装Rails

gem install rails

#3


1  

The simplest way for you is Ubuntu where you can use the same console as many other linux guys. If you are persistant you could try Gentoo, Archlinux. Also if you want feel powerefull you could use Tiling WM also VIM, GIT and other console tools

对你来说最简单的方法是Ubuntu,在那里你可以使用和其他linux一样的控制台。如果你是持久性的,你可以试试Gentoo, Archlinux。另外,如果您希望使用powerefull,可以使用Tiling WM、VIM、GIT和其他控制台工具

As for ruby you could use chruby + ruby-install https://github.com/postmodern/chruby

至于ruby,您可以使用chruby + ruby安装https://github.com/postmodern/chruby

#4


1  

Tool such as Vagrant - https://www.vagrantup.com/ - are great because they allow a host (even Windows) to run any number of Linux systems as virtual machines. It's simple to install, great documentation and loads of example configuration - even pre-built Vagrant config for Rails: http://rove.io/?pattern=rails

像Vagrant - https://www.vagrantup.com/这样的工具非常棒,因为它允许主机(甚至Windows)作为虚拟机运行任意数量的Linux系统。它很容易安装,有很好的文档和大量的示例配置——甚至是为Rails预先构建的迷走配置:http://rove.io/?

You install Vagrant on your host machine and then can install any number of different Linux systems as virtual machines, these run your application in isolation and can be configured with any database (Postgres, MySQL,etc). You would edit the code on your host machine using your preferred editor and access the development app using port forwarding in your preferred browser. It's a great tool.

您可以在主机上安装Vagrant,然后可以将任意数量的Linux系统作为虚拟机安装,这些系统将独立运行应用程序,并且可以使用任何数据库(Postgres、MySQL等)进行配置。您可以使用首选编辑器编辑主机上的代码,并在首选浏览器中使用端口转发来访问开发应用程序。这是一个很好的工具。

Personally, I use a Mac and OSX with Vagrant :)

就我个人而言,我用的是Mac和OSX。

#5


1  

After some variants I prefer this:

在一些变体之后,我更喜欢这样:

ubuntu/debian - rbenv - bundler - rails (and other gems)

Here is per-user (preferable) installation manual:

这里是每个用户(更好)的安装手册:

Setup Ruby On Rails on Ubuntu 14.04 Trusty Tahr - GoRails

在Ubuntu 14.04 Trusty Tahr - GoRails上安装Ruby On Rails。

#1


3  

I think the Virtual Machine is the best solution because it is pretty light, can be easily exported/copied (saved in Dropbox also!) and can be destroyed easily too.

我认为虚拟机是最好的解决方案,因为它很轻,可以很容易地导出/复制(保存在Dropbox中!),也可以很容易地销毁。


This is my setup on my personal computer that I use sometimes when I work from home :

这是我在个人电脑上的设置,我在家工作时有时会用到:

  • OS: Windows 7 with Oracle's Virtual Box to manage a virtual machine
  • 操作系统:使用Oracle的虚拟框来管理虚拟机
  • 1 Virtual Machine with Ubuntu 12.04 (I hate the desktop on the new ones and I use gnome-fallback-session)
  • 使用Ubuntu 12.04的虚拟机(我讨厌新版本的桌面,我使用gnome- fallbacksession)
  • Yakuake as terminal manager (very handy: use ctrl+F12 anytime to open a dropdown window containing terminals)
  • Yakuake作为终端管理器(非常方便:使用ctrl+F12随时打开包含终端的下拉窗口)
  • RubyMine as editor to code my stuff
  • RubyMine作为编辑来编写我的代码
  • Thin as the web server (I think this is the default one included in Rails, no need for extra install)
  • 瘦如web服务器(我认为这是Rails中包含的默认服务器,不需要额外安装)
  • git-gui to manage my stuff with Git
  • 用Git来管理我的东西
  • rvm as Ruby Version Manager (means you can work on projects using different ruby versions for each project)
  • rvm作为Ruby版本管理器(意味着您可以为每个项目使用不同的Ruby版本)

My computer is a Asus UX32VD (Notebook), 6 Go RAM, CPU is a small i7. I gave 3 Go of RAM to my Virtual Machine, 1 processor core, and it works great! Very smooth, unless you open tons of tabs and watch several 1080p videos at the same time.

我的电脑是华硕UX32VD(笔记本),6 Go RAM, CPU是一个小i7。我给了我的虚拟机3个内存,一个处理器内核,它工作得很好!非常平滑,除非你打开大量的标签页,同时观看几个1080p的视频。


Some links:

一些链接:

#2


2  

  1. Ubuntu 14.04 works fine. I recommend to use LTS versions. I use VM but as form me it's better for performance to use Ubuntu on your local machine. System requirements for OS you can find here.
  2. Ubuntu 14.04没问题。我建议使用LTS版本。我使用VM,但是作为表单,最好在本地机器上使用Ubuntu。系统对操作系统的要求可以在这里找到。
  3. The rails server command launches a small web server named WEBrick which comes bundled with Ruby. It's enought for development for me. Just use rails s command.
  4. rails服务器命令启动一个名为WEBrick的小型web服务器,它与Ruby绑定在一起。这对我来说是一种发展。只需使用rails的命令。
  5. I use RubyMine and it's brilliant IDE. Strongly recommended for Ruby.
  6. 我用的是RubyMine,它是很棒的IDE。强烈建议为Ruby。
  7. Also I recommend to install Ruby via rvm. It's very simple.
  8. 我还建议通过rvm安装Ruby。很简单。

Run terminal and use following commands:

运行终端,使用以下命令:

Install dependencies for Ruby:

安装Ruby的依赖关系:

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties -y 

Install Ruby

安装Ruby

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev -y
curl -L https://get.rvm.io | bash -s stable

source ~/.rvm/scripts/rvm

echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc

rvm install 2.1.2

rvm use 2.1.2 --default

Speed up your gem installations and have less clutter in your system, remove the rdoc and ri when installing new gems

加速您的gem安装,减少系统中的混乱,在安装新的gems时删除rdoc和ri

echo "gem: --no-ri --no-rdoc" > ~/.gemrc

Install Rails

安装Rails

gem install rails

#3


1  

The simplest way for you is Ubuntu where you can use the same console as many other linux guys. If you are persistant you could try Gentoo, Archlinux. Also if you want feel powerefull you could use Tiling WM also VIM, GIT and other console tools

对你来说最简单的方法是Ubuntu,在那里你可以使用和其他linux一样的控制台。如果你是持久性的,你可以试试Gentoo, Archlinux。另外,如果您希望使用powerefull,可以使用Tiling WM、VIM、GIT和其他控制台工具

As for ruby you could use chruby + ruby-install https://github.com/postmodern/chruby

至于ruby,您可以使用chruby + ruby安装https://github.com/postmodern/chruby

#4


1  

Tool such as Vagrant - https://www.vagrantup.com/ - are great because they allow a host (even Windows) to run any number of Linux systems as virtual machines. It's simple to install, great documentation and loads of example configuration - even pre-built Vagrant config for Rails: http://rove.io/?pattern=rails

像Vagrant - https://www.vagrantup.com/这样的工具非常棒,因为它允许主机(甚至Windows)作为虚拟机运行任意数量的Linux系统。它很容易安装,有很好的文档和大量的示例配置——甚至是为Rails预先构建的迷走配置:http://rove.io/?

You install Vagrant on your host machine and then can install any number of different Linux systems as virtual machines, these run your application in isolation and can be configured with any database (Postgres, MySQL,etc). You would edit the code on your host machine using your preferred editor and access the development app using port forwarding in your preferred browser. It's a great tool.

您可以在主机上安装Vagrant,然后可以将任意数量的Linux系统作为虚拟机安装,这些系统将独立运行应用程序,并且可以使用任何数据库(Postgres、MySQL等)进行配置。您可以使用首选编辑器编辑主机上的代码,并在首选浏览器中使用端口转发来访问开发应用程序。这是一个很好的工具。

Personally, I use a Mac and OSX with Vagrant :)

就我个人而言,我用的是Mac和OSX。

#5


1  

After some variants I prefer this:

在一些变体之后,我更喜欢这样:

ubuntu/debian - rbenv - bundler - rails (and other gems)

Here is per-user (preferable) installation manual:

这里是每个用户(更好)的安装手册:

Setup Ruby On Rails on Ubuntu 14.04 Trusty Tahr - GoRails

在Ubuntu 14.04 Trusty Tahr - GoRails上安装Ruby On Rails。