How to create a local ISO repository in XCP-ng
Even if the best practice is to create an ISO "store" on a network share, sometimes you don't have the choice: you need a local SR ISO.
Context
Obviously, if you can use an NFS or SMB share to store your ISO, this is the way to go. But if you have a single host, or no external network access, you might need to create a local ISO storage repository. This way, you can create your VMs with an ISO stored locally.
However, before doing that, please read very carefully the following message:
You have two options:
- create it via Xen Orchestra (easiest way)
- on the command line
Let's see both options!
Via Xen Orchestra
Xen Orchestra is the de facto standard client to manage your XCP-ng hosts. If you do not have it yet, go deploy your XOA now!
Quick'n dirty
Here is the easiest way to achieve it. In Xen Orchestra, left main menu, go into "+ New", then "Storage". Select your host, then fill the form:
- Host: the host you want to create the local ISO SR
- Name/description: the name label and description of your ISO SR (you can change it anytime later)
- Storage type: ISO SR/Local
- Path:
/media
So why /media
? The folder already exists, and nothing else should be added in there.
Click on "Create" and you are done:
Upload your ISO
Now you can import your favorite distro ISO via Xen Orchestra directly: in the left menu, go in "Import", then "Disk", select your freshly created ISOs SR and then drag & drop your ISO:
Want a specific folder?
If you want to put your ISOs in a specific folder, you need to SSH to your host. Then, create your ISO directory, for example:
mkdir -p /var/opt/xen/ISO_Store
After that, when you create it with Xen Orchestra, just use this path.
Via the command line
So it starts by creating the folder you want, or directly creating the SR via xe
CLI.
If you want to create a specific dedicated folder, go with this for example:
mkdir -p /var/opt/xen/ISO_Store
Then, you can create the ISO SR:
xe sr-create name-label=LocalISO type=iso device-config:location=/var/opt/xen/ISO_Store device-config:legacy_mode=true content-type=iso
Network share: a better place for your ISOs
Ideally, you should really use a network share for deploying your ISOs. As soon you have more than one host, it's more efficient to have one place to put them all.
Also, it won't use any bit of space on your local installation, and you can keep a centralize source of content regardless how big is your infrastructure.
And it's also very simple to create: in Xen Orchestra, that's almost the same operation, but insteadon "Local", select "NFS ISO" or "SMB", put the share name and… that's it! Same thing to upload, so it's really trivial and more secure than using ISO locally.