Skip to content

Linux installation

Stefania Pedrazzi edited this page Nov 7, 2022 · 53 revisions

Clone the Github Repository

Install git:

sudo apt install git

Create the development directory in your home directory and clone the repository.

Note: instead of cloning https://github.com/cyberbotics/webots.git, we recommend to create your own fork and clone it, so that you can commit your changes directly on it.

git config --global credential.helper store
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git config --global push.default simple
git clone --recurse-submodules -j8 https://github.com/cyberbotics/webots.git
cd webots

Git Submodules

If you cloned Webots with the --recurse-submodules option, you can skip this step. Otherwise, you need to initialize the submodules used by Webots:

git submodule init
git submodule update

Install Prerequisites Packages

The Webots dependencies can be installed with the following script:

sudo scripts/install/linux_compilation_dependencies.sh

Note that this installation script is guarantee to work only on the two latest Ubuntu LTS releases. For error on other Linux distributions please refer to this section.

If you are using a headless system, then you also have to install xvfb to compile and run Webots:

sudo apt install xvfb

Setup your bash profile

Check the content of scripts/install/bashrc.linux, adapt the paths to match your system setup, and append it at the end of your ~/.bashrc:

cat scripts/install/bashrc.linux >> ~/.bashrc
source ~/.bashrc

Install Optional Dependencies [ optional ]

If needed, follow these instructions to install optional dependencies.

Build Webots

Compile Webots from the root directory:

make -jX

Note: X represents the number of threads for a speedy multi-threaded compilation. For example, type make -j12 on a CPU with four cores and hyper-threading.

make help displays additional targets for debugging, profiling, cleaning, etc.

The make instruction automatically downloads the required resources in the dependencies folder

Once compiled, type ./webots to launch it.

Building on a system different than Ubuntu LTS

All the provided dependencies installation scripts are guarantee to work only on the two latest Ubuntu LTS. If you are using a different Linux distribution, you should carefully check the error messages: it may be necessary to modify the installation script to skip some packages not available on your distribution and manually install other missing dependencies.

In particular, if the python command is not available on your system, you may need to install the python-is-python3 package.

Clone this wiki locally