Difference between revisions of "Sysadmin/Add virtual machine"

From Sugar Labs
Jump to navigation Jump to search
 
(47 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=== Create new VM on [[Machine/treehouse]] ===
+
=== Create new VM on [[Machine/justice]] or [[Machine/freedom]] ===
  
virt-clone -o template-jaunty -n foobar
+
This procedure creates a clone of the [[Machine/template-xenial|Ubuntu Xenial template virtual machine]].
virsh start foobar
 
virsh console foobar
 
  
Login using the default root password (ask bernie), then setup the machine:
+
virt-clone -o template-xenial --file=/var/lib/libvirt/images/boot/FOOBAR-boot.img --file=/dev/justice/FOOBAR-root -n FOOBAR
 +
virsh autostart FOOBAR
 +
virsh start --console FOOBAR
  
# change root password
+
* Add A and AAAA records for the new host in the sugarlabs.org zone file (See [[Service/Nameservers]]).
passwd root
+
 
 +
* Now login as root from the console (there should be no password)
 +
 
 +
* setup both IPv4 and IPv6 addresses
  
# setup both IPv4 and IPv6 addresses (remember to update zones)
 
 
  vi /etc/network/interfaces
 
  vi /etc/network/interfaces
+
 
# change machine fqdn
+
* change machine fqdn
  vi /etc/hostname
+
 
vi /etc/postfix/main.cf
+
  sed -i -e s/template-xenial/FOOBAR/g /etc/hosts /etc/hostname /etc/mailname /etc/postfix/main.cf
+
 
# forward mail for root to you
+
* activate new IP and hostname
vi /etc/aliases
+
 
newaliases
+
  /etc/init.d/networking restart
+
 
# activate new IP and hostname
+
* install latest security/stability updates
  service networking restart
+
 
+
  apt-get update
# install latest security/stability updates
+
  apt-get dist-upgrade
  aptitude update
+
 
  aptitude full-upgrade
+
* Find a nice color combo for HOST_COLOR in /etc/zzz_profile.conf
+
 
# generate host keys
+
* generate host keys and a key for root
  ssh-keygen -q -N '' -f /etc/ssh/ssh_host_rsa_key -t rsa
+
 
  ssh-keygen -q -N '' -f /etc/ssh/ssh_host_dsa_key -t dsa
+
  rm /etc/ssh/ssh_host_*
   
+
dpkg-reconfigure openssh-server
  # taa--daah!
+
  ssh-keygen -N "" -f /root/.ssh/id_rsa -t rsa
 +
 
 +
* Setup wizbackup on a backup server (See [[Service/backup]])
 +
 
 +
* Move daily, weekly, monthly cronjobs to a unique timeslot to avoid cpu/net storms
 +
 
 +
  vi /etc/crontab
 +
 
 +
* The most important thing: come up with a funny quip for this machine
 +
 
 +
  vi /etc/motd.tail
 +
 
 +
* Taa--daah!
 +
 
 
  reboot
 
  reboot
 +
 +
* Add the machine to <code>/etc/munin/munin.conf</code> on [[Machine/sunjammer]] for monitoring.
 +
 +
[FOOBAR.sugarlabs.org]
 +
        address FOOBAR.sugarlabs.org
 +
 +
See also: [[Sysadmin/Delete virtual machine]], [[Sysadmin/Migrate_virtual_machine]].

Latest revision as of 21:08, 6 August 2017

Create new VM on Machine/justice or Machine/freedom

This procedure creates a clone of the Ubuntu Xenial template virtual machine.

virt-clone -o template-xenial --file=/var/lib/libvirt/images/boot/FOOBAR-boot.img --file=/dev/justice/FOOBAR-root -n FOOBAR
virsh autostart FOOBAR
virsh start --console FOOBAR
  • Add A and AAAA records for the new host in the sugarlabs.org zone file (See Service/Nameservers).
  • Now login as root from the console (there should be no password)
  • setup both IPv4 and IPv6 addresses
vi /etc/network/interfaces
  • change machine fqdn
sed -i -e s/template-xenial/FOOBAR/g /etc/hosts /etc/hostname /etc/mailname /etc/postfix/main.cf
  • activate new IP and hostname
/etc/init.d/networking restart
  • install latest security/stability updates
apt-get update
apt-get dist-upgrade
  • Find a nice color combo for HOST_COLOR in /etc/zzz_profile.conf
  • generate host keys and a key for root
rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server
ssh-keygen -N "" -f /root/.ssh/id_rsa -t rsa
  • Move daily, weekly, monthly cronjobs to a unique timeslot to avoid cpu/net storms
vi /etc/crontab
  • The most important thing: come up with a funny quip for this machine
vi /etc/motd.tail
  • Taa--daah!
reboot
[FOOBAR.sugarlabs.org]
       address FOOBAR.sugarlabs.org

See also: Sysadmin/Delete virtual machine, Sysadmin/Migrate_virtual_machine.