Installing Stata on Ubuntu or Linux Mint

For those like myself who have recently switched to the Linux operating system, installing programs that are not in the Ubuntu repositories can be a challenge at times. I recently installed the statistical analysis program Stata on my computer running the latest stable version of Linux Mint Gloria, which is a fork of the popular Ubuntu Linux distribution. But, more about my choice of Linux distro later. On to installing Stata on linux.

sudo mkdir /usr/local/stata10
cd /usr/local/stata10
sh /media/cdrom/install

Next, follow the prompts to install the program. The Stata install CD includes versions for several operating system so just pay attention. If you want to run the GUI version of Stata just like on windows then you’ll want to select the dynamically linked version in step three of the install.

After the files have been copied run the license install program by typing:

sudo ./stinit

If there is an error you may need to change the permissions on the stata10 folder before starting the license program. Try typing:

sudo chmod -R 755 /usr/local/stata10

Enter the serial number, code, and authorization key and you’ll be prompted to enter some info that will appear when Stata starts. I chose to enter my name on the first line and my job title on the second. Now you should be able to run Stata from the command line by typing:

./stata

or you can run the GUI version of Stata by typing:

./xstata

At first try I was able to run Stata from the command line but when I tried to run xstata I got the following error:

./xstata: error while loading shared libraries: libtiff.so.3: cannot open shared object file: No such file or directory

After consulting a document on the Stata website, I was still confused about what to do but after further search I was able to run xstata by running the following commands. If you are running a recent version of Ubuntu such as 9.04 – 10.04 the following should work:

sudo ln -s /usr/lib/libtiff.so.4 /usr/lib/libtiff.so.3

After upgrading to the latest version of Ubuntu, Maverick Meerkat (10.10), a new version of libtiff is included so the following softlink should be used instead of the line above.

sudo ln -s /usr/lib/libtiff.so.4.3.3 /usr/lib/libtiff.so.3

Mostly, this post serves as a reminder to myself how to re-install if I have to but if you find this useful, leave me a comment below. Good luck!

Comments on this article can be sent to me by e-mail..

25 Responses to “Installing Stata on Ubuntu or Linux Mint”

  1. Gabi writes:

    I’m going to add this to my RSS reader so I’ll know when you decide to write down your reasons for picking Mint. I just wanted to remind you to do so. I am curious. What kept me to trying any Linux at all for a long time — and sent me to FreeBSD instead — was the truly bewildering range of distros, and with it all the Internet litter of strong views on which one is best. FreeBSD has one number — currently 7.2, I think — and that’s that. It was comforting. Then of course I noticed that with Ubuntu you have all this great support from users all over the world.

  2. Andrew writes:

    To be honest, I didn’t even consider FreeBSD because my main computer is a laptop and I thought of FreeBSD as a server OS.

    But, after your comment I didn’t a little research and downloaded FreeBSD, PC-BSD and DesktopBSD to try out. So far I’ve got FreeBSD running in a virtual machine but the others didn’t want to install first try and may need more massaging.

    The next time I re-format FreeBSD will definitely be something I consider.

  3. John Marquess writes:

    Andrew,
    did yo purchase a licence for the Linux version of STATA. I have a Windows license and when I tried to install the *nix version on the install disc is refused to let me past the serial number entry.

    I hear that since version 11 of STATA you can install it on multiple platforms from the same disc. this kinda sucks for people like me who paid for version 10.

    J.

  4. Andrew writes:

    I have Stata 11 now and you are correct, the license works on both my Windows machine and my Ubuntu computer.

    I’ve heard that if you have a license for the Windows version of Stata you can get a *nix license from Stata Corp. for a small fee. Let me know what happens if you go this route.

    Also, I’ve heard that people have some success running Stata 10 under wine. In my experience it didn’t work so well. There is a thread about Stata on the Ubuntu forums here: http://ubuntuforums.org/showthread.php?t=870519

  5. Moses Ndiritu writes:

    Had similar experience. What is more annoying now is that everytime i open the dofile editor, stata gui quits unexpectedly. Any ideas how to resolve this?

  6. Andrew writes:

    The do-file editor in Stata 10 wasn terrible, IMO, so I used an external text editor and never noticed the crash. With Stata 11, however, the do-file editor is much improved and I have experienced the GUI crash you mention. I haven’t solved it since I figured it would be more time consuming than using gedit or Komodo Edit (which I highly recommend) but now I’ll look into it a see what I find. I half expected that it was just a bug unique to my laptop.

    P.S. If you read this I would like to get in contact with you to learn more about VIS Kenya.

  7. Moses Ndiritu writes:

    Thanks for the response. I managed to find a solution on another blog post i cannot quite remember. Instead of creating a soft link to libgtksourceview that comes with the Ubuntu distribution, install libgtksourceview-1.0.so.0. I would be happy to talk with you more on VIS Kenya and what i do – i like you piece on open data sharing as i am a clinical epidemiologist and this concept has began to gain a reasonable momentum. You can contact me via my email which i have provided on your blog.

    sudo apt-get install libgtksourceview-1.0.so.0

  8. Andrew writes:

    I looked around for that blog post you mention and I think I found it. So to give credit where credit is due, the post to fix the do-file editor crash problem is here and the answer is in the comments.

    However, I had to install libgtksourceview1.0-0. Perhaps we have different software source files.

    sudo apt-get install libgtksourceview1.0-0

  9. david writes:

    thanks for the post and the comments, really helpful!!

  10. tom writes:

    this is much more helpful than the official explanation…thanks guys

  11. Andrew writes:

    Thanks for stopping by David and Tom.

    I’ve updated the post to reflect changes in Ubuntu 10.10, Maverick Meerkat.

  12. John writes:

    Thanks for this. I finally got it working.
    J.

  13. Gerard Lee writes:

    Or you could install the static libarary to prevent further re-install in the /opt directory provided the /opt directory resides in another partition of your hdd. that way, stata10 will be re-install free, with all the necessary upgrades still in-tact even if you upgraded operating system to a different linux version. =)

    just make path include /opt/stata10

  14. anonymous writes:

    I really don’t like the Stata GUI in X Windows and am not sure that it has many advantages over running Stata in the Linux command line in terminal. When I really want to use the .do file editor, graphics editor, variables manager, etc. I much prefer the GUI under OS X and/or Windows 7.

  15. Javier Zamora writes:

    Helpful. Thank you. You gave me the right clue. However, the library libtiff in my computer was at
    /usr/lib/i386-linux-gnu/libtiff.so.4.3.3

    Thanks again

  16. Amir writes:

    Abdrew,

    I installed (dynamically linked) stata11 in ubuntu 11.04 in /usr/local/stata11 and added a launcher for stata to Unity Launcher. It works well, but stata (or ubuntu) can not remember to use stata icon for .dta, .gph .do, files!

    thanks

    Amir

  17. Andrew writes:

    I’ve noticed this as well but it just hasn’t been a concern for me to have the stata icon on do files etc. That said, if you find an answer I’d love to hear about how to make it happen.

  18. Nikos Gouzgounis writes:

    Hey all
    I just run into a small problem and i see that other have seen it before.
    I am installing Stata 11 on a Debian machine the libgtksourceview-1.0.so.0 has a bitch so what i did i linked it to the version 2 i had install and it worked like charm. You do not need to install libgtksourceview-1.0.so.0: just use

    /code beging

    sudo ln -s /usr/lib/libgtksourceview-2.0.so.0 /usr/lib/libgtksourceview-1.0.so.0

    /code end

    that is if you want the xstata to work :)

    I hope someone will find it useful in the future

    Nikos

  19. Getting started with Stata 11 on Ubuntu Linux | Behavioural economics & web technology blog writes:

    [...] familiar with Linux package dependencies you might disagree, and check out the blog posts by Andrew Dyck and Jonas Ranstam for helpful post-installation instructions for the dynamically linked [...]

  20. Rich C writes:

    Andrew,

    Thank you for having this info up on your blog. It helped me during the installation process of Stata12/IC to my Ubuntu Linux 10.04-running laptop.

    Rich C

  21. Andrew writes:

    Your welcome Rich. I haven’t tried Stata 12 yet so I’m glad to hear that this install process works for the newest Stata version.

  22. Rich C writes:

    sudo apt-get install libgtksourceview1.0-0

    ^^^ Very important to get Stata12/IC (./xstata in terminal window) to work properly in a GUI environment on 10.04.

    Rich C

  23. Andy Teh writes:

    A very helpful post. Thank you. I just installed Stata 10 on CrunchBang Linux with minimal hassle using your instructions (with some minor alterations). The only way I could update all was a right click on the xstata executable in /usr/local/stata10 as root. An attempt to change permissions from the command line didn’t work for me.

  24. How to Install Stata 10 for Linux | EpiGuru writes:

    [...] this post and this post as references, I installed the software without any [...]

  25. How to Install Stata 10 for Linux | Stata Help writes:

    [...] this post and this post as references, I installed the software without any [...]