How to Install Linux Network and Automation Tools

This cheat sheet provides a streamlined list of installation commands for essential Linux Ubuntu tools used in networking and automation applications. Ubuntu is the most deployed Linux distro for automation, cloud, and containers used by network engineers and DevOps.

The software includes Python, Ansible, Docker, Terraform, and networking services such as DHCP, FTP, and VPN. While most sections include direct install commands, there are also filenames for editing configuration settings. Paste commands to ChatGPT for an explanation of commands.

🧰 System Preparation

Updates the system packages to the latest versions and installs essential system utilities needed for adding repositories and managing packages.
sudo apt update && sudo apt upgrade -y
sudo apt install -y software-properties-common apt-transport-https ca-certificates curl gnupg lsb-release

🐍 Python3 Automation Components

Installs Python3 along with pip and virtual environment tools, then creates a dedicated virtual environment for automation projects.

Python3 and Virtual Environment

Create Python3 virtual environment in ~/automation-venv

sudo apt install -y python3 python3-pip python3-venv 
python3 -m venv ~/automation-venv

Activate Virtual Environment

source ~/automation-venv/bin/activate
python3 -m pip install --upgrade pip

Python Packages for Network Automation

pip install --timeout 60 netmiko napalm requests ncclient pyats[full]

Ansible

sudo apt install -y ansible
ansible --version

🛠️ Developer Tools

Visual Studio Code Editor

sudo snap install --classic code
# type 'code' to start application

Terraform

# Add HashiCorp GPG key
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp.gpg

# Add HashiCorp repo
echo "deb [signed-by=/usr/share/keyrings/hashicorp.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list

# Install Terraform
sudo apt update && sudo apt install -y terraform

🌐 Networking and Connectivity Tools

OpenSSH (Client and Server)

sudo apt install -y openssh-client openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh

Essential Tools

sudo apt install -y git wget traceroute mtr nmap tcpdump iperf3 bind9-dnsutils ethtool curl
# Some of the commands (tcpdump etc) require sudo privilege to run

🐳 Docker and Container Networking

Docker CE

curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER
newgrp docker

Containerlab

curl -sL https://get.containerlab.dev | bash
# install docker first. sudo needed unless user has proper permissions

🔧 Network Services

DHCP Server

sudo apt install -y isc-dhcp-server
sudo systemctl enable isc-dhcp-server
sudo systemctl start isc-dhcp-server

# configure settings
sudo nano /etc/dhcp/dhcpd.conf
# assign DHCP to interface in /etc/default/isc-dhcp-server
INTERFACESv4="ens33"

NGINX Web Server

sudo apt install -y nginx
sudo systemctl enable nginx
sudo systemctl start nginx
# default web root: /var/www/html

OpenSSL

sudo apt install -y openssl
# used for certificate generation

rsyslog

sudo apt install -y rsyslog

# uncomment lines in rsyslog.conf
sudo nano /etc/rsyslog.conf
module(load="imudp")
input(type="imudp" port="514")
module(load="imtcp")
input(type="imtcp" port="514")

sudo systemctl enable rsyslog
sudo systemctl restart rsyslog
sudo systemctl status rsyslog

TFTP Server

sudo apt install -y tftpd-hpa
sudo mkdir -p /var/lib/tftpboot
sudo chown -R tftp:tftp /var/lib/tftpboot
sudo systemctl enable tftpd-hpa

# configure default TFTP directory:
sudo nano /etc/default/tftpd-hpa
TFTP_DIRECTORY=/var/lib/tftpboot
TFTP_OPTIONS=--secure

FTP Server (vsftpd)

sudo apt install -y vsftpd
sudo systemctl enable vsftpd
sudo systemctl restart vsftpd

#edit configuration settings
sudo nano /etc/vsftpd.conf

WireGuard VPN

sudo apt install -y wireguard
sudo systemctl enable wg-quick@wg0

#edit configuration settings
sudo nano /etc/wireguard/wg0.conf

sudo systemctl start wg-quick@wg0
sudo systemctl stop wg-quick@wg0

📦 Tar File Commands

Create Tar of Directory or File (No Compression)

tar -cvf directory.tar directory/
tar -cvf filename.tar filename

Create Tar of Directory or File (Gzip Compression)

tar -czvf directory.tar.gz directory/
tar -czvf filename.tar.gz filename

Extract Uncompressed Tar of Directory or File

tar -xvf directory.tar
tar -xvf filename.tar

Extract Compressed Tar of Directory or File

tar -xzvf directory.tar.gz
tar -xzvf filename.tar.gz

📁 Copy Linux Files to USB (VMware)

VM settings: USB compatibility 3.1
insert USB
select virtual machine hostname

sudo mkdir -p /mnt/usb
lsblk  
sudo mount /dev/sdb1 /mnt/usb/
sudo cp ~/filename /mnt/usb/
sudo umount /mnt/usb
# replace /dev/sdb1 with device name if different