| sidebar_position | 1 |
|---|
In this guide, we will walk you through how to quickly install and run the WasmEdge Runtime on a generic Linux distribution (such as Ubuntu, Debian, Raspberry OS or WSL on Windows). Comprehensive and OS-specific installation instructions can be found here.
:::note If you have Docker Desktop 4.15 and above, you can skip this and get started here. For Fedora Linux / Red Hat Linux / OpenShift / Podman users, get started here. :::
We will cover the following examples:
The easiest way to install WasmEdge is to run the following command. You should have root or at least sudo privilege. Your system should have git and curl installed as prerequisites.
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -p /usr/localIf you do not have root or sudo rights, use the following line to install WasmEdge in your $HOME/.wasmedge directory:
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bashThe Hello world example is a standalone Rust application that can be executed by the WasmEdge CLI. Its source code and build instructions are available here.
Download the hello.wasm file here, or run the following command:
wget https://github.com/second-state/rust-examples/releases/latest/download/hello.wasmUse the wasmedge command to run the program.
$ wasmedge hello.wasm
Hello WasmEdge!Use the AoT compiler wasmedgec to get much better performance.
$ wasmedgec hello.wasm hello_aot.wasm
$ wasmedge hello_aot.wasm
Hello WasmEdge!To learn more about how to create WASM apps in Rust
- Basic Rust examples for WasmEdge
- Rust developer guides
- WASI-NN with PyTorch, OpenVINO, or Tensorflow Lite backends
- HTTP and HTTPS client
- MySQL database client
- Redis client
- Kafka client
This example is a standalone HTTP server written in Rust. It demonstrates that Rust + WasmEdge as a lightweight stack for microservices. Its source code and build instructions are available here.
Download the server.wasm file here, or run the following command:
wget https://github.com/second-state/rust-examples/releases/latest/download/server.wasmUse the wasmedge command to run the program.
$ wasmedge server.wasm
Listening on http://0.0.0.0:8080From another terminal window, do the following.
$ curl http://localhost:8080/
Try POSTing data to /echo such as: `curl localhost:8080/echo -XPOST -d 'hello world'`
$ curl http://localhost:8080/echo -X POST -d "Hello WasmEdge"
Hello WasmEdgeTo learn more about how to create WASM services in Rust
- Rust developer guides
- HTTP application examples
- Database application examples
- Lightweight microservices in Rust and WasmEdge
This example is a standalone HTTP server written in JavaScript using the node.js API. It demonstrates WasmEdge as a lightweight runtime for node.js applications. Its source code is available here.
- Download the wasmedge_quickjs.wasm file here, or run the following command:
wget https://github.com/second-state/wasmedge-quickjs/releases/download/v0.5.0-alpha/wasmedge_quickjs.wasm- Download the modules.zip file here, or run the following command:
wget https://github.com/second-state/wasmedge-quickjs/releases/download/v0.5.0-alpha/modules.zipUnzip the modules.zip file into the current folder as ./modules/.
unzip modules.zip- Download the server.js file here.
wget https://raw.githubusercontent.com/second-state/wasmedge-quickjs/main/example_js/docker_wasm/server/server.jsUse the wasmedge command to run the program.
$ wasmedge --dir .:. wasmedge_quickjs.wasm server.js
listen 8080 ...From another terminal window, do the following.
$ curl http://localhost:8080/echo -X POST -d "Hello WasmEdge"
Hello WasmEdgeTo learn more about how to run JavaScript apps in WasmEdge.
- The WasmEdge QuickJS runtime
- AI inference application examples
- Web service client examples with fetch()
- Check out all available WasmEdge CLI options to explore WasmEdge's features.
- Write WASM apps in your favorite languages, like Rust, C/C++, JavaScript, Go, and many other languages.