Thanks Richard. I followed your guide and it works for me.

Thanks,
Allen

2016-07-13 17:04 GMT+08:00 Richard W.M. Jones <rjones@redhat.com>:
[Let's keep the replies on the mailing list please]

On Wed, Jul 13, 2016 at 11:04:13AM +0800, Baochuan Wu wrote:
> Thanks Richard.
> I tried guestfs_set_network, and I think I can successfully use yum -y to
> install software. It is a little slow.

Most of the time is taken running yum and downloading packages ...

> My program operates CentOS 6.4 VM virtual disks on CentOS 7, I installed
> libguestfs into the CentOS 6.4. After installing, I reboot CentOS 6.4 but I
> cannot log into it anymore.

You will need to relabel the filesystem after installing packages, see:

  https://github.com/libguestfs/libguestfs/blob/master/customize/customize_run.ml#L415-L430

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html