How to Install Stata 10 for Linux

For Stata 11 and later, licenses are not operating system-specific – you may use the same license on machines running different operating systems. However, if you have a Stata 10 license for Windows, you must get a secondary license to install Stata for Linux. This blog post describes the latter process.

One thing I had to figure out when I switched from Windows XP to CrunchBang Linux was how to install the Stata statistical package in a Linux environment.

I already owned a perpetual license of Stata/IC 10 for Windows, but I didn’t want to confine myself to using the software on Windows via VMware, VirtualBox, or some other virtualization package. I also prefer not to use Wine if I can help it.

Below, I summarize how I installed Stata 10 in my Linux box. This method should work for any Debian or Ubuntu-based distro.

How to Get a Stata 10 License for Linux

If you have a Stat 10 license for Windows, you’ll need to grab yourself a “secondary license” to use the same Stata 10 CD (that you used to install Stata for Windows) to install Stata for Linux.

Submit your request directly to Stata at service@stata.com. You should state whether you are using a 32- or 64-bit platform. My experience with Stata staff over the years has been first class. For this issue, I got my secondary license (for an attractive price) and installed the software in less than 12 hours. (And I’m in a completely different time zone!)
From Stata 11 onwards, licenses are no longer operating system-specific. We can use the same license on different operating systems (Windows, Macintosh, Linux, Oracle Solaris); a secondary license is no longer required.

From Stata 11 onwards, licenses are no longer operating system-specific, which means that the same license can be used on different operating systems ((Windows, Macintosh, Linux, Oracle Solaris); a secondary license is no longer required.

How to Install Stata 10 on Linux

Using a Statalist post entitled “Installing STATA on Ubuntu (Linux) 6.06,” as a reference, I installed the software with no problem.

Step 1: Install Stata

Insert your Stata installation CD into your CD/DVD drive.

As root, create a directory called stata10 and install the software.

# mkdir /usr/local/stata10
# cd /usr/local/stata10 # sh /media/cdrom0/install

Follow the prompts during the installation process. The process will ask you to choose a version of Stata at some stage – dynamically linked, statically linked, etc. I chose a “dynamically linked” version for two reasons: (1) it was possible to do so on my system, and (2) there are some potential benefits. Read about these benefits in the FAQ section of the Stata website:

Why would you want to run the dynamically linked version of Stata?

A dynamically linked version of any executable will have a smaller footprint for both memory and disk space. Newer versions of dynamic libraries may be available that have bug fixes and performance improvements to GTK+-2.0 that a dynamically linked executable will pick up. Also only a dynamically linked version can supports themes from GNOME desktop.

Step 2: Initialize the License

Stata will prompt you to initialize the license:

# ./stinit

Enter the serial number, code, authorization key, and your name and other details. Remember that the serial number, code, and authorization key are different from those used to install Stata in Windows.

Step 3: Add a New Directory to $PATH

To access Stata from the terminal, you will need to add the path to /usr/local/stata10 (created above) to your PATH environment variable.

Find out the shell you are using:

$ echo $PATH

My system uses bash, so I edited ~/.bashrc:

$ gedit ~/.bashrc

Add the following line to the end of the file:

export PATH=$PATH:/usr/local/stata10

Save and exit.

Log out and log in again to include the new directory in your $PATH variable.

Check that the new directory is in your path setting:

$ echo $PATH

You should see /usr/local/stata10 as one directory in the output.

Step 4: Change Permissions

Because /usr/local/stata10 was created by the root user, the latter can only access it. Therefore, people will only be able to use Stata as root, which will be pretty painful.

To access Stata as a normal user, log in as root and change the permissions of /usr/local/stata10:

# cd /usr/local
# chmod 755 stata10
# exit

Step 5: Verify the Installation

Log in as a non-root user, and run Stata from the command line:

$ stata

At the dot prompt, verify the installation:

. verinst

Instead of running Stata from the command line, you can also open the graphical user interface (GUI) version of Stata by typing xstata:

$ xstata

Step 6: Install a Compatible Version of the GTK+-2.0 Libraries

I could not open the GUI version of Stata until I installed a compatible version of GTK+-2.0 libraries.

You can find detailed instructions on how to compile and install GTK+-2.0 here.

Synaptic Package Manager helped complete this task.

Step 7: Update Stata

To update Stata, I navigated to the xstata executable in /usr/local/stata10 as root and did a right-click, which, of course, opened the program. This way of starting the program might seem odd, but I found the explanation in this short post.

At the Stata dot prompt, type:

. update all

followed by:

. update swap

And that’s it. You should have Stata 10 running in Linux.

Leave a Comment