Differences
This shows you the differences between two versions of the page.
— | tech:linux:setup_new_vm [2025/01/15 12:32] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Setting up a new Linux VM ====== | ||
+ | This is similar to [[setup_new_box|Setup New Liux (Physical) Box]] | ||
+ | |||
+ | This page goes through the various settings that take place to setup a new Ubuntu VM. In this case I was setting Ubuntu 20.10 Groovy Gorilla. | ||
+ | |||
+ | ===== Debian / Bookworm ===== | ||
+ | Specific steps for Debian/ | ||
+ | ==== Add non-free repositories ==== | ||
+ | In the past (Debian Buster) you will have to update ''/ | ||
+ | < | ||
+ | deb http:// | ||
+ | deb-src http:// | ||
+ | |||
+ | deb http:// | ||
+ | deb-src http:// | ||
+ | |||
+ | deb http:// | ||
+ | deb-src http:// | ||
+ | </ | ||
+ | |||
+ | When installing on Dell PowerEdge R630 | ||
+ | < | ||
+ | deb http:// | ||
+ | deb-src http:// | ||
+ | |||
+ | deb http:// | ||
+ | deb-src http:// | ||
+ | |||
+ | # bookworm-updates, | ||
+ | # see https:// | ||
+ | deb http:// | ||
+ | deb-src http:// | ||
+ | </ | ||
+ | |||
+ | ==== Install packages ==== | ||
+ | <code bash> | ||
+ | apt update | ||
+ | apt-get install aptitude | ||
+ | aptitude install vim sudo sysstat locate postfix ssl-cert bsd-mailx net-tools zip unzip rsync git screen | ||
+ | ln -s / | ||
+ | updatedb | ||
+ | </ | ||
+ | |||
+ | Optional packages to install | ||
+ | <code bash> | ||
+ | aptitude install ncdu htop nload pydf iotop | ||
+ | </ | ||
+ | |||
+ | Use '' | ||
+ | ==== Other changes ==== | ||
+ | * vim: Besides other .vimrc setting, also include '' | ||
+ | |||
+ | <code bash> | ||
+ | echo "set mouse=" | ||
+ | sudo echo "set mouse=" | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Comments on Minimum Memory requirements ==== | ||
+ | https:// | ||
+ | |||
+ | ==== Update root password ==== | ||
+ | When cloning, make sure to update the root password on the clone. | ||
+ | |||
+ | ==== SSHD Config Changes ==== | ||
+ | Update ''/ | ||
+ | < | ||
+ | PermitRootLogin prohibit-password | ||
+ | PermitEmptyPasswords no | ||
+ | TCPKeepAlive yes | ||
+ | </ | ||
+ | To temporarily enable Root Login | ||
+ | < | ||
+ | PermitRootLogin yes | ||
+ | </ | ||
+ | |||
+ | ==== Network configuration ==== | ||
+ | Specify the Static IP address and DNS address in ''/ | ||
+ | < | ||
+ | # This file describes the network interfaces available on your system | ||
+ | # and how to activate them. For more information, | ||
+ | |||
+ | source / | ||
+ | |||
+ | # The loopback network interface | ||
+ | auto lo | ||
+ | iface lo inet loopback | ||
+ | |||
+ | # The primary network interface | ||
+ | allow-hotplug enp0s3 | ||
+ | #iface enp0s3 inet dhcp | ||
+ | auto enp0s3 | ||
+ | iface enp0s3 inet static | ||
+ | address 192.168.1.47 | ||
+ | netmask 255.255.255.0 | ||
+ | network 192.168.1.0 | ||
+ | gateway 192.168.1.1 | ||
+ | broadcast 192.168.1.255 | ||
+ | dns-nameservers 192.168.1.48 | ||
+ | dns-nameservers 192.168.1.10 | ||
+ | dns-nameservers 192.168.1.1 | ||
+ | dns-nameservers 8.8.8.8 | ||
+ | |||
+ | # This is an autoconfigured IPv6 interface | ||
+ | #iface enp0s3 inet6 auto | ||
+ | |||
+ | # | ||
+ | # The network interface for Host-Only Network | ||
+ | auto enp0s8 | ||
+ | iface enp0s8 inet static | ||
+ | address 192.168.56.47 | ||
+ | netmask 255.255.255.0 | ||
+ | network 192.168.56.0 | ||
+ | gateway 192.168.56.1 | ||
+ | broadcast 192.168.56.255 | ||
+ | </ | ||
+ | |||
+ | Update ''/ | ||
+ | < | ||
+ | nameserver 192.168.1.48 | ||
+ | nameserver 192.168.1.10 | ||
+ | nameserver 192.168.1.1 | ||
+ | nameserver 8.8.8.8 | ||
+ | options timeout:1 | ||
+ | options attempts:1 | ||
+ | </ | ||
+ | |||
+ | ==== Include DNS entry in DNS Servers ==== | ||
+ | Include the new server in the DNS entries on the DNS servers: '' | ||
+ | |||
+ | Add the entry in ''/ | ||
+ | < | ||
+ | 192.168.1.50 | ||
+ | </ | ||
+ | Restart dnsmasq | ||
+ | <code bash> | ||
+ | systemctl restart dnsmasq | ||
+ | # OR | ||
+ | service dnsmasq restart | ||
+ | </ | ||
+ | |||
+ | ==== Backuppc configuration ==== | ||
+ | Add new server in Backuppc (ubv33) ''/ | ||
+ | <code bash> | ||
+ | ssh-copy-id root@< | ||
+ | </ | ||
+ | |||
+ | ==== Nagios configuration ==== | ||
+ | Below is the list of Nagios configurations | ||
+ | <code bash> | ||
+ | aptitude install nagios-nrpe-server | ||
+ | # On / | ||
+ | # Copy / | ||
+ | # Copy the following files from another server to ''/ | ||
+ | # check_deleted_lsof | ||
+ | # check_cpu.sh | ||
+ | # check_uptime | ||
+ | # check_template | ||
+ | # check_mem.pl | ||
+ | # check_lost_found | ||
+ | # check_log1 | ||
+ | # check_file_per | ||
+ | # check_mailq | ||
+ | # Make nagios user part of sudo group | ||
+ | systemctl restart nagios-nrpe-server | ||
+ | </ | ||
+ | |||
+ | Update file ''/ | ||
+ | < | ||
+ | allowed_hosts=127.0.0.1,:: | ||
+ | </ | ||
+ | |||
+ | Create file ''/ | ||
+ | < | ||
+ | command[check_cu_users]=/ | ||
+ | command[check_cu_load]=/ | ||
+ | command[check_cu_zombie_procs]=/ | ||
+ | command[check_cu_total_procs]=/ | ||
+ | command[check_cu_swap]=/ | ||
+ | command[check_cu_mailq]=/ | ||
+ | command[check_cu_ntp_time]=/ | ||
+ | command[check_cu_memory]=/ | ||
+ | command[check_cu_raid]=/ | ||
+ | command[check_cu_cron]=/ | ||
+ | command[check_cu_pcpu]=/ | ||
+ | command[check_cu_fp_tmp]=/ | ||
+ | command[check_cu_disk]=/ | ||
+ | command[check_cu_uptime]=/ | ||
+ | command[check_cu_cpu]=/ | ||
+ | command[check_cu_lostfound]=/ | ||
+ | command[check_cu_kernlog]=/ | ||
+ | command[check_cu_deleted_lsof]=/ | ||
+ | # | ||
+ | # Specific item(s) | ||
+ | command[check_cu_openvpn]=/ | ||
+ | </ | ||
+ | |||
+ | Add nagios to sudo group to execute commands that need root access | ||
+ | <code bash> | ||
+ | usermod -a -G sudo nagios | ||
+ | </ | ||
+ | ==== Tools Directory ==== | ||
+ | Copy / | ||
+ | |||
+ | ==== Postfix ==== | ||
+ | Validate Postfix configuration | ||
+ | |||
+ | ==== MySQL ==== | ||
+ | * Choose a password: '' | ||
+ | * Run '' | ||
+ | * Use the above password | ||
+ | * Run [[tech: | ||
+ | * Copy / | ||
+ | * [[tech1: | ||
+ | |||
+ | |||
+ | ===== Install Configuration / Steps ===== | ||
+ | * Postfix is no longer installed by default on Groovy - so please install | ||
+ | |||
+ | ===== System Configuration ===== | ||
+ | * Update system by running " | ||
+ | * Completed Security Upgrades | ||
+ | * Complete Package Upgrades | ||
+ | * Reboot | ||
+ | * Network configuration | ||
+ | * Settings are at [[setup_network_groovy|/ | ||
+ | * Update user settings with [[etc_skel|this]] set | ||
+ | * Install the [[most_common_packages_v2|most common packages]] that will the required | ||
+ | |||
+ | ===== apt related ===== | ||
+ | * [[tech: | ||
+ | * [[tech: | ||
+ | |||
+ | ===== More items ===== | ||
+ | |||
+ | * Setup postfix | ||
+ | * Configure ''/ | ||
+ | < | ||
+ | root: system@example.org | ||
+ | user: system@example.org | ||
+ | </ | ||
+ | Then run '' | ||
+ | * SSH | ||
+ | * Generate SSH private and public keys | ||
+ | * Tuning | ||
+ | * Change swapiness and other parameters based on server needs - [[tech: | ||
+ | * Others | ||
+ | * Optionally ask server to reboot automatically on [[tech1: | ||
+ | * [[tech1: | ||
+ | * Install NRPE to be monitored | ||
+ | * nagios-nrpe-server nagios-plugins | ||
+ | * Install x11-utils x11-xserver-utils | ||
+ | |||
+ | ===== Other Items configuration ===== | ||
+ | * [[apache_configuration|Apache Configuration]] | ||
+ | * [[tech: | ||
+ | * [[tech: | ||
+ | * [[tech: | ||
+ | * [[tech: | ||
+ | * [[tech: | ||
+ | * [[tech: | ||
+ | * [[tech: | ||
+ | * Install telnetd - To be used in case SSH server is down. Remember to change password immediately if doing a remote connection. | ||
+ | * [[tech: | ||
+ | * [[apt_update_resource_overload|Disable APT update resource overload]] | ||
+ | * Nagios | ||
+ | * If only setting this up for being monitored install nagios-nrpe-server nagios-plugins | ||
+ | * Share keys between Nagios host and the new VM | ||
+ | * Backuppc | ||
+ | * Setup key share access between backuppc host and the new VM | ||