Skip to content
Follow
Ubuntu Linux

Installing Gatsby.js on Ubuntu: A Step-by-Step Guide

Richard
Written by
Richard
Oct 19, 2022 Updated Sep 15, 2026 3 min read
How to Install Nextcloud AIO on Ubuntu Linux
How to Install Nextcloud AIO on Ubuntu Linux

Installing Gatsby.js on Ubuntu lets you build fast static websites using React. Gatsby.js is a web framework that pulls content from multiple sources to create high-performance web pages.

Advertisement

You need Ubuntu 20.04 or newer and Node.js version 18 or higher to complete the setup. The full process takes about 15 minutes using standard terminal commands.

⚡ Quick Answer

Install Node.js via NVM, then install the Gatsby CLI globally using npm. Create a new Gatsby site with `gatsby new` and start the development server with `gatsby develop` in your project directory.

Advertisement

Install NVM (Node Version Manager) and Node.js

Installing NVM (Node Version Manager) on Ubuntu gives you the right environment for your Gatsby.js installation Ubuntu setup by letting you download and manage Node.js properly. You start by updating your package lists and installing curl in your terminal, which allows you to fetch the NVM script safely and set up the core engine your site builder needs.

First, update your system and install curl:

sudo apt update
sudo apt install curl
📝Good to KnowNext, download the latest NVM installer.

Note: Always verify the script hash provided on the official %📂%LNK0%% NVM repository before running it to ensure security.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

Refresh your shell so NVM works:

Advertisement
source ~/.bashrc

Now, install the current Long Term Support (LTS) version of Node.js, which is v22:

nvm install 22
nvm use 22

Gatsby CLI

The Gatsby CLI is a tool that helps you create and manage your sites. Install it with this command:

npm install -g gatsby-cli

Check the version to confirm it is installed:

gatsby --version

Create Gatsby app

Creating a new Gatsby app on Ubuntu requires the Gatsby command line tool to build your project structure and configuration files automatically. You run the setup command in your terminal, answer a few quick questions about your site name and preferences, and the tool downloads everything you need to start building your web pages.

Advertisement
gatsby new

The CLI will ask you a few questions to set up your project:

  • What would you like to call your site? Choose a name like "myapp".
  • What would you like to name the folder? Press enter to use the default.
  • Will you be using JavaScript or TypeScript? Choose based on your preference.
  • Will you be using a CMS? Select "No" for now.
  • Would you like to install a styling system? Choose your preferred CSS framework (like Tailwind or CSS Modules).

The tool will automatically download the necessary files and set up your folder structure.

Access your app

Accessing your new Gatsby app on Ubuntu involves moving into your project folder and starting the built-in development server. You use the command line to launch the local server, and then you open your web browser to view your live site at the local address while you make changes.

cd myapp/
gatsby develop
install gatsby on ubuntu linux portal
install gatsby on ubuntu linux portal

Open your web browser and go to:

Advertisement

http://localhost:8000

📝NoteIf you see an error saying the port is in use, another program is already running on port 8000.

You can try a different port by adding the -p flag, like this: gatsby develop -p 8001.

Conclusion

You now have Gatsby.js running on your Ubuntu machine. You have set up the environment, installed the CLI, created a new project, and launched the development server. You are ready to start building your website.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

Advertisement

📚 Related Tutorials

Install Node.js and npm on Ubuntu: A Step-by-Step Guide
Ubuntu Linux Install Node.js and npm on Ubuntu: A Step-by-Step Guide
How to Install LibreOffice on Ubuntu Linux
Ubuntu Linux How to Install LibreOffice on Ubuntu Linux
How to Install PowerDNS on Ubuntu Linux
CMS How to Install PowerDNS on Ubuntu Linux

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *