# Installation

### Ubuntu

Recommended Geth Version: 1.10.26-stable

The easiest way to install Geth on Ubuntu-based distributions is with the built-in launchpad PPAs (Personal Package Archives). A single PPA repository is provided, containing stable and development releases for Ubuntu versions: `xenial`, `trusty`, `impish`, `focal`, `bionic`.

The following command enables the launchpad repository:

```sh
sudo add-apt-repository -y ppa:ethereum/ethereum
```

Then, to install the stable version of go-ethereum:

```sh
sudo apt-get update
sudo apt-get install ethereum
```

Updating an existing Geth installation to the latest version can be achieved by stopping the node and running the following commands:

```sh
sudo apt-get update
sudo apt-get install ethereum
sudo apt-get upgrade geth
```

When the node is started again, Geth will automatically use all the data from the previous version and sync the blocks that were missed while the node was offline.

### Docker

There four different Docker images available for running the latest stable or development versions of Geth.

* `ethereum/client-go:latest` is the latest development version of Geth (default)
* `ethereum/client-go:stable` is the latest stable version of Geth
* `ethereum/client-go:{version}` is the stable version of Geth at a specific version number
* `ethereum/client-go:release-{version}` is the latest stable version of Geth at a specific version family

Pulling an image and starting a node is achieved by running these commands:

```sh
docker pull ethereum/client-go
docker run -it -p 30303:30303 ethereum/client-go
```

There are also four different Docker images for running the latest stable or development versions of miscellaneous Ethereum tools.

* `ethereum/client-go:alltools-latest` is the latest development version of the Ethereum tools
* `ethereum/client-go:alltools-stable` is the latest stable version of the Ethereum tools
* `ethereum/client-go:alltools-{version}` is the stable version of the Ethereum tools at a specific version number
* `ethereum/client-go:alltools-release-{version}` is the latest stable version of the Ethereum tools at a specific version family

The image has the following ports automatically exposed:

* `8545` TCP, used by the HTTP based JSON RPC API
* `8546` TCP, used by the WebSocket based JSON RPC API
* `8547` TCP, used by the GraphQL API
* `30303` TCP and UDP, used by the P2P protocol running the network

**Note:** if you are running an Ethereum client inside a Docker container, you should mount a data volume as the client's data directory (located at `/root/.ethereum` inside the container) to ensure that downloaded data is preserved between restarts and/or container life-cycles.

Updating Geth to the latest version simply requires stopping the container, pulling the latest version from Docker and running it:

```sh
docker stop ethereum/client-go
docker pull ethereum/client-go:latest
docker run -it -p 30303:30303 ethereum/client-go
```
