
=head1 名前

virt-customize - Customize a virtual machine

=head1 書式

 virt-customize
    [ -a disk.img [ -a disk.img ... ] | -d domname ]
    [--attach ISOFILE] [--attach-format FORMAT]
    [ -c URI | --connect URI ] [ -n | --dry-run ]
    [ --format FORMAT] [ -m MB | --memsize MB ]
    [ --network | --no-network ]
    [ -q | --quiet ] [--smp N] [ -v | --verbose ] [-x]
__CUSTOMIZE_SYNOPSIS__

 virt-customize [ -V | --version ]

=head1 説明

Virt-customize can customize a virtual machine (disk image) by installing packages, editing configuration files, and so on.

Virt-customize modifies the guest or disk image I<in place>.  The guest must be shut down.  If you want to preserve the existing contents of the guest, I<you must snapshot, copy or clone the disk first>.

You do I<not> need to run virt-customize as root.  In fact we'd generally recommend that you don't.

Related tools include: L<virt-sysprep(1)> and L<virt-builder(1)>.

=head1 オプション

=over 4

=item B<--help>

簡単なヘルプを表示します。

=item B<-a> file

=item B<--add> file

仮想マシンからディスクイメージの I<file> を追加します。

ディスクイメージの形式は自動的に検出されます。強制的に特定の形式を使用するには I<--format> オプションを使用します。

=item B<-a> URI

=item B<--add> URI

Add a remote disk.  The URI format is compatible with guestfish.  See L<guestfish(1)/ADDING REMOTE STORAGE>.

=item B<--attach> ISOFILE

The given disk is attached to the libguestfs appliance.  This is used to provide extra software repositories or other data for customization.

You probably want to ensure the volume(s) or filesystems in the attached disks are labelled (or use an ISO volume name) so that you can mount them by label in your run-scripts:

 mkdir /tmp/mount
 mount LABEL=EXTRA /tmp/mount

You can have multiple I<--attach> options, and the format can be any disk format (not just an ISO).

=item B<--attach-format> FORMAT

Specify the disk format for the next I<--attach> option.  The C<FORMAT> is usually C<raw> or C<qcow2>.  Use C<raw> for ISOs.

=item B<--colors>

=item B<--colours>

Use ANSI colour sequences to colourize messages.  This is the default when the output is a tty.  If the output of the program is redirected to a file, ANSI colour sequences are disabled unless you use this option.

=item B<-c> URI

=item B<--connect> URI

libvirt を使用していると、指定された I<URI> に接続します。  省略すると、デフォルトの libvirt ハイパーバイザーに接続します。

ゲストのブロックデバイスを直接指定していると（(I<-a>)）、libvirt は何も使用されません。

=item B<-d> guest

=item B<--domain> guest

名前付きの libvirt 仮想マシンからすべてのディスクを追加します。  名前の代わりに仮想マシンの UUID を使用できます。

=item B<-n>

=item B<--dry-run>

Perform a read-only "dry run" on the guest.  This runs the sysprep operation, but throws away any changes to the disk at the end.

=item B<--echo-keys>

When prompting for keys and passphrases, virt-customize normally turns echoing off so you cannot see what you are typing.  If you are not worried about Tempest attacks and there is no one else in the room you can specify this flag to see what you are typing.

=item B<--format> raw|qcow2|..

=item B<--format> auto

The default for the I<-a> option is to auto-detect the format of the disk image.  Using this forces the disk format for I<-a> options which follow on the command line.  Using I<--format auto> switches back to auto-detection for subsequent I<-a> options.

例:

 virt-customize --format raw -a disk.img

forces raw format (no auto-detection) for F<disk.img>.

 virt-customize --format raw -a disk.img --format auto -a another.img

forces raw format (no auto-detection) for F<disk.img> and reverts to auto-detection for F<another.img>.

仮想マシンのディスクイメージが信頼できない raw 形式である場合、 ディスク形式を指定するためにこのオプションを使用すべきです。 これにより、悪意のある仮想マシンにより起こり得る セキュリティ問題を回避できます (CVE-2010-3851)。

