Files
archived-tauri-docs/docs/getting-started/setup-linux.md
2020-07-13 19:50:22 +02:00

4.2 KiB

title
title
Setup for Linux

import Alert from '@theme/Alert' import Icon from '@theme/Icon' import { Intro } from '@theme/SetupDocs'

1. System Dependencies 

$ sudo apt update && sudo apt install libwebkit2gtk-4.0-dev \
    build-essential \
    curl \
    libssl-dev \
    appmenu-gtk3-module \
    libgtk-3-dev

2. Node.js Runtime and Package Manager 

Node.js (npm included)

We recommend using nvm to manage your Node.js runtime. It allows you to easily switch versions and update Node.js.

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
We have audited this bash script, and it does what it says it is supposed to do. Nevertheless, before blindly curl-bashing a script, it is always wise to look at it first. Here is the file as a mere download link.

Once nvm is installed, close and reopen your terminal, then install the lastest version of Node.js and npm:

$ nvm install node --latest-npm
$ nvm use node

If you have any problems with nvm, please consult their project readme.

Optional Node.js Package Manager

You may want to use an alternative to npm:

  • Yarn, is preferred by Tauri's team
  • pnpm

3. Rustc and Cargo Package Manager 

The following command will install rustup, the official installer for Rust.

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
We have audited this bash script, and it does what it says it is supposed to do. Nevertheless, before blindly curl-bashing a script, it is always wise to look at it first. Here is the file as a mere download link.

To make sure that Rust has been installed successfully, run the following command:

$ rustc --version
latest update on 2019-12-19, rust version 1.40.0

You may need to restart your terminal if the command does not work.

4. Tauri Bundler 

If you already had rustup installed before following this guide, make sure that you update Rust:

$ rustup update stable

After you have installed Rust and other required dependencies, it is wise to restart your terminal before continuing.

Install Tauri bundler through Cargo:

$ cargo install tauri-bundler --force

5. For Windows Subsystem for Linux (WSL) Users 

In order to run a graphical application with WSL, you need to download one of these X servers: Xming, Cygwin X, and vcXsrv. Since vcXsrv has been used internally, it's the one we recommend to install.

WSL Version 1

Open the X server and then run export DISPLAY=:0 in the terminal. You should now be able to run any graphical application via the terminal.

WSL Version 2

You'll need to run a command that is slightly more complex than WSL 1: export DISPLAY=$(/etc/resolv.conf < awk '/nameserver/ {print $2}'):0 and you need to add -ac to the X server as an argument.

Don't forget that you'll have to use the "export" command anytime you want to use a graphical application, for each newly opened terminal.

You can download some examples to try with sudo apt-get install x11-apps. xeyes is always a good one. It can be handy when troubleshooting WSL issues.

There are some known issues on WSL 2 regarding loopback; that is running a localhost server from the terminal. If you are on WSL 2, be wary of this. You can find information regarding that here.

Continue

Now that you have set up the Linux-specific dependencies for Tauri, learn how to add Tauri to your project.