# Ethereum - Ubuntu for Beginners

## Introduction

{% hint style="info" %}
**Goal**: Teach basic Ubuntu concepts and skills in order to encourage home staking on Ethereum. The target audience is anyone with basic tech skills and a desire to learn.
{% endhint %}

![](https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOS4lGrylFo-KuQ_fk5%2Fimage.png?alt=media\&token=500216c9-139c-44b7-81f5-4cb78a9309ef)

This is part of a broader Ethereum educational effort. Find other Eth2 community resources [here](https://agstakingco.gitbook.io/ethereum-2-0-ubuntu-for-beginners/ethereum-2.0-resources).

## Table of Contents

### Ubuntu 20.04: [Introduction](#introduction) || [Applications](#ubuntu-or-or-applications) || [Terminal](#linux-terminal-basic-commands) || [Practice](https://agstakingco.gitbook.io/ethereum-2-0-ubuntu-for-beginners/ubuntu-20.04-exercise-1)

## Ubuntu 20.04 - Desktop

Ubuntu desktop has several features that make it ideal for running a validator on Ethereum 2.0:

* Comprised of [Free and Open-Source Software (FOSS)](https://en.wikipedia.org/wiki/Free_and_open-source_software)
* Wide support and documentation with the Ethereum ecosystem
* User friendly, easy to learn
* Designed to boot as a live USB for [generating Eth2 keys offline](https://app.gitbook.com/@agstakingco/s/eth-2-0-key-generation-ubuntu-live-usb/)

![](https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOS5mBwTYv8mA2l1plU%2Fimage.png?alt=media\&token=70b06987-e78b-4728-b196-50b25e8f33d2)

{% hint style="info" %}
If you'd like to try Ubuntu, you can use these instructions to create an Ubuntu live USB:

### [Windows](https://ubuntu.com/tutorials/create-a-usb-stick-on-windows#1-overview)  || [macOS](https://ubuntu.com/tutorials/create-a-usb-stick-on-macos#1-overview) || [Linux](https://ubuntu.com/tutorials/create-a-usb-stick-on-ubuntu#1-overview)

{% endhint %}

## Ubuntu - Security

Ubuntu is secure right out of the box and is generally resistant to viruses and malware. The best way to maintain a secure environment is to use it as a dedicated Ethereum machine. No other applications.

### Home PC vs "Headless" Server

Ubuntu has both desktop and server versions. Servers have no graphical user interface (GUI), which means the only access to a server is through terminal commands (CLI).

Ubuntu desktop allows you to operate in a normal desktop environment (GUI) while still using CLI.

For most users, a home PC is easier to operate and more secure than a remote server because you have direct physical access, which allows you to disable remote logins and prevent the majority of attacks.

## Ubuntu - Applications

{% hint style="info" %}
You can click the <img src="https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOS6lVqIbOphWoTlG45%2Fimage.png?alt=media&#x26;token=6d400da1-6d5f-42b6-b01f-1b84acc9f86c" alt="" data-size="line"> icon in the bottom left corner to show the installed applications.
{% endhint %}

![](https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOS6zg2Fmul-tVETQ2m%2Fimage.png?alt=media\&token=0bd28721-1cdb-4211-bbf8-976a49127d5b)

### Application Names: Windows vs Ubuntu

|                       | **Windows**       | **Ubuntu / Linux**  |
| --------------------- | ----------------- | ------------------- |
| **Document Writer**   | Microsoft Word    | LibreOffice Writer  |
| **Spreadsheets**      | Microsoft Excel   | LIbreOffice Calc    |
| **Presentations**     | MS Powerpoint     | LibreOffice Impress |
| **Web Browser**       | Internet Explorer | Firefox             |
| **Photo Editor**      | Adobe Photoshop   | GIMP                |
| **Image Editor**      | MS Paint          | Image Magick        |
| **PDF Viewer**        | Adobe PDF         | Document Viewer     |
| **Text Editor**       | Text              | Text Editor         |
| **Email Client**      | MS Outlook        | Thunderbird Mail    |
| **Command Line**      | Command Prompt    | Terminal            |
| **Computer Settings** | Control Panel     | Settings            |
| **Software Updates**  | Windows Updater   | Ubuntu Software     |

{% hint style="info" %}
Open-source applications have come a long way in recent years, and many FOSS programs are now as good or better than their closed-source counterparts.
{% endhint %}

### File Viewer (aka Files) <img src="https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOS94kh-YIVf5Po8Uyi%2Fimage.png?alt=media&#x26;token=fe05c876-9151-4e27-8559-80cac21e5182" alt="" data-size="line">&#x20;

You can visually explore different directories and files using the Graphical User Interface (GUI)

![](https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOS9EZyuQyCJYdV8_zl%2Fimage.png?alt=media\&token=d287809f-ffe0-41be-9acb-9eadc7d550d9)

### Text Editor <img src="https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOS9RC_6Cr3jvnEr2so%2Fimage.png?alt=media&#x26;token=f29350a9-1d72-460d-8da8-624a51084cdd" alt="" data-size="line">

Basic text editor for simple documents and copy/pasting

![](https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOS9_802xYk1Rp1ynr9%2Fimage.png?alt=media\&token=2c214aad-8c0f-40b6-beda-6690a984f6c6)

### Terminal <img src="https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOS9jL3yGmOYgeKZSNy%2Fimage.png?alt=media&#x26;token=80eda877-cca8-418b-926f-24b72424f3af" alt="" data-size="line">&#x20;

&#x20;Running an Ethereum validator requires entering commands directly into the terminal (aka command line interface). CLI can be intimidating at first, but it's fairly intuitive and easy to learn.

{% hint style="info" %}
You can use the following shortcuts for Linux CLI:

* **`Ctrl + Alt + T`**  ||  Open new terminal window
* **`Ctrl + Shift + C`**  ||  Copy selected contents from terminal window
* **`Ctrl + Shift + V`**  ||  Paste contents into terminal window
* **`Ctrl + C`**  ||  Stop a running terminal process
* **`Up/down Arrows`** || Cycle through last used commands
  {% endhint %}

![](https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOS9u-BvZu-BAubEkrj%2Fimage.png?alt=media\&token=9e124738-dda4-4287-93c0-6a5dd8b56952)

### Screenshot <img src="https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOSA303WHsSz9wgXuDD%2Fimage.png?alt=media&#x26;token=7349857c-63eb-477f-b109-f76cca09d187" alt="" data-size="line">&#x20;

This tool is helpful if you have an error and want to post a screenshot in the [EthStaker Discord](https://invite.gg/ethstaker) for help.

![](https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOSA7H_tTUEXh1HyC9x%2Fimage.png?alt=media\&token=0131413a-a520-474f-9c51-3dd2fa983459)

## Dual View - CLI & GUI

Open a terminal window with `Ctrl + Alt + T` and move it alongside the file viewer. This allows you to see information displayed through Command Line Interface (CLI) and Graphical User Interface (GUI).

{% hint style="info" %}
The screenshot below shows the contents of the Home directory through both CLI and GUI.
{% endhint %}

![](https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-MOS3EPCiybP29GXvhR2%2F-MOSAJwFjGMWd2MUvuup%2Fimage.png?alt=media\&token=a14c6f2f-2406-461f-a702-937083e7816d)

## Linux - Directories

Linux systems do not have "drives" like with Windows (e.g. C: or D:).

The entire Linux directory system is a series of nested directories, with the top being the `/root` directory.

### Root Directory

{% hint style="danger" %}

### AVOID USING ROOT ACCESS

The root directory contains all other directories, and the root user has control over the entire system. A mistake while working as root user can cause irreparable damage.

The best practice is to generally never use root access, and instead have regular users that can use the `sudo` command
{% endhint %}

### Sudo Command

Adding `sudo` to the front a command runs the terminal command as administrator. This helps prevent accidents because the user doesn't have root access, but they are still able to run commands as admin when needed.

If you get an error that you don't have permission to perform this action, you may need to use `sudo`

### Username

This guide was created on a PC named `ubuntu` with the username `ubuntu` \
You'll notice that CLI below starts with `ubuntu@ubuntu` which identifies `user@pcname`

{% hint style="info" %}
You can use the command `whoami` to see the current user name.
{% endhint %}

![](https://2724337753-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MOS21hRsTGewfnTVjdX%2F-McSFMIuTEYpAIwD0Kd6%2F-McSIUQGC4nuqKSKwkpf%2Fimage.png?alt=media\&token=4b349941-af68-4428-9cec-0d74e31f999a)

### Important Directories

When you open a new terminal, it will begin in the home directory

| Directory                           | Description                                    |
| ----------------------------------- | ---------------------------------------------- |
| **`/`**                             | Root directory                                 |
| **`~`**                             | Home directory ( same as `/home/YOURUSERNAME`) |
| **`~/Desktop`**                     | Desktop directory                              |
| **`~/Documents`**                   | Documents directory                            |
| **`~/Downloads`**                   | Downloads directory                            |
| **`/media/YOURUSERNAME`**           | Directory for USB and other external devices   |
| **`/var/lib/goethereum`**           | Go Ethereum directory                          |
| **`/var/lib/lighthouse`**           | Lighthouse directory                           |
| **`/var/lib/lighthouse/validator`** | Lighthouse validator directory                 |
| **`/var/lib/lighthouse/beacon`**    | Lighthouse beacon directory                    |
| **`usr/local/bin`**                 | Directory used to run Lighthouse binary        |

## Linux Terminal - Basic Commands

{% hint style="info" %}
This table shows a list of commands, but the following section will discuss in greater detail.
{% endhint %}

| Command     | Description                                            | Sample Code                                                                        |
| ----------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------- |
| **clear**   | clear terminal window (fresh screen)                   | `clear`                                                                            |
| **cd**      | change directory                                       | `cd ~`                                                                             |
| **ls**      | list contents of current directory                     | `ls`                                                                               |
| **ls -l**   | show file permissions                                  | `ls -l sample.txt`                                                                 |
| **pwd**     | print working directory (show current directory)       | `pwd`                                                                              |
| **history** | shows history of terminal commands                     | `history`                                                                          |
| **sudo**    | gives root permission to run programs or make changes  | `sudo`                                                                             |
| **mkdir**   | make a new directory                                   | `sudo mkdir ~/test`                                                                |
| **nano**    | create or edit system files                            | `sudo nano test.txt`                                                               |
| **rm**      | remove file                                            | `sudo rm test.txt`                                                                 |
| **rm -r**   | delete directory and all contents (remove recursively) | `sudo rm -r testfolder`                                                            |
| **cp**      | copy/paste a file                                      | `cp test.txt ~/Documents`                                                          |
| **chown**   | change ownership of a file/directory                   | <p><code>sudo chown -R goeth:goeth</code> <br><code>/var/lib/goethereum</code></p> |
| **chmod**   | change permissions of a file/directory                 | `sudo chmod g+r sample.txt`                                                        |
| **adduser** | create new user                                        | `sudo adduser mikejones`                                                           |
| **deluser** | delete user                                            | `sudo deluser mikejones`                                                           |
| **update**  | update system database for new packages                | `sudo apt-get update`                                                              |
| **upgrade** | upgrade packages (run after update)                    | `sudo apt-get upgrade`                                                             |
| **install** | install applications                                   | `sudo apt-get install geth`                                                        |
| **remove**  | remove applications                                    | `sudo apt-get remove geth`                                                         |
| **help**    | display help info (use `-h` or `-help` or `--help`)    | `geth --help`                                                                      |

{% hint style="success" %}
Now that we've covered directories and commands, let's practice with a few exercises.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://agstakingco.gitbook.io/ethereum-2-0-ubuntu-for-beginners/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
