Yes, it really is as simple as installing from npm, so we are not going to waste too much time with the bare basics, just install the Keyring via

yarn add @polkadot/keyring

And it will be added and ready for use. The above will always install the latest stable release.

Other dependencies

In most cases, you don't need to do anything else apart from just installing @polkadot/keyring above. It has dependencies such as @polkadot/util which are installed automatically alongside. When using yarn the dependencies are installed, flattened, available for use and you will never run into issues with mismatched versions.

If you are using the API alongside the keyring, the keyring will be installed as a dependency of the API itself.

This means that by simply installing @polkadot/api, you will have access to utilities (crypto and normal) and keyring.

Keyring basics

So we have it installed. Before we jump into actual real-world usage, let's understand what the Keyring gives us.