Bun is a fast all-in-one JavaScript runtime, bundler, test runner and package manager. It is a drop-in alternative to Node.js and npm and does not require Node.js to be installed. This guide installs Bun on an Ubuntu server.
Prerequisites
- An Ubuntu server
- Basic knowledge of the command-line interface
1. Install Bun
The recommended way to install Bun is with the official install script. Connect over SSH as the ploi user and run:
curl -fsSL https://bun.sh/install | bash
The installer places Bun in ~/.bun and adds it to your PATH in your shell profile. The installer needs unzip; if you get an "unzip not found" error, install it first with sudo apt install -y unzip and re-run the command.
2. Load Bun into your current shell
Open a new SSH session, or reload your profile:
source ~/.bashrc
3. Verify the installation
bun --version
This should print the installed Bun version, confirming the installation was successful.
You can now use Bun to install packages (bun install), run scripts (bun run) and execute files directly (bun index.ts).
For more details, see the official Bun documentation.