> For the complete documentation index, see [llms.txt](https://realtimerobotics.gitbook.io/developer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://realtimerobotics.gitbook.io/developer/drone-1/sitl/installation-and-setup.md).

# Installation and Setup

## Step1: Linux/Ubuntu update apt and install git :

```
sudo apt-get update && \
sudo apt-get install git && \
sudo apt-get install gitk git-gui
```

Config your own git:

```
git config --global user.name "use_github_name"
git config --global user.email "use_github_email"
git config --global user.password "use_github_pass"
git config -l
```

{% hint style="info" %}
From your Github account, go to Settings => Developer Settings => Personal Access Token => Generate New Token (provide your password) => Fillup the form => click Generate token => Copy the generated Token, this is **your password**
{% endhint %}

## Step2: Forking Autopilot with your own github:

<figure><img src="/files/pe4iVj1OAGOb7FE09Qoi" alt=""><figcaption></figcaption></figure>

If you are working towards [submitting code back to the main ArduPilot repo](https://ardupilot.org/dev/docs/submitting-patches-back-to-master.html#submitting-patches-back-to-master) you will want to create your own personal copy of the ArduPilot repository on the GitHub servers. This is called “forking” the repo.

When you fork the ArduPilot repo, the code’s history of changes is preserved and a relationship between the fork and the original is maintained which allows the fork to be updated from the original and for changes to be submitted back to the original.

* [sign up for a free user account with Github](https://github.com/join)
* open a web browser and go to [github.com/ArduPilot/ardupilot](https://github.com/ArduPilot/ardupilot)
* Click the “Fork” button on the upper right corner and follow the instructions

<figure><img src="/files/oZiYxhrfFSwdWchM8GL5" alt=""><figcaption></figcaption></figure>

## Step3: Install autopilot

```
git clone https://github.com/your-github-userid/ardupilot
git config --global credential.helper cache
cd ardupilot
git submodule update --init --recursive
```

## Step4: Install some required packages

If you are on a debian based system (such as Ubuntu or Mint), we provide [a script](https://github.com/ArduPilot/ardupilot/blob/master/Tools/environment_install/install-prereqs-ubuntu.sh) that will do it for you. From the cloned ardupilot directory :

```
Tools/environment_install/install-prereqs-ubuntu.sh -y
```

Reload the path (log-out and log-in to make it permanent):

```
. ~/.profile
```

Now you should be able to build with waf as described in [BUILD.md](https://github.com/ArduPilot/ardupilot/blob/master/BUILD.md).

{% hint style="info" %}
At this point you have already installed the MAVProxy Ground Control Station (MAVProxy GCS) and are also ready to do Software In the Loop (SITL) simulations of the vehicle code. See [SITL Simulator (Software in the Loop)](https://ardupilot.org/dev/docs/sitl-simulator-software-in-the-loop.html#sitl-simulator-software-in-the-loop) and [Setting up SITL on Linux](https://ardupilot.org/dev/docs/setting-up-sitl-on-linux.html#setting-up-sitl-on-linux). You are ready to not only build the code but run your build in the ArduPilot SITL simulator.
{% endhint %}

### Cleaning[¶](https://ardupilot.org/dev/docs/building-setup-linux.html#cleaning)

If there have been updates to some git submodules you may need to do a full clean build. To do that use:

```
./waf clean
```

That will remove the build artifacts so you can do a [build](https://github.com/ArduPilot/ardupilot/blob/master/BUILD.md) from scratch

##
