Skip to content

Instantly share code, notes, and snippets.

@rferreiraperez
Last active October 8, 2024 07:45
Show Gist options
  • Save rferreiraperez/979d68fa3aea0730a8618e26d179197e to your computer and use it in GitHub Desktop.
Save rferreiraperez/979d68fa3aea0730a8618e26d179197e to your computer and use it in GitHub Desktop.
Steps to configure empty virtual machine
#!/bin/bash
#
# Steps to configure a new empty virtual machine
#
# Updates
sudo apt update && sudo apt upgrade -y
# Host
sudo nano /etc/hostname
sudo nano /etc/hosts
# Network
sudo nano /etc/netplan/00-installer-config.yaml
# Firewall
sudo ufw enable
sudo ufw default allow outgoing
sudo ufw default deny incoming
# Firewall - Default rules
# SSH
sudo ufw allow 22
# HTTP
sudo ufw allow HTTP
# HTTPS
sudo ufw allow HTTPS
# PROMETHEUS
# sudo ufw allow 9100
# FILEBEATS
# sudo ufw allow 5044
# Certificate
sudo mkdir /opt/{project}/certs
sudo openssl req -new -newkey rsa:2048 -nodes -out [project]_tekniker_es.csr -keyout [project]_tekniker_es.key -subj "/C=ES/ST=GUIPUZCOA/L=EIBAR/O=FUNDACION TEKNIKER/OU=IT/CN=[project].tekniker.es"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment