Gatsby is a free and open-source framework based on the frontend development framework React. Gatsby allows developers to build fast, secure, and powerful websites using a React-based framework. With Gatsby, you can build a portfolio site or blog, or a high-traffic e-commerce store or company homepage. It follows the latest web standards and is optimized for speed and security. Gatsby brings the speed of a statically generated site as well as the functionality of a framework.
This post will show you how to install Gatsby on Oracle Linux 8.
- A server running Oracle Linux 8 on the Atlantic.Net Cloud Platform
- A root password configured on your server
Step 1 – Create Atlantic.Net Cloud Server
First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Oracle Linux 8 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.
Once you are logged in to your server, run the following command to update your base system with the latest available packages.
dnf update -y
Step 2 – Install Node.js and NPM
Before starting, you will need to install Node.js and NPM on your server. By default, Node.js is included in the Oracle Linux default repo. You can list all available Node.js versions using the following command:
dnf module list nodejs
You should see the following output:
Next, enable Node.js version 16 with the following command:
dnf module enable -y nodejs:16
You should get the following output:
Last metadata expiration check: 0:57:05 ago on Tuesday 19 July 2022 03:11:19 AM EDT. Dependencies resolved. ============================================================================================================================================== Package Architecture Version Repository Size ============================================================================================================================================== Enabling module streams: nodejs 16 Transaction Summary ============================================================================================================================================== Complete!
Next, install Node.js and NPM using the following command:
dnf install -y nodejs npm
Next, install Git and Yarn package with the following command:
dnf install git npm install -i yarn
Next, verify the Node.js version using the following command:
To verify the NPM version, run the following command:
Step 3 – Install Gatsby CLI
Gatsby provides a CLI tool that allows you to create and manage projects via the command line. You can install it using the NPM command as shown below:
npm install -g gatsby-cli
Once Gatsby is installed, you can verify it using the following command:
You will get the following output:
Gatsby CLI version: 4.19.0
Step 4 – Create a New Site Using Gatsby
After installing Gatsby, run the following command to create a new site:
You will be asked to create a site name and other options during the site creation process. Once the site is created, you should see the following output:
Now, change the directory to your site and run the following command to start the development server:
cd my-gatsby-site gatsby develop -H 0.0.0.0
Once the server is started, you will get the following output:
You can now view my-gatsby-site in the browser. ⠀ http://localhost:8000/ ⠀ View GraphiQL, an in-browser IDE, to explore your site's data and schema ⠀ http://localhost:8000/___graphql ⠀ Note that the development build is not optimized. To create a production build, use gatsby build
You can also use the following options to start the development server:
- -H, –host Set host. Defaults to localhost
- -p, –port Set port. Defaults to env.PORT or 8000
- -o, –open Open the site in your (default) browser for you
- -S, –https Use HTTPS
Step 5 – Access Gatsby Web Interface
At this point, Gatsby is installed, started, and listens on port 8000. You can now access it using the URL http://your-server-ip:8000. You should see the Gatsby default page on the following screen:
In this post, you learned how to install Gatsby on Oracle Linux 8. Gatsby is very useful for e-commerce developers to make blazing-fast stores in minimal time. Try it on dedicated hosting from Atlantic.Net!