Ethereum 2.0: Ubuntu for Beginners

Introduction

Goal: Teach basic Ubuntu concepts and skills in order to encourage home staking on Ethereum 2.0. The target audience is anyone with basic tech skills and a desire to learn.

This is part of a broader Ethereum 2.0 educational effort. Find other Eth2 community resources here.

Table of Contents

Ubuntu 20.04: Introduction || Applications || Terminal || Practice

Ubuntu 20.04 - Desktop

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

If you'd like to try Ubuntu, you can use these instructions to create an Ubuntu live USB:

Windows || macOS || Linux

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. This allows you to disable remote logins and prevent the majority of attacks.

Ubuntu - Applications

You can click the icon in the bottom left corner to show the installed applications.

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

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.

File Viewer (aka Files)

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

Text Editor

Basic text editor for simple documents and copy/pasting

Terminal

Running an Eth2 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.

You can use the following shortcuts for Linux CLI:

  • Ctrl + Alt + T || Open new terminal window

  • Ctrl + Shift + V || Paste contents into terminal window

  • Ctrl + Shift + C || Copy selected contents from terminal window

  • Ctrl + C || Stop running terminal process

  • Up/down Arrows || Cycle through last used commands

Screenshot

This tool is helpful if you have an error and want to post a screenshot in the EthStaker Discord for help.

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).

The screenshot below shows the contents of the Home directory through both CLI and GUI.

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 root directory.

Root Directory

AVOID USING ROOT ACCESS

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

Sudo Command

Adding sudo allows you to run a terminal command as administrator. This helps prevent accidents becuase you do not have root access, but 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 [email protected] which identifies [email protected]

Your terminal will show [email protected] in place of [email protected]

Important Directories

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 Eth1 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

This table shows a list of commands, but the following section will discuss in greater detail.

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 path)

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

sudo chown -R goeth:goeth /var/lib/goethereum

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

Now that we've covered directories and commands, let's practice with a few exercises.