#! (Crunchbang) for Economists

This guide walks you through my current setup of a (mostly) open source system for conducting economic research. There is actually a substantial amount of work involved in setting up this system. While there is no need to complete this entire setup in one sitting, you will want to at least be prepared to spend 30 minutes for the installation of the operating system (Crunchbang).

Overview

This guide will be updated as I add or remove software from my system in hopes of providing you all the tools you will need for economic research. (Note: You can actually make this system totally free (as in “free beer”) by skipping the Stata step, and not paying for Sublime Text 2. I have to use Stata for some projects, and I paid for Sublime Text 2 because it’s awesome.) Here’s a table of contents for the steps we will follow: Install OS: #! Crunchbang Linux Install Software: Wine Stata R and RStudio LaTeX Sublime Text 2 GeoGebra JabRef Dropbox Google Chrome Configure Settings: Update the Main Menu Update the Keybindings Setup Issues

Step 1: Install #! Crunchbang Linux as your OS.

This step requires some commitment on your part if, like me, you choose to solely run this operating system. It is possible to dual-boot, you just need to partition your hard drive so there is enough continuous free space for Crunchbang. If you are considering dual-booting on a Mac check the forums for the most recent advice (http://crunchbang.org/forums/viewtopic.php?id=17257). On many PCs designed for Windows 8, UEFI makes dual-booting Windows and Linux a bit too advanced for this guide (see https://help.ubuntu.com/community/UEFI). Download the *.iso from http://crunchbang.org/download/waldorf, you will need to pick the version that matches your system’s architecture (i.e. 32-bit or 64-bit). I followed these instructions, http://crunchbanglinux.org/wiki/statler_usb_installation, to install via a bootable USB drive. During installation, I setup three partitions out of my total 120 GB:

  • 40 GB for /, bootable (big I know, but I like to try lots of applications and TeX is huge)
  • 70 GB for /home, (this is a safety mechanism to help protect your documents and settings)
  • 10 GB for swap

Read more about partitions here.

Step 2: Install Wine

Enter a terminal. You can do this be pressing Super+T (super is the Windows key on a PC) or be right-clicking on the desktop and selecting the Terminal item. Enter the following command (Note: In all terminal examples, “$” represents the command prompt and is not to be typed out.):

$ sudo apt-get install wine

Note: Because of my 64-bit system this required more steps (see Wine wiki, the official source):

  • Run wine (ALT+F3 wine ENTER) for the prompt.
  • Open a terminal to type the requested commands

Step 3: Install Stata using wine to run the install.exe.

To install, open a terminal, navigate to the location of the Stata install CD/USB, and enter the following command:

$ wine install.exe

To run the application you will need to locate where it was installed, for me this was in

~/.wine/drive_c/Program\ Files/Stata12/Stata.exe

. We will write a script and setup a symbolic link to make accessing Stata easy. First make the script:

$ mkdir --mode=777 ~/sh $ editor ~/sh/stata.sh

Type the following command in the script:

wine $HOME/path/to/stata/Stata.exe

(press CTRL+O to save, hit Enter to confirm, then hit CTRL+X to exit) Now, back in the terminal enter the following commands:

$ chmod 777 ~/sh/stata.sh $ sudo ln -s $HOME/sh/stata.sh stata

Now Stata can be run with the command stata from anywhere within the terminal or from the ALT+F2 and ALT+F3 program launchers.

Step 4: Install R and RStudio

R

Enter the following command in the terminal:

$ sudo apt-get install r-base 

RStudio

Go to http://www.rstudio.com/ide/download/desktop and download the newest version for Debian/Ubuntu, save the file. Open the File Manager (via right-click menu from the desktop) and choose the Downloads folder. Right-click on the *.deb file, select Open with “GDebi Package Installer” (or use the “Open with Other Application” option to change the default to “GDebi Package Installer”). Click on “Install Package”.

Step 5: Install LaTeX

Enter the following command in the terminal (this is a huge download, approximately 2.7 GB and takes a long time to be unpacked, so be prepared to wait)

$ sudo apt-get install texlive-full

Note: I chose full because I am lazy. Essentially, I don’t want to search and install individual packages I need to use with LaTeX.

Step 6: Install Sublime Text 2

Download the newest version from http://www.sublimetext.com/2 (some installation instructions: http://docs.sublimetext.info/en/latest/getting_started/install.html#linux) Once the download is complete, enter the following commands in the terminal:

 $ cd /usr/lib $ sudo tar vxjf $HOME/downloads/Sublime\ Text\ 2.0.1\ x64.tar.bz2 $ sudo ln -s /usr/lib/Sublime\ Text\ 2/sublime_text /usr/bin/subl 

Step 7: Install GeoGebra

Go to (http://www.geogebra.org/cms/en/installers), click on “Linux”, and Choose “Debian”. Follow the instructions (Note: To run a command as root, type “sudo ” before the command).

Step 8: Install JabRef

In the terminal enter the following command:

sudo apt-get install jabref

Step 9: Install Dropbox

This is easy. Simply find “Install Dropbox” in the right-click main menu (also accessible from Super+SPACE). Network > Dropbox > Install Dropbox dropbox_install

Step 10: Install Google Chrome

Use the built-in web browser (Iceweasel, Super+W), navigate to google.com (Note: the default start page is not actually Google), click the “Install Google Chrome” link. Click “Download Chrome”, and choose the appropriate *.deb file for your architecture (i.e. 32-bit or 64-bit). Once you have downloaded the file click on the download to start “GDebi Package Installer”. Click “Install Package”, put in your password, and you are ready to go.

Step 11 :Update the Main Menu

Using the right-click main menu (or Super+Space), Click on Settings > Openbox > Edit menu.xml menu Around line 41, change the command for “Text Editor” from “geany” to “subl”.

 <item label="Text Editor"> <action name="Execute"> <command> geany </command> </action> </item> 

Further down (around line 68), above the “Geany Text Editor” item in the “Accessories” group:

 <item label="Geany Text Editor"> <action name="Execute"> <command> geany </command> </action> </item> 

add the following lines:

 <item label="Sumlime Text 2"> <action name="Execute"> <command> subl </command> </action> </item> 

(you could optionally use CTRL+H to replace all occurances of “geany” with “subl”, I chose to leave the remaining defaults, since Geany magically (i.e. out-of-the-box) uses the appropriate syntax highlighting for all the config files.) Now it’s time to turn this menu up to 11! In this step we will create a “Toolbox” folder in our menu (you can call this “Economics”, “Winterfell”, or whatever floats your boat). Just add the following lines after “” and before the “Accessories” menu (around line 53):

 <menu id="toolbox" label="Toolbox"> <item label="RStudio"> <action name="Execute"> <command> rstudio </command> </action> </item> <item label="Stata"> <action name="Execute"> <command> stata </command> </action> </item> <item label="GeoGebra"> <action name="Execute"> <command> geogebra </command> </action> </item> <item label="JabRef"> <action name="Execute"> <command> jabref </command> </action> </item> </menu> 

You will need to restart your machine for these changes to take effect. You can see below what your new menu should look like: newmenu

Step 12: Update the Keybindings

Using the right-click main menu (or Super+Space), Click on Settings > Openbox > Edit rc.xml Find the section (approx. line 330):

 <!-- Keybindings for running applications -->

Find the item for the text editor:

 <keybind key="W-e"> <action name="Execute"> <startupnotify> <enabled>true</enabled> <name>Editor</name> </startupnotify> <command>geany</command> </action> </keybind>

Change “geany” to “subl”. Now you can assign any new keybindings you want. For example I want to add a keybinding for Stata, RStudio, and GeoGebra. A first step is to check that the keybindings for “W-s”, “W-r”, and “W-g” are not already in use. To set the appropriate keybindings just add the following lines before or after the item you for the Editor.

<keybind key="W-s"> <action name="Execute"> <startupnotify> <enabled>true</enabled> <name>Stata</name> </startupnotify> <command>stata</command> </action> </keybind> <keybind key="W-r"> <action name="Execute"> <startupnotify> <enabled>true</enabled> <name>RStudio</name> </startupnotify> <command>rstudio</command> </action> </keybind> <keybind key="W-g"> <action name="Execute"> <startupnotify> <enabled>true</enabled> <name>GeoGebra</name> </startupnotify> <command>geogebra</command> </action> </keybind> <keybind key="W-j"> <action name="Execute"> <startupnotify> <enabled>true</enabled> <name>JabRef</name> </startupnotify> <command>jabref</command> </action> </keybind>

You will need to restart your system for these changes to take effect.

Setup Issues:

The following issue was specific to my machine (HP Touchsmart tm2t-1100), your mileage may vary. Issue: Brightness too low by default. Actually, the backlight was off initially.

$ sudo editor /etc/rc.local

add the following line before “exit 0”:

echo 10 | sudo tee /sys/class/backlight/acpi_video0/brightness

(you can set a brightness level less than 10 if you want to startup slightly dimmed). 10 was the maximum value for me, you can find your maximum by running the following line in the terminal:

cat /sys/class/backlight/acpi_video0/max_brightness

(CTRL+O, Enter, CTRL+X, to save, confirm and exit.) For me the most recent Linux kernel (linux-image-3.2.0-4-amd64) did not listen to my brightness settings. Since I am fine running linux-image-3.4.0-3-amd64 instead, I edited grub:

$ sudo editor /etc/default/grub

so that the defualt line reads:

GRUB_DEFAULT=2

Run the following command to update the grub.cfg:

$ sudo update-grub

This sets the default option to the third entry which for me is the 3.2.0-3 kernel.

Final Notes

That’s it for now, soon I will post a few ways to customize your new sweet system. Feel free to leave any notes or questions in the comments below.

Comments

  1. Heelguru says:

    Why would you install the Stata windows binary? There’s a linux native version…Thanks for the post anyway.

    • @Heelguru: First of all, thanks for the comment! Unfortunately a package I needed for a paper I was working on (the synth package from Abadie, Heinmueller, and Diamond) would not run on the Linux native version. Using the Windows binary allowed me to run the package while staying in #!.

Leave a Reply