I have recently installed "STATA 9 for Unix" on my laptop (Dell Inspiron E1405) running Ubuntu 6.06 LTS (Linux). Since the process was a little more involved than what I had expected and also a little different from what was given in the "Getting Started with Stata for Unix" book, I wrote down this little "HOWTO Install STATA 9 on Linux (Ubuntu 6.06)" for further reference and use. I would like to acknowledge the help that I recieved on Statalist from Neil Shepherd. A note of caution is in order: even though this worked for me, there is no guarantee that this will work for you (though with a high probability it will).
Step 1: LOGGING IN AS ROOT
Many Linux distributions (including Ubuntu) don't encourage the creation and use of a separate root account; one can do all the functions of a root user with the -sudo- command. For installing STATA we first need to log in as the root user. This can be done by typing
$ sudo su -
in the terminal ($ is the command promt at the terminal). You will be asked for your password. Once you furnish the correct password, you will be logged in as the root. The command promt will change to # indicating that you are logged in as the root.
Step 2: COPYING FILES
Since I had problems installing directly from the installation CD, I followd Neil Shpherd's advice and copied the relevant files on to the hard disk. First, you need to create a new directory with the following command:
# mkdir /usr/local/stata
This assumes that your machine already has the directory /usr/local; if that is not the case (which is really improbable), you need to first create that directory. Now copy the files to the newly created directory with the following two commands:
# cp /media/cdrom/install /usr/local/stata/.
# cp -R /media/cdrom/unix /usr/local/stata/.
For Ubuntu 6.06, the correct path to the cdrom was /media/cdrom; for your machine and distribution it might be different; you can find the correct path for the cdrom by looking at the fstab file in the /etc directory. To do so you could do
# cat /etc/fstab
and note down the path to the cdrom. Ofcourse, it is better that you note this down before starting the installation process.
Step 3: RUNNING INSTALLATION SCRIPT
Once the files are copied, all you need to do is to change to the /usr/local/stata directory and run the installation script. The following will do that
# cd /usr/local/stata
# ./install
Now just follow the prompts and STATA will be installed in your machine.
Step 4: INITIALISING LICENSE
This can be done by the following
# cd /usr/local/stata
# ./stinit
You will require all the license-related information to complete this step.
Step 5: ADDING NEW DIRECTORY TO $PATH
You need to add the path to the new directory conatining Stata to your PATH environment variable (so that you can start STATA from the terminal without specifying the whole path). To do this you first need to know which shell you are using; in Ubuntu, the default shell is BASH. To see which shell you are using type
$ echo $PATH
If you are using bash, you need to edit the following file ~/.bashrc; if you are using some other shell, you can follow the instructions given in the "Getting Started with Stata for Unix" book. If you are using bash, you could do the following: open the file with
$ gedit ~/.bashrc
Add the following line at the end of the file
export PATH=$PATH:/usr/local/stata
Save and exit. Now logout and login again, for the new directory to be included in your PATH variable. To see whether the new directory is actually included in your path type
$ echo $PATH
You should see /usr/local/stata as one of the directories in the result.
Step 6: CHANGE PERMISSION
Since the directory /usr/local/stata was created by the root user, you will need to change its permission (or security) before accessing it as an ordinary user. You can do so by logging in as root once again and doing the following:
# cd /usr/local
# chmod 755 stata
# exit
The exit is meant to exit as the root user; you will continue to be logged in as an ordinary user.
Step 8: VERIFICATION
Log in as an ordinary user and type
$ stata
to enter STATA. Now type -verinst- at the dot prompt. Once the verification is done, type exit at the dot prompt.
Step 8: INSTALLING gtk1.2 COMPATIBLE LIBRARIES
Even after installing Stata, I could not start the Stata GUI. This was because Stata uses some old libraries which are not part of recent Linux default installations. So, I had to install the libgtk1.2 libararies. This can be done easily using the Synaptic Package manager in Ubuntu (and Debian-based distributions). Open the Package Manager; search for libgtk1.2, mark it for installation and install (by applying changes).
Step 8: Update STATA
Before you start using STATA, it is advisable to update it. To do so for the first time, login as root user once more. Type
# /usr/local/stata/stata
to start STATA (yes, you need to type the whole path). Type -update query- at the . prompt (the STATA dot prompt) and follow the instructions. Once the update process is done, exit STATA. And then exit as root user. Now login as an ordinary user and you are ready to go!
Deepankar
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/