{"id":10708,"date":"2021-10-05T08:06:06","date_gmt":"2021-10-05T08:06:06","guid":{"rendered":"https:\/\/linuxways.net\/?p=10708"},"modified":"2021-10-05T08:06:06","modified_gmt":"2021-10-05T08:06:06","slug":"how-to-install-gatsby-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-gatsby-on-ubuntu-20-04\/","title":{"rendered":"How to Install Gatsby on Ubuntu 20.04"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>Gatsby is a super fast and fantastic node-based static site generator. It is a multipurpose generator and has powerful tools that skyrock a website. I am using Ubuntu 20.04 LTS, and I will show you how to install Gatsby on your Ubuntu system. All instructions are Ubuntu-specific. It is important not to use these commands on Debian as they will result in a system break due to different dependency requirements.<\/p>\n<h2>Installing Gatsby<\/h2>\n<h3>Step 1.<\/h3>\n<p>You must verify that your system is running up-to-date Node.js, NPM, and Git packages. Here is how to do it.<\/p>\n<pre><strong>$ node --version<\/strong><\/pre>\n<pre><strong>$ npm --version<\/strong><\/pre>\n<pre><strong>$ git --version<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"349\" height=\"144\" class=\"wp-image-10709\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-690.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-690.png 349w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-690-300x124.png 300w\" sizes=\"auto, (max-width: 349px) 100vw, 349px\" \/><\/p>\n<h3>Step 2.<\/h3>\n<p>If none of the above packages are installed on your system then you should first install them. Here is how you will do it:<\/p>\n<pre><strong>$ sudo apt install node<\/strong><\/pre>\n<pre><strong>$ sudo apt install npm<\/strong><\/pre>\n<pre><strong>$ sudo apt install git<\/strong><\/pre>\n<p>Check with your package manager if there is a need for any PPA.<\/p>\n<p><strong>Step 3.<\/strong><\/p>\n<p>Next is to install Gatsby.js CLI.<\/p>\n<p>Unlike other packages which might be installed in a specific project directory. Gatsby will be installed globally only. A local or directory-specific node package can be installed without <strong>sudo<\/strong>, but a global package can only be installed using <strong>sudo<\/strong>.<\/p>\n<p><strong>Let\u2019s do it:<\/strong><\/p>\n<pre><strong>$ sudo npm install -g gatsby-cli<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"547\" class=\"wp-image-10710\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-691.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-691.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-691-300x222.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<p>It took about six minutes to install a few hundred packages. Gatsby is pretty big regarding dependency requirements.<\/p>\n<h3>Step 3.<\/h3>\n<p>Once Gatsby.js is installed, we are ready to start creating new static websites.<\/p>\n<p>First, you will need to create a new driectory.<\/p>\n<pre><strong>$ mkdir gatsbySite<\/strong><\/pre>\n<p>then change the directory as shown below:<\/p>\n<pre><strong>$ cd \/gatsbySite<\/strong>.<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"401\" height=\"82\" class=\"wp-image-10711\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-692.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-692.png 401w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-692-300x61.png 300w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/p>\n<h3>Step 4.<\/h3>\n<p>Now it is simple to create your first site, run the following command and you are good to go. Refer the screenshot:<\/p>\n<pre><strong>$ gatsby new<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"667\" height=\"328\" class=\"wp-image-10712\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-693.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-693.png 667w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-693-300x148.png 300w\" sizes=\"auto, (max-width: 667px) 100vw, 667px\" \/><\/strong><\/p>\n<p>At this point, Gatsby will ask you a few questions like what\u2019s your site name, your specific folder name of your website, and some plugin details as shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"726\" height=\"544\" class=\"wp-image-10713\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-694.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-694.png 726w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/09\/word-image-694-300x225.png 300w\" sizes=\"auto, (max-width: 726px) 100vw, 726px\" \/><\/p>\n<p>You simply need to answer all of them and the site will be created.<\/p>\n<h3>Step 5.<\/h3>\n<p>With the following command, you will initiate a local server that will show you your website locally.<\/p>\n<pre><strong>$ npm run develop<\/strong><\/pre>\n<p>Now you can access your local site on http:\/\/localhost:8000\/<\/p>\n<h2>Conclusion<\/h2>\n<p>In this guide, we examined how to install Gatsby static site generators on Ubuntu 20.04. The above instructions are valid only for Ubuntu distribution. Now you have installed a super-fast static site generator on your Linux system. It will be a pleasure to learn about your installation experience. Have your say!<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction Gatsby is a super fast and fantastic node-based static site generator. It is a multipurpose generator and has powerful tools that skyrock a website. I am using&hellip;<\/p>","protected":false},"author":1,"featured_media":10920,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[582,100],"class_list":["post-10708","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-gatsby","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=10708"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10708\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/10920"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=10708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=10708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=10708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}