7 ms·
Get Ruby and Rails running on Ubuntu with one command
- joshfng 16y agoThis also installs git, I updated the readme. It's a very simple script so if you guys see any ways to improve it let me know.
- deleted 16y ago[deleted]
- Dobbs 16y agoCouldn't you just do: wget https://github.com/joshfng/railsready/raw/master/railsready.sh https://github.com/joshfng/railsready/raw/master/railsready.... && bash ./railsready.sh Besides the "1" command is really 4. If you are setting up enough VM's that you need this you should have something like puppet installed and don't need this. If you are setting up one machine then do it by hand. Know the tools you have installed and keep track of them it will make deployment easier.
- jseifer 16y agoWish this was around a week ago when I did this all manually.
- l3amm 16y agoAgreed, now if only someone could write the one line command to robustly install couchdb on ubuntu.
- rmc 16y agoThat is many commands, but it's only one line. And there's something in the inner-sysadmin in me that sees "curl http://example.com/foo.sh http://example.com/foo.sh && ./foo.sh" and shudders. That sounds like a receipe for disaster.
- j2d2j2d2 16y agoNothing wrong with reading the script before running it. :)
- rmc 16y agoOh I know. However we both know the majority of people who use this one-liner won't read it.
- joshfng 16y agoIt's no different that installing RVM bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head http://rvm.beginrescueend.com/releases/rvm-install-head ) or NPM curl http://npmjs.org/install.sh http://npmjs.org/install.sh | sh. If you run something without knowing what it does first and brick your system there's no one to blame but yourself :)
- joshfng 16y agoFeel free to read the script before executing it :)
- bad_user 16y agoIt's a bitch rubygems are so fucked up on Debian/Ubuntu and that Ruby 1.9.2 is still not in Ubuntu's repo. Otherwise that line would be: sudo aptitude install ruby1.9.2-full && sudo gem install rails
- diego 16y agoThat's what rvm is for. Leave the system Ruby alone and install your own, even multiple versions. I have ruby 1.8.7 with rails 2.3.5 and 1.9.2 with 3.0.3, easily switch between them for testing. http://rvm.beginrescueend.com/ http://rvm.beginrescueend.com/
- rm445 16y agoOblig. bash.org, http://www.bash.org/?464385 http://www.bash.org/?464385 <@insomnia> it only takes three commands to install Gentoo <@insomnia> cfdisk /dev/hda && mkfs.xfs /dev/hda1 && mount /dev/hda1 /mnt/gentoo/ && chroot /mnt/gentoo/ && env-update && . /etc/profile && emerge sync && cd /usr/portage && scripts/bootsrap.sh && emerge system && emerge vim && vi /etc/fstab && emerge gentoo-dev-sources && cd /usr/src/linux && make menuconfig && make install modules_install && emerge gnome mozilla-firefox openoffice && emerge grub && cp /boot/grub/grub.conf.sample /boot/grub/grub.conf && vi /boot/grub/grub.conf && grub && init 6 <@insomnia> that's the first one
- joshfng 16y agohaha updated to read "A setup script to get Ruby and Rails running on Ubuntu server in one line". The first draft of the script was one command originally.
- telemachos 16y agoThis strikes me as no easier than rvm, but less clean (installations go to /usr/local, no easy way to switch between various ruby interpreters or gemsets, harder to uninstall, etc.). Why not just do this? 1) Update whatever requirements you need via APT tool of choice. 2) Install rvm 3) Install ruby-1.9 using rvm 4) gem install rails 5) Write great rails app.
- tibbon 16y agoHmm, maybe putting together a oneliner for that would help a lot of people. Added to my todo list.
- colbyolson 16y agoI don't understand the point of using a one-liner vs just doing it in a process and getting an understanding of whats going on at each step.
- joshfng 16y agoI totally agree that you should become fully comfortable with setting up a box manually. But when you perform the same setup over and over and have the process memorized as I do then writing a little shell script to get the job done never hurts.
- colbyolson 16y agoI agree, and perhaps I should have added that into my comment. For a newbie, have them walk through it, but for the repeated process, then automate it.
- cosgroveb 16y agoI posted the following guide the other day: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you Sadly it languished with no upvotes. :( I found it extremely useful, however!
- thibaut_barrere 16y agoI now prefer using chef-solo, which allows to tweak and add the remaining bits very quickly once you know how to use it!
- joshfng 16y agoJust a FYI I changed the script to install Ruby to /usr/local thanks to some input from a Github user. Also people are forking it and setting it up to install RVM so feel free to check those out as well!
- telemachos 16y agoI believe your earlier version already was installing to /usr/local. You've just made it explicit. Most configuration scripts accept a --prefix option, but default to /usr/local if you omit the option. I'm pretty sure that Ruby works that way, and it's exceedingly common. (Not that the explicitness isn't a good idea. You don't want to rely on a default without being sure.) Follow-up: partial output of ./configure --help in a Ruby source directory: > By default, `make install' will install all the files in `/usr/local/bin', `/usr/local/lib' etc. You can specify an installation prefix other than `/usr/local' using `--prefix', for instance `--prefix=$HOME'.
- mattyb 16y agoSome comments & questions from someone who's worked on something similar: -What's extglob used here for? I don't see any regexes. -What are libffi-dev and libyaml-dev for? I assume some common gems depend on them. If so, which? (I'm just getting into Rails.) -Git in the Maverick repos is old (1.7.1, which was released in April). Installing it from source is probably a better idea. -You should probably use RVM to install Ruby, since its 1.9.2-head target won't require you to keep updating your script with 1.9.2's patchlevel. -In my rails3.sh (which I should really publish), I didn't need to `gem install bundler` in order for `bundle install` to work. Probably because `rails` depends on `bundler`. -That sudo check is neat, and I'd like to lift it; what's this script's license?
- joshfng 16y agoextglob is in there for future improvements. I plan to make it robust enough to accept parameters in the future. When building Ruby the output complained about some missing deps. libffi-dev and libyaml-dev made Ruby stop complaining about them :) Bundler is installed on the system because you don't have to install Rails on the system. You could simply put Ruby on there, install bundler then when you upload your app and run "bundle" it will pull down Rails and any gems your app depends on. Having Bundler available on the system is needed if you don't install the Rails gem system wide. Use the script however you see fit and feel free to take from it what you like :)
- DanI-S 16y agoNice! It'd be nicer if it used RVM, though. Might try rolling my own. If anyone else wants to try, or is otherwise interested, I wrote a step-by-step guide to getting Rails on Ubuntu with RVM: http://news.ycombinator.com/item?id=2113525 http://news.ycombinator.com/item?id=2113525
- joshfng 16y agoIt offers the choice now of build from source or RVM
- calvin 16y agoNote to the wise: do not run this on a production machine unless you understand the full consequences of what the script is doing. This is great for starting out a new machine and getting things setup, but running the update and upgrade commands without consideration of what's being updated could cause a lot of headaches if any existing sites running on the server have dependencies that are botched by the upgrade.
- joshfng 16y agoThe README advises to run on a fresh install. Install Ubuntu, run railsready, have fun :)
- wayneeseguin 16y agoHere is a script that I wrote and have been using, should work on most Linux's and OSX to bootstrap a Rails Development environment. Also ensures that git is installed. You can run it with one command (after reading it's contents of course) as follows: curl -O https://github.com/wayneeseguin/rvm/blob/master/contrib/bootstrap_rails_environment https://github.com/wayneeseguin/rvm/blob/master/contrib/boot... && source bootstrap_rails_environment This automates installing the prerequisites across many Linux package management types and then bootstraps a Rails development environment using RVM.
- mattyb 16y agoA few questions: -Why Ruby 1.8.7 and not 1.9.2? -I've installed 1.8.7, 1.9.2 & 1.9.2-head via RVM without having libyaml-dev or libffi-dev installed (I see they're listed in `rvm notes`). Any idea what's up here? Thanks!
- wayneeseguin 16y agoRead the script, it's adjustable. Download, change your version and run. They are listed as they help 'cover all bases' as they are used by some gems that people might need.
- jschuur 16y agoRelated and very recent: http://hivelogic.com/articles/setup-guide-rails-stack-with-passenger-rvm-bundler-apache-and-mysql-on-ubun http://hivelogic.com/articles/setup-guide-rails-stack-with-p...
- joshfng 16y agoI have updated the script to ask you if you want to build Ruby from source or install RVM (Wayne from RVM pointed me in the right direction)
- joshfng 16y agoJust so you guys know this script has changed a lot since I opened it up. It now has way better output formatting, the option to install Ruby from source or RVM, better stdout and stderr redirection to the install.log and even captures signals for things like ctrl-c to kill the script nicely. Thanks for all the input and I hope it's found to be useful :)
- vysogot 16y agoIf anyone is looking for a Debian Lenny config script (RVM, Apache, Passenger, SQLite), here it is: https://github.com/vysogot/railsready-debian-lenny https://github.com/vysogot/railsready-debian-lenny Debian has some differences.
- fenderplayer 16y agoI just ran the script on Ubuntu 10.10 (64bit) but when i run "rvm list" or any other rvm command i get the following error: /usr/local/bin/rvm: line 73: /home/myuser/.rvm/scripts/rvm: No such file or directory Whats wrong here?
- fenderplayer 16y agook... i had run the script as root and was trying to run as a normal user, thats why the error....fixed now