Sunday, April 29, 2012

Installing Ruby and Rails on Fedora with RVM


Please note, I'm using the Fedora 17 Beta, but this should work on older versions as well. Each of these commands should be run in a Terminal window.

First, ensure you have your Fedora install up to date:

sudo yum update

Next, let's install the prerequisites we will need:

sudo yum install git-core curl make bzip2 gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel libxslt-devel sqlite sqlite-devel openssl openssl-devel

We are now ready to install RVM:

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

...followed by,

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc

Optionally, you can add the following to the end of your .bashrc file to gain additional git features in your bash prompt:

PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '

Finally, reload your .bashrc file with the following command:

. .bashrc

Ensure that RVM is loaded with the following command, which should output "rvm is a function":

type rvm | head -1

The following steps will install Ruby, Rails and the Sqlite3 gem. Execute these in order:

first,

rvm install 1.8.7

then...

rvm use 1.8.7 --default

and then...

rvm install 1.9.3

after that...

rvm use 1.9.3 --default

followed by...

gem install rails

...and finally,

gem install sqlite3

After that, check out some code and bundle it up (bundle install) or create a new rails app (rails new testapp).

Sunday, April 22, 2012

My personal Fedora 17 install and setup guide...

Update: Since first writing this, I have found this awesome little utility that automates many of the steps here. Please be sure to check it out!

I know there are folks out there who are currently Ubuntu users that might want to give Fedora a go like I did. Fedora is a little different in that it adheres more closely to Free Software standards (which I think is great). There are still, however, quite a few things I'm not willing to give up personally for the sake of software freedom (yet). Among those are Google Chrome, Virtualbox, Flash, Dropbox and MP3 playback.

Following is the process I went through to get Fedora 17 set-up and packages I needed installed.

We will need to add a few repositories along the way.

The first one is RPM Fusion. This repo is a 3rd party supplement to Fedora (and RHEL/CentOS) that allows for installation of various non-free bits. There is quite a bit there, but I'm primarily concerned with getting MP3 playback.

To get this repo installed, simply execute the following in a terminal (blogger breaks this up a bit - this should all be one command):

sudo yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

Now, we can install the packages needed for MP3 playback:
sudo yum install gstreamer-plugins-ugly

Next we need Adobe Flash:

(In a terminal:)

For 32-bit:

sudo rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm 
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux


For 64-bit:

sudo rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm 
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux

Now, simply:
sudo yum install flash-plugin

Next, let's add VirtualBox:


Open a terminal and change to your /etc/yum.repos.d folder. Once you have done that, you can simply download the repo file:
sudo wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo


You could also create the file by hand, if if you wanted:


sudo touch virtualbox.repo
followed by: 
sudo vi virtualbox.repo


Replace 'vi' with your editor of choice...nano is easy to use if you aren't familiar with vim.
Include the following in your new file:


[virtualbox] 
name=Fedora $releasever - $basearch - VirtualBox baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/$releasever/$basearch 
enabled=1 
gpgcheck=1 gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc






We now need to make sure our system is up-to-date:


sudo yum update


If you updated your kernel packages in the previous step, go ahead and reboot now.


Once you've rebooted, we can install a few prerequisite packages:


sudo yum install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms


And finally, VirtualBox itself:


sudo yum install VirtualBox-4.1


We can now build the VirtualBox kernel module:


sudo /etc/init.d/vboxdrv setup


And add VirtualBox User(s) to vboxusers Group (Replace user_name with your own username).


sudo usermod -a -G vboxusers user_name

Since I first wrote this article I've discovered that VirtualBox is in RPM Fusion, so this step is pretty unnecessary. Also, RPMFusion has an akmod package to keep the modules up-to-date.

sudo yum install VirtualBox akmod-VirtualBox


You will need to reboot before using Virtualbox.

Now for Dropbox:

Open a terminal back up, and 'cd' into your /etc/yum.repos.d folder once again, and download the repo file:

sudo wget http://dl.dropbox.com/u/30876345/repo/dropbox.repo

You could also create the file by hand, if if you wanted:

sudo touch dropbox.repo
followed by: 
sudo vi dropbox.repo

Include the following in your new file:

[Dropbox] 
name=Dropbox Repository 
baseurl=http://linux.dropbox.com/fedora/$releasever/ gpgkey=http://linux.dropbox.com/fedora/rpm-public-key.asc

After that, simply:

sudo yum install nautilus-dropbox

Now, let's tackle Google Chrome. Go back into /etc/yum.repos.d in your terminal, and create the repository file:

sudo touch google-chrome.repo

and

sudo vi google-chrome.repo

and add the following to the repo file:

(If 32-bit):

[google-chrome] 
name=google-chrome - 32-bit baseurl=http://dl.google.com/linux/chrome/rpm/stable/i386 
enabled=1 
gpgcheck=1 
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

(if 64-bit):

[google-chrome] 
name=google-chrome - 64-bit baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64 
enabled=1 
gpgcheck=1 
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub

Now, you can install Google Chrome with any of the following 3 commands:

sudo yum install google-chrome-stable
sudo yum install google-chrome-beta
sudo yum install google-chrome-unstable

I have always run the beta version personally - nice mix of bleeding edge and stability

Finally, you may want to enable Infinality's font rendering patches - they are very nice, and I reccomend them:


sudo rpm -Uvh http://www.infinality.net/fedora/linux/infinality-repo-1.0-1.noarch.rpm

sudo yum -y install freetype-infinality fontconfig-infinality libXft-infinality


You will now be well on your way to getting Fedora 17 set up quite nicely for desktop use. There are obviously a few more packages I install, such as: Filezilla, htop, gimp, git-core, curl and a few other odds and ends I can't think of at the moment.

Happy computing!

Thursday, April 12, 2012

My custom Bash prompt...

Update:

So, after living with this for a while, I decided that the prompt would get too long. Also, I wanted to use the same format as the default Red Hat style prompt.


Here is an updated screenshot of what I'm using now:







And now, the original post if you want to see what I *was* using: Until recently, I'd never really done a lot of customization on my Bash prompt - I just kinda rolled with what the distro gave me, but I recently discovered git_ps1 and decided to start tweaking some, and this is what I came up with:



And here is how it looks (I'm using gnome-terminal with "White on Black" colors and the "Xterm" color pallete):

















Sunday, April 8, 2012

So you wanna contribute to Ubuntu?

You don't have to be a programmer, designer, tester or technical writer to contribute to Ubuntu. You just have to be a knowledgeable user.

Have you seen AskUbuntu yet? If not, head over now, set up an account and you too can start helping follow Ubuntu users out. It's one of the many great things about Ubuntu that other distros simply don't have, although honestly, I wonder why other distros haven't set up a Stack Exchange site.

Outside of Ubuntu, Stack Exchange is a great ecosystem of sites full of helpful folks eager to answer your question!