I am here today to ask a question and then answer it. The question is: Can you run Ruby on Rails on a netbook? Specifically, an Acer Aspire One. My motivation is … since buying my netbook, i have completely fallen in love with it, and much prefer it to the desktop computer. I want to do as much as possible on the netbook. I don’t think i’d spend a whole day coding on it, but just for quick little things it could be wonderful!
Now that MyChores is open source i really like this idea of code anywhere. Wherever i have my netbook and an internet connection, i can code! If there’s an emergency bug needs fixing on MyChores, i could make the fix and push it. Or if i’m feeling lazy one Saturday morning there can surely be nothing better than a cup of coffee and coding in bed! ;)
So without further ado, let’s see if you can put Rails on a netbook …
Note from future-me … okay, i have been through this whole process and solved all the dependencies. To save you repeating all my mistakes i will try to lead you through the shortest path.
Dependencies
To get started, there’s a bunch of stuff we can just get from yum. Happy day.
sudo yum install gcc make openssl openssl-dev zlib zlib-devel sudo yum install openssh openssh-clients readline-devel
Ruby
I don’t trust any package managers when it comes to Ruby. I have had too many bad experiences in the past. I always go to rubyonrails.org/down to see which version they are recommending, and i compile it myself. Today it is Ruby 1.8.7, p72.
cd ~/Downloads tar xfz ruby-1.8.7-p72.tar.gz cd ruby-1.8.7-p72 ./configure make make test sudo make install
I always like to do a quick test …
That little irb thing i did just there … i actually did that for real at work today! I was wondering how Hash made use of the Enumerable#any?
mixin. Just in case you were wondering!
Gems
Again, it’s a good idea to check on the Rails site to see if they mention any particular version. Today they don’t so i’m just going to get the latest, which is 1.3.1.
cd ~/Downloads tar xfz rubygems-1.3.1.tgz cd rubygems-1.3.1 sudo ruby setup.rb config sudo ruby setup.rb setup sudo ruby setup.rb install
Cheers, Jim, Chad and Eric from the RubyGems team! :)
gem --version 1.3.1
Database
If you want Sqlite, download the source code from sqlite.org/download.html. You want the one that says “complete source tree”.
cd ~/Downloads tar xfz sqlite-3.6.6.2.tar.gz cd sqlite-3.6.6.2 ./configure make make test sudo make install
You should now be able to
sudo gem install sqlite3-ruby
For MySQL, you want this:
sudo yum install mysql-server mysql-devel sudo gem install mysql -- --with-mysql-config=/usr/bin/mysql_config sudo /etc/init.d/mysqld start
Rails
sudo gem install --no-rdoc --no-ri rails
Note from future-me … yeah i installed all the docs first time around. But then i thought, no way do i want them cluttering up my little netbook. If you installed them and later don’t want them, you can do this …
cd /usr/local/lib/ruby/gems/1.8 sudo rm -rf doc
Now we should be in business.
rails --version 2.2.2
We are winning.
Actually doing something in Rails!
Just a bit of scaffolding. We all like scaffolding, don’t we?! ;) Come on, little netbook, you can do this!
Yes, it can totally do it!
Running the web server
You probably have your own opinion of which web server is best. I personally feel happy with Mongrel, although i want to try some of the others. By default it’s still WEBrick.
sudo gem install --no-rdoc --no-ri mongrel
Let’s have a look, shall we!
Ahhh, scaffolding! :)
Gedit
I don’t want to be running any Netbeans on this little machine, but i have used Gedit before and i get on well with it. It’s not as awesome as TextMate, but then again, what is?
sudo yum install gedit
It has some pretty sweet plugins. Until somebody writes TextMate for Linux, it will do.
Git
If you want to install Git (and if you know what it is, you very probably do!) you may have a problem with perl not being able to find its MakeMaker. I downloaded version 5.8.8 from perl.org/get.html and installed it myself. It took almost forever, but its Configure script was very funny!
cd ~/Downloads tar xfz perl-5.8.8.tar.gz cd perl-5.8.8 sh Configure -Dcc=gcc make make test sudo make install
I then downloaded Git 1.6.0.4 source code from git.or.cz.
cd ~/Downloads tar xfz git-1.6.0.4.tar.gz cd git-1.6.0.4 ./configure make make test sudo make install
The tests appear to run several thousand Git commands, which gives me a huge confidence that my netbook is well up to the challenge! :)
git --version git version 1.6.0.4
You’ll probably also want Gitk which is available from yum.
sudo yum install gitk
It’s a shame i can’t get in to change the font size down. Gitk is blatantly made for huge screens – i can’t even see the whole options dialog box to fix the font.
Conclusion
In answer to my question, i reckon YES! It is possible and joyful to code on a netbook! It runs Rails just fine, and i think i’m going to enjoy it.
I’ll let you know when i’ve cloned a few GitHub repositories and worked on a real project … but the initial signs are looking very good indeed. Just what i wanted to find out! :)
Pingback: A little place of calm » Blog Archive » Gitk on a netbook
Hola,
Thank you for publishing the site:
It invites to look
for a flower,
for a poem,
for you.
Kind Regards,
LOL, that’s the nicest spam comment i’ve ever received! And the first one i’ve ever approved, heh!
Here it is, hoping it rimes with the site. The poem was written by Gabriela Mistral (interesting enough I think that the translation to english, which follows the original spanish poem, clarifies some subtle parts of it. Translation from: http://www.minotaurz.com/minotaur/catsrc/Serene_all.html).
I guess permission should be get to “reprint” the translation from minotaur, which I have not asked for, the spanish however has been partially corrected also without permission and now only the required accents are missing.
Kind Regards,
Octavio.
Palabras Serenas
Ya en la mitad de mis dias espigo
esta verdad con frescura de flor:
la vida es oro y dulzura de trigo,
es breve el odio e inmenso el amor.
Mudemos ya por el verso sonriente
aquel listado de sangre con hiel.
Abren violetas divinas, y el viento
desprende al valle un aliento de miel.
Ahora no solo comprendo al que reza;
ahora comprendo al que rompe a cantar.
La sed es larga, la cuesta es aviesa;
pero en un lirio se enreda el mirar.
Gravidos van nuestros ojos de llanto
y un arroyuelo nos hace sonreir;
por una alondra que erige su canto
nos olvidamos que es duro morir.
No hay nada ya que mis carnes taladre.
Con el amor acabose el hervir.
Aun me apacienta el mirar de mi madre.
Siento que Dios me va haciendo dormir!
Serene Words
Now in the middle of my days I glean
this truth that has a flower’s freshness:
life is the gold and sweetness of wheat,
hate is brief and love immense.
Let us exchange for a smiling verse
that verse scored with blood and gall.
Heavenly violets open, and through the valley
the wind blows a honeyed breath.
Now I understand not only the man who prays;
now I understand the man who breaks into song.
Thirst is long-lasting and the hillside twisting;
but a lily can ensnare our gaze.
Our eyes grow heavy with weeping,
yet a brook can make us smile.
A skylark’s song bursting heavenward
makes us forget it is hard to die.
There is nothing now that can pierce my flesh.
With love, all turmoil ceased.
The gaze of my mother still brings me peace.
I feel that God is putting me to sleep.
Oh, that’s nice! Thanks! I apologise for thinking your comment was spam when in fact it was a legitimate comment.
Thanks very much for the lovely poem.
Great tutorial Aimee :)
Worked great for me, only had to make a few slight amendments in order to get it working for me. I had to run all of the gem setup steps using sudo.
sudo ruby setup.rb config… etc
I also had to grab a copy of mysql-devel as well as mysql-server. Other then that, worked like a dream. Thank you so much!
Good one Richard, thanks for the tips. I’ll add those in.
Hi Aimee,
Thanks for the info. Is it still running Ok? Looking at doing something similar myself with the Samsung NC10 netbook and Ubuntu…I’m just not too sure about performance!
Thanks.
Hi Liam, yeah, it’s working really well! Performance is just fine, i’m pleased to say. The Samsung NC10 looks a similar spec to the Acer Aspire One … 1GB memory and 1.6GHz processor … exactly what i have. I think you’ll be fine!
Is it still running Ok? Thanks for the information.
Which distro are you using Aimee? I've never owned a netbook and love desktop computer. From your commands, I can see you're on Fedora or any other rpm-based distro but your screenshots are giving me some other ideas. Or specifically designed for netbooks like ubuntu's netbook remix?
yes, it is indeed fedora-based. it's the linpus linux which comes by default with acer aspire one netbooks. it uses xfce and puts this n00b interface over the top, which i have since removed!
Which distro are you using Aimee? I've never owned a netbook and love desktop computer. From your commands, I can see you're on Fedora or any other rpm-based distro but your screenshots are giving me some other ideas. Or specifically designed for netbooks like ubuntu's netbook remix?
yes, it is indeed fedora-based. it's the linpus linux which comes by default with acer aspire one netbooks. it uses xfce and puts this n00b interface over the top, which i have since removed!
you say that netbook performs well. How about multitasking? e.g. you have text editor + web browser + some terminals (rails server, rake tests, etc.) running simultaneously. Does it work smoothly?Also I have noticed you are using the default OS for Acer Aspire One (Linpus Lite?). Why don't you use Ubuntu for your web development?
thanks for the information