Fedora + Ruby On Rails Development Environment
The Perfect Web Dev Environment Based on Totally Free Software
Fedora Linux Distribution
Red Hat flavors, while many speculate on future strength in web hosting, still have a significant market share of web-related duties.
No commercialization awkwardness (Unity search ads, anyone?). Live and breath free and open source.
Sane release frequency. Good development pace but doesn't shove new releases down your throat.
Start at the Fedora Project Site. Get the 64-bit, GNOME version which should be default. Don't futz with DVDs! Use the Fedora liveusb-creatorto produce an installation USB stick.
Run through the install process, it's pretty straightfoward. At the end, the first thing you should do is open a terminal and update your system:
Then, get these core package groups:
sudo yum groupinstall "Development Libraries" \ "Development Tools" \ "Editors" \ "MySQL Database" \ "Web Development" \ "Office/Productivity" \ "PostgreSQL Database"
This will get all the basic necessities. I recommend a 'Source' folder in your home directory for keeping bundles of source code you may happen to download, or as a place to throw downloaded program installers.
Putting your cursor in the upper-left corner of the screen triggers Desktop Expose mode. Love this feature, hate this "hot corner." If you agree, easy to disable: Disable Gnome 3 Hot Corner. Simply activate by using the Windows key or clicking Activities.
As browsers go these days, Chrome's where it's at. Sure, you could use Firefox. But Chrome's still where it's at.
Get the only dependency at the time of this writing:
sudo yum install wget redhat-lsb
Go get the 64-bit RPM at the Chrome Download Site, and install:
sudo rpm -ivh (Name of downloaded file).rpm
You should be good to go. Launch, sign in, and customize.
As web developers, we need a great, flexible terminal emulator. The standard Linux terminal works fine but lacks the ability to split up your window into multiple sessions. With a lot of screen space, this is a really important feature. On the OSX side, we have iTerm. On the Linux side, Terminator.
sudo yum install terminator
Get ProggyClean, an attractive monospace font. Go to the download page and get the TrueType version of "proggy clean", the first option. Then, install:
cd ~/Downloads unzip ProggyClean.ttf.zip mkdir /usr/share/fonts/proggy-clean mv ProggyClean*.ttf /usr/share/fonts/proggy-clean/
Terminator's got a few bugs with its preferences dialog, so best to just work directly with the configuration file:
gedit ~/.config/terminator/config
[global_config]
handle_size = 4
title_hide_sizetext = True
title_transmit_fg_color = "#000000"
title_inactive_fg_color = "#909090"
borderless = True
enabled_plugins = InactivityWatch, CustomCommandsMenu, ActivityWatch, LaunchpadCodeURLHandler, APTURLHandler, LaunchpadBugURLHandler
title_transmit_bg_color = "#00a3a5"
tab_position = hidden
title_inactive_bg_color = "#3e3e3e"
[keybindings]
go_left = <Ctrl><Shift>h
go_down = <Ctrl><Shift>j
reset_clear = <Ctrl>k
go_right = <Ctrl><Shift>l
go_up = <Ctrl><Shift>k
[profiles]
[[default]]
use_system_font = False
login_shell = True
background_darkness = 0.86
background_type = transparent
scrollbar_position = hidden
cursor_color = "#00a3a5"
foreground_color = "#ffffff"
scroll_on_output = False
icon_bell = False
font = ProggyCleanTT CE 12
scrollback_infinite = True
This will give you the kind of terminal that's optimized for space, and will allow you to operate splits and tabs almost entirely with the keyboard.
I find one of the most useful layouts is a stack of 3 horizontal splits on half of the screen. Start by pressing Windows key + left / right to split the terminal on one side of your screen. Then, use control+shift+O to split the terminal horizontally. Adjust the vertical sizes with your mouse.
Control + shift + (HJKL): Move between splits.
Control + K: Clear the current terminal output. Useful for tailing logs.
Control + shift + X: Toggle full-window mode. Useful for temporarily seeing more of your split.
Control + shift + T: Open a new tab. I find that I typically won't open more than 2-3 tabs, so seeing the graphical representation of them at the top isn't helpful. See next.
Control + PageUp/PageDown: Switch previous/next tab.
Control + D: End current session/close current tab/split.
Git is universally accepted as the most up-to-date version control system. Its secret sauce is that it works independantly of any server, eliminating any delays from having to connect. Git is also usable completely via command-line. Although its syntax can get pretty insane, the essentials aren't hard to master. Also, Github. 'Nuff said.
Incredibly helpful command shortcuts. These shorten the most common things you'd be typing:
alias gs='git status'
alias gl='git log'
alias gst='git stage -A .'
alias gd='git diff'
alias gds='git diff --staged'
alias gdh='git diff HEAD'
alias gdu='git diff --diff-filter=U'
alias gg='git grep --untracked -i -n'
alias gb='git branch -b'
alias gc='git commit -m'
alias gch='git checkout'
alias gpl='git pull'
alias gph='git push'
alias gbl="git for-each-ref --count=6 --sort=-committerdate refs/heads/ --format='%(refname:short)'"
alias gdm="git diff --staged master"
alias grh="git reset --hard"
git config --global push.default current
git config --global user.name "Your Name"
git config --global user.email [email protected]
Start by executing gs, or git status. This is like your go-to. It is the answer to the question "where am I" or "what was I doing again?".
Check out branches using gch -b branch_name.
When you are ready to commit, use gst or git stage -A. This "stages" all currently modified files -- flipping the "I want this file to be included in the commit" switch. Each can be staged or un-staged independantly, but this will stage everything in your current directory and in all sub-directories.
Review the actual code changes that are about to be committed by typing gds or git diff staged. This shows you a quick list of red/green adds/removals that are about to be commited. Scroll/exit by using J/K/Esc.
When you're ready to commit everything that's green in gs, type gc "A commit message". This makes the actual commit.
You probably find yourself on different computers depending on whether you're at home, work, or on the go. Wouldn't it be nice to sync up your config files so that when you add that Git alias that you wondered how you previously lived without to your bash profile, it is delivered to your other computers? Symlink config files to your Dropbox and keep it all in sync.
Get the 64-bit Fedora client from the Dropbox Download Site.
sudo rpm -ivh (Name of downloaded file).rpm
Now, sync up config files by symlinking to your Dropbox. For example, to sync up your Terminator settings:
cd mv .config/terminator/config Dropbox/.my-terminator-config
ln -s Dropbox/.my-terminator-config .config/terminator/config
Repeat for pretty much anything that has a config file. Vim folder, bash config, instant-messenging clients, etc.
RVM is a must-have the minute you start working with multiple codebases. It provides a slick solution for juggling Ruby versions when you have a bunch of different applications each depending on their own environment.
Grab the only dependency:
sudo yum install libxslt-devel
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled # Or, --ruby=1.9.3
That command should get you Ruby on Rails. However, I've found RVM to occasionally need a little extra prodding. Run the following to make sure you have Ruby and the latest Rails:
rvm get stable
rvm install latest
gem install rails
bundle install
Speed, but not at first. Takes lots of patience and practice, but totally worth it in the long run. With the right set of plugins (below), you'll find GVim goes from useful to mega-useful.
Good news, you already have it. It came with the yum group "Editors" that you installed way up in the Fedora section. Most plugins that we care about come in a bundle called Janus which is hosted on Github. Start by making sure you have the dependencies:
sudo yum install ack ctags
Install Janus. This takes quite awhile because it hits a whole bunch of Git repos, so go grab a coffee or something.
curl -Lo- https://bit.ly/janus-bootstrap | bash
cd ~/.janus
git clone https://github.com/jistr/vim-nerdtree-tabs.git
Totally up to you to find a Vim theme you like, but I recommend Mustang. Being reasonably artistically-oriented, I find the syntax highlighting colors look really great together. Hey, just because you're a back-end developer doesn't mean your code needs to look ugly!
mkdir ~/.janus
cd ~/.janus
mkdir mustang
cd mustang
mkdir colors
wget http://www.deviantart.com/download/98974484/Mustang_Vim_Colorscheme_by_hcalves.vim
The most mature MySQL graphical client for linux. Feels the most natural and full-featured out of all seven or so options. Unfortunately, it isn't perfectly stable. I found that it tends to crash about once every two or so days of fulltime work, which is acceptible for the robustness of the application.
sudo yum install mysql-workbench
Pretty straightfoward, connect via local pipe (leave the path blank).
While slightly tacky, Base stood out from all other options I tried when it came to PostgreSQL admin'ing. It's a pretty simple program (after you get past initial set up and connection), and it's stable.
sudo yum install libreoffice-base
I don't use it enough to remember how I set it up. But, someday I'll fill this out!