Skip to content

Setup Gatsby website

Prerequisite

  • Git
  • Node.js 10.13.0 (LTS) or higher
  • Yarn

How to instal Gatsby as a global tool

  • If you haven’t installed Yarn yet, execute the following command in a terminal:
Terminal window
$ sudo npm install -g yarn

Install gatsby-cli as a global tool

  • Open a new terminal.
  • Execute the following command to install gatsby-cli:
Terminal window
$ sudo yarn global add gatsby-cli

Create a simple website from Gatsby Starters

  • Execute the following command in a terminal to create a new Gatsby website:
Terminal window
$ gatsby new my-gatsby-website https://github.com/gatsbyjs/gatsby-starter-blog
  • Wait for a while until a command has finished.
  • Then CD to the project folder.
Terminal window
$ cd my-gatsby-website
  • Start the website in development mode by executing the following commands:
Terminal window
gatsby develop
  • Open a browser and navigate to http://localhost:8000.
  • You should find homepage and post details page as following images:

Gatsby Starter Blog - homepage

Gatsby Starter Blog - post details page