# Stata Installation

Create a folder for your Stata installation file:

```
mkdir /home/ubuntu/stata_source
```

Download the [Stata](https://www.stata.com/support/faqs/unix/install-download-on-linux/) tar file for Linux.

Upload the tar file to the `/home/ubuntu/stata_source` folder just created (using BitVise's SFTP interface for example). You may need to give writing priviledges to the folder you just created by

```
sudo chmod -R a+rwx /home/ubuntu/stata_source
```

{% hint style="info" %}
Obtain administrative rights by requesting root access:
{% endhint %}

```
sudo -i
```

Unzip the tar file in the `/tmp/statafiles` folder:

```
cd /tmp/
mkdir statafiles
cd statafiles
tar -zxf /home/ubuntu/stata_source/Stata16Linux64.tar.gz
```

Create `/usr/local/stata16` directory for installing Stata for all users:

```
cd /usr/local
mkdir stata16
```

Install Stata. Enter licensing information when prompted:

```
cd /usr/local/stata16
/tmp/statafiles/install
```

After installation, you will be prompted to initialize Stata:

```
./stinit
```

Ubuntu users will need an additional package for Stata to work:

```
apt-get update
echo "deb http://security.ubuntu.com/ubuntu focal-security main universe" > /etc/apt/sources.list.d/ubuntu-focal-sources.list
apt-get install libncurses5
```

Edit the Ubuntu system paths to include Stata for all users. Open the profile in [nano](https://www.nano-editor.org/):

```
nano /etc/profile
```

Type the following into the bottom of the document as depicted below.

```
export PATH="/usr/local/stata16:$PATH"
```

![](/files/-MDGjt35Hg3Ii_0EUV-A)

Use CTRL+O then enter to overwrite the document and CTRL+X to exit.

Refresh the paths to include Stata by typing:

```
source /etc/profile
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-jupyter.davidjachochavez.org/stata/stata-installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
