proxmox:lxc:lxc-template
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
proxmox:lxc:lxc-template [2022/01/14 07:09] – [Modify the Container] chuck | proxmox:lxc:lxc-template [2022/01/14 07:47] (current) – [Modifying or Updating] chuck | ||
---|---|---|---|
Line 74: | Line 74: | ||
stow dotfiles | stow dotfiles | ||
</ | </ | ||
- | * Create ~/.ssh directory:< | + | * Create |
mkdir ~/.ssh | mkdir ~/.ssh | ||
</ | </ | ||
- | * Create ~/ | + | * Create |
* And so on.... | * And so on.... | ||
- | * Bonus points if you have an Ansible playbook to run the commands. | + | * Bonus points if you have an Ansible playbook to run the commands! |
---- | ---- | ||
Line 86: | Line 86: | ||
In order to turn the container into a template, we need to delete the network interface then create a backup. | In order to turn the container into a template, we need to delete the network interface then create a backup. | ||
* From proxmox (not inside the container): | * From proxmox (not inside the container): | ||
- | * Remove the network interface:< | + | * Remove the network interface:< |
- | [user@proxmox]$ | + | sudo pct set 250 --delete net0 |
</ | </ | ||
- | * Create a backup:< | + | * Create a backup:< |
- | [user@proxmox]$ | + | vzdump 250 --mode stop --compress gzip --dumpdir / |
</ | </ | ||
- | * The new file will be located in:< | + | * The new file will be located in:< |
/ | / | ||
</ | </ | ||
- | * You can leave it as is or rename it to something:< | + | * You can leave it as is or rename it to something: |
- | [user@proxmox]$ | + | * Change directories:< |
- | + | cd / | |
- | [user@proxmox]$ | + | </ |
+ | * Rename it:<code bash> | ||
+ | sudo mv new_vz_dump.tar.gz custom_debian_10.4.tar.gz | ||
</ | </ | ||
* See '' | * See '' | ||
Line 111: | Line 113: | ||
=====Modifying or Updating===== | =====Modifying or Updating===== | ||
It's really easy to modify the container when a new version of the OS is released or you want to add something to your templates. | It's really easy to modify the container when a new version of the OS is released or you want to add something to your templates. | ||
- | * Create a container with your custom file:< | + | * Create a container with your custom file:< |
- | [user@proxmox]$ | + | sudo pct create 250 sas-storage: |
- | --storage sas-lvm --rootfs volume=sas-lvm: | + | --storage sas-lvm --rootfs volume=sas-lvm: |
- | --ostype debian --arch amd64 --password insecure --unprivileged 1 \ | + | --ostype debian --arch amd64 --password insecure --unprivileged 1 \ |
- | --cores 1 --memory 1024 --swap 1024 \ | + | --cores 1 --memory 1024 --swap 1024 \ |
- | --hostname lxc-template --searchdomain local.lan --nameserver xxx.xxx.xxx.x \ | + | --hostname lxc-template --searchdomain local.lan --nameserver xxx.xxx.xxx.x \ |
- | --net0 name=eth0, | + | --net0 name=eth0, |
- | --start true | + | --start true |
</ | </ | ||
- | * Enter the container:< | + | * Enter the container:< |
- | [user@proxmox]$ | + | sudo pct enter 250 |
</ | </ | ||
- | * Do stuff:< | + | * Do stuff: |
- | # Update/ | + | * Update the system:< |
- | # Install new stuff | + | apt update && apt upgrade |
- | # Add new dotfiles | + | |
</ | </ | ||
- | | + | * Install some packages |
+ | * Add new dotfiles | ||
+ | * And so on.. | ||
+ | | ||
exit | exit | ||
</ | </ | ||
- | * Remove the network device:< | + | * Remove the network device:< |
- | [user@proxmox]$ | + | sudo pct set 250 --delete net0 |
</ | </ | ||
- | * Create the backup:< | + | * Create the backup:< |
- | [user@proxmox]$ | + | vzdump 250 --mode stop --compress gzip --dumpdir / |
</ | </ | ||
- | * Rename the backup if you like:< | + | * You can leave it as is or rename it to something: |
- | [user@proxmox]$ | + | * Change directories:< |
- | + | cd / | |
- | [user@proxmox]$ | + | </ |
+ | * Rename it:<code bash> | ||
+ | sudo mv new_vz_dump.tar.gz custom_debian_10.5.tar.gz | ||
</ | </ | ||
proxmox/lxc/lxc-template.1642162146.txt.gz · Last modified: 2022/01/14 07:09 by chuck