Install Wasmer on Ubuntu 24.04

Install Wasmer on Ubuntu 24.04

Wasmer is a fast, secure, and open-source WebAssembly (Wasm) runtime that enables lightweight containers to run WebAssembly outside the browser, across a wide range of platforms - including desktops, servers, and embedded systems. This tutorial explains how to install Wasmer on Ubuntu 24.04.

Install Wasmer

Download Wasmer from GitHub repository:

wget -qO wasmer.tar.gz https://github.com/wasmerio/wasmer/releases/latest/download/wasmer-linux-amd64.tar.gz

Create a new directory for Wasmer and extract the tar.gz file into it:

sudo mkdir /opt/wasmer
sudo tar xf wasmer.tar.gz -C /opt/wasmer

Add /opt/wasmer/bin directory to the PATH environment variable:

echo 'export PATH=$PATH:/opt/wasmer/bin' | sudo tee -a /etc/profile.d/wasmer.sh

To apply the changes, either log out and log back in, or run the following command to apply them immediately:

source /etc/profile

To verify the installation, check the Wasmer version:

wasmer --version

Remove unnecessary archive file:

rm -rf wasmer.tar.gz

Testing Wasmer

Wasmer allows you to run WebAssembly files (.wasm) or packages published on the Wasmer Registry. For example, the following command runs a Python package from the registry and executes a simple script:

wasmer run python/python -- -c "print(1+1)"

The command outputs 2.

Uninstall Wasmer

If you wish to completely remove Wasmer, delete the installation directory:

sudo rm -rf /opt/wasmer

Delete the environment configuration script:

sudo rm -rf /etc/profile.d/wasmer.sh

You can also remove Wasmer data and configuration:

rm -rf ~/.wasmer

Leave a Comment

Cancel reply

Your email address will not be published.