__INCLUDE:key-option.pod__

__INCLUDE:keys-from-stdin-option.pod__

=item B<-m> MB

=item B<--memsize> MB

Change the amount of memory allocated to I<--run> scripts.  Increase this if you find that I<--run> scripts or the I<--install> option are running out of memory.

The default can be found with this command:

 guestfish get-memsize

=item B<--network>

=item B<--no-network>

Enable or disable network access from the guest during the installation.

Enabled is the default.  Use I<--no-network> to disable access.

The network only allows outgoing connections and has other minor limitations.  See L<virt-rescue(1)/NETWORK>.

If you use I<--no-network> then certain other options such as I<--install> will not work.

This does not affect whether the guest can access the network once it has been booted, because that is controlled by your hypervisor or cloud environment and has nothing to do with virt-customize.

Generally speaking you should I<not> use I<--no-network>.  But here are some reasons why you might want to:

=over 4

=item 1.

Because the libguestfs backend that you are using doesn't support the network.  (See: L<guestfs(3)/BACKEND>).

=item 2.

Any software you need to install comes from an attached ISO, so you don't need the network.

=item 3.

You don’t want untrusted guest code trying to access your host network when running virt-customize.  This is particularly an issue when you don't trust the source of the operating system templates.  (See L</SECURITY> below).

=item 4.

You don’t have a host network (eg. in secure/restricted environments).

=back

=item B<-q>

=item B<--quiet>

Don’t print log messages.

To enable detailed logging of individual file operations, use I<-x>.

=item B<--smp> N

Enable N E<ge> 2 virtual CPUs for I<--run> scripts to use.

=item B<-v>

=item B<--verbose>

デバッグ用の冗長なメッセージを有効にします。

=item B<-V>

=item B<--version>

バージョン番号を表示して、終了します。

=item B<--wrap>

Wrap error, warning, and informative messages.  This is the default when the output is a tty.  If the output of the program is redirected to a file, wrapping is disabled unless you use this option.

=item B<-x>

libguestfs API 呼び出しのトレースを有効にします。

=back

=head2 Customization options

__CUSTOMIZE_OPTIONS__

=head1 SELinux

For guests which make use of SELinux, special handling for them might be needed when using operations which create new files or alter existing ones.

For further details, see L<virt-builder(1)/SELINUX>.

=head1 終了ステータス

このプログラムは、成功すると 0 を返します。または、エラーが起きると 1 を返します。

=head1 環境変数

=over 4

=item C<VIRT_TOOLS_DATA_DIR>

This can point to the directory containing data files used for Windows firstboot installation.

Normally you do not need to set this.  If not set, a compiled-in default will be used (something like F</usr/share/virt-tools>).

This directory may contain the following files:

=over 4

=item F<rhsrvany.exe>

This is the RHSrvAny Windows binary, used to install a "firstboot" script in Windows guests.  It is required if you intend to use the I<--firstboot> or I<--firstboot-command> options with Windows guests.

See also: C<https://github.com/rwmjones/rhsrvany>

=item F<pvvxsvc.exe>

This is a Windows binary shipped with SUSE VMDP, used to install a "firstboot" script in Windows guests.  It is required if you intend to use the I<--firstboot> or I<--firstboot-command> options with Windows guests.

=back

=back

他の環境変数は L<guestfs(3)/環境変数> を参照してください。

=head1 関連項目

L<guestfs(3)>, L<guestfish(1)>, L<virt-builder(1)>, L<virt-clone(1)>, L<virt-rescue(1)>, L<virt-resize(1)>, L<virt-sparsify(1)>, L<virt-sysprep(1)>, L<virsh(1)>, L<lvcreate(8)>, L<qemu-img(1)>, L<scrub(1)>, L<http://libguestfs.org/>, L<http://libvirt.org/>.

=head1 著者

Richard W.M. Jones L<http://people.redhat.com/~rjones/>

=head1 COPYRIGHT

Copyright (C) 2011-2025 Red Hat Inc.

