As described here http://andyinthecloud.com/2013/06/23/look-ma-no-hands-automating-install-and-uninstall-of-packages/ managed packages can be installed via ant or the APEX wrapper.
Is it possible to install unmanaged packages, too? If so, how?
As described here http://andyinthecloud.com/2013/06/23/look-ma-no-hands-automating-install-and-uninstall-of-packages/ managed packages can be installed via ant or the APEX wrapper.
Is it possible to install unmanaged packages, too? If so, how?
It's not possible with that method. The InstalledPackage metadata type requires a namespace and unmanaged packages don't have one.
What you can do is install the unmanaged package into an org and then do a retrieve of the package's metadata. You can use the retrieved package metadata to deploy into any other org via ant or any other deployment tool. It will create the package and add all the metadata into it the same as would be done if you install the unmanaged package through the installation url.
The way this works is the magical <fullName>PACKAGE_NAME</fullName>
line in the package.xml when retrieved passing the packageNames parameter instead of a manifest to retrieve. Here's an example:
https://github.com/SalesforceFoundation/CumulusCI/blob/master/build/cumulusci.xml#L252