Skip to content

Commit

Permalink
chore(docs): Update the "Gatsby on Linux" page (#18263)
Browse files Browse the repository at this point in the history
* remove "todo" stub, make links visible, add extra links

* Incorporate comments and update instructions for Linux

* respond to comments

* Apply suggestions from code review

Apply @marcysutton's suggestions

Co-Authored-By: Marcy Sutton <marcy@gatsbyjs.com>

* remove empty line, fix link at the bottom

- Removed an empty line that was probably making the tests fail
- Fixed a link from the additional links section
  • Loading branch information
1qk1 authored and LB committed Dec 9, 2019
1 parent c732247 commit ecca824
Showing 1 changed file with 128 additions and 10 deletions.
138 changes: 128 additions & 10 deletions docs/docs/gatsby-on-linux.md
Expand Up @@ -2,12 +2,124 @@
title: Gatsby on Linux
---

> This is a TODO. Help our community expand it.
This guide assumes you already have a native installation of Linux on your machine. The following steps walk through how to install Node.js and associated dependencies.

> Please use the [Gatsby Style Guide](/contributing/gatsby-style-guide/) to ensure your pull request gets accepted.
## Ubuntu, Debian, and other `apt` based distros

Begin by updating and upgrading.

```shell
sudo apt update
sudo apt -y upgrade
```

Install curl which allows you to transfer data and download additional dependencies.

```shell
sudo apt install curl
```

Once `curl` is installed, you can use it to install `nvm`, which will manage `node` and all its associated versions.

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

> Note that this is the current stable release of nvm. Full installation instructions and troubleshooting can be found at the [nvm GitHub page](https://github.com/nvm-sh/nvm)
When `nvm` is installed, it does not default to a particular `node` version. You'll need to install the version you want and give `nvm` instructions to use it. This example uses the latest release of version `10`, but more recent version numbers can be used instead.

```shell
nvm install 10
nvm use 10
```

To confirm this has worked, use the following command.

```shell
node -v
```

> Note that `npm` comes packaged with `node`
Finally, install `git` which will be necessary for creating your first Gatsby project based on a starter.

```shell
sudo apt install git
```

## Fedora, RedHat, and other `dnf` based distros

These distros come installed with `curl`, so you can use that to download `nvm`.

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

> Note that this is the current stable release of nvm. Full installation instructions and troubleshooting can be found at the [nvm GitHub page](https://github.com/nvm-sh/nvm)
When `nvm` is installed, it does not default to a particular `node` version. You'll need to install the version you want and give `nvm` instructions to use it. This example uses the latest release of version `10`, but more recent version numbers can be used instead.

```shell
nvm install 10
nvm use 10
```

To confirm this has worked, use the following command.

```shell
node -v
```

> Note that `npm` comes packaged with `node`
Finally, install `git` which will be necessary for creating your first Gatsby project based on a starter.

```shell
sudo dnf install git
```

## Archlinux and other `pacman` based distros

Begin by updating.

```shell
sudo pacman -Sy
```

These distros come installed with `curl`, so you can use that to download `nvm`.

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

> Note that this is the current stable release of nvm. Full installation instructions and troubleshooting can be found at the [nvm GitHub page](https://github.com/nvm-sh/nvm)
Before using `nvm`, you need to install additional dependencies.

```shell
sudo pacman -S grep awk tar git
```

When `nvm` is installed, it does not default to a particular `node` version. You'll need to install the version you want and give `nvm` instructions to use it. This example uses the latest release of version `10`, but more recent version numbers can be used instead.

```shell
nvm install 10
nvm use 10
```

To confirm this has worked, use the following command.

```shell
node -v
```

> Note that `npm` comes packaged with `node`
## Windows Subsystem Linux (WSL)

This guide assumes that you already have WSL installed with a working Linux distro. If you don't, follow [this guide from Microsoft's site](https://docs.microsoft.com/en-us/windows/wsl/install-win10) to install WSL and a Linux distro of your choice.

As of October 17th 2017, Windows 10 ships with WSL and Linux distributions are available via the [Windows Store], there are several different distributions to use which can be configured via `wslconfig` if you have more than one distribution installed.

```shell
Expand All @@ -24,8 +136,6 @@ sudo apt update
sudo apt -y upgrade
```

> Only use `-y` if you're happy to upgrade to the latest versions of the software.
**Build tools**

To compile and install native addons from npm you may also need to install build tools for `node-gyp`:
Expand All @@ -48,9 +158,16 @@ There are other alternatives for managing your node versions such as [nvm] but t

Debian setup is nearly identical to Ubuntu except for the additional installs of `git` and `libpng-dev`.

Begin by updating and upgrading.

```shell
sudo apt update
sudo apt -y upgrade
```

Additional dependencies need to be installed as well. `build-essential` is a package that allows other packages to compile to a Debian package. `git` installs a package to work with version control. `linbpng-dev` installs a package that allows the project to manipulate images.

```shell
sudo apt install build-essential
sudo apt install git
sudo apt install libpng-dev
Expand All @@ -62,10 +179,11 @@ Or to install all at the same time and approve `(y)` all installs:
sudo apt update && sudo apt -y upgrade && sudo apt install build-essential && sudo apt install git && sudo apt install libpng-dev
```

<!-- links -->
### Additional links and resources

[windows store]: https://www.microsoft.com/en-us/store/p/ubuntu/9nblggh4msv6
[n]: https://github.com/tj/n
[n-install]: https://github.com/mklement0/n-install
[nvm]: https://github.com/creationix/nvm
[bash startup]: https://github.com/Microsoft/WSL/issues/776#issuecomment-266112578
- [Super detailed guide to making VSCode work with ESL from VSCode's docs website](https://code.visualstudio.com/docs/remote/wsl)
- [Windows store page for downloading Ubuntu on Windows](https://www.microsoft.com/en-us/store/p/ubuntu/9nblggh4msv6)
- [n](https://github.com/tj/n)
- [nvm](https://github.com/creationix/nvm)
- [n-install](https://github.com/mklement0/n-install)
- [bash startup](https://github.com/Microsoft/WSL/issues/776#issuecomment-266112578)

0 comments on commit ecca824

Please sign in to comment.