Sharing VM via Self Service for Parallels

casareanderson
New Contributor III

i am looking to deploy so 7 pre created VM in self service , has anyone does this if yes how have you packaged the VM for deployment and which branch on the machine have you saved it to

1 ACCEPTED SOLUTION

cpdecker
Contributor III

My solution was thus...

  1. Add customized Parallels virtual machine .pvm file, Parallels install .dmg file, and deploy.cfg with license key into Parallels Desktop Autodeploy.pkg (provided by Parallels site)
  2. Verify that installing through double-click on .pkg provides desired results--Parallels gets installed, licensed, and has the VM available in the list, VM works as intended
  3. Tarball the Parallels Desktop Autodeploy.pkg and place compressed file in Composer under /tmp/, build as PKG in composer, upload to Casper admin
sudo tar -czf Parallels Desktop Autodeploy.pkg.tar.gz Parallels Desktop Autodeploy.pkg
  1. Bundle this PKG and combine with an "after" script in the policy:
#!/bin/sh
#Extract
tar -vxzf /tmp/Parallels Desktop Autodeploy.pkg.tar.gz -C /tmp
#Install
sudo installer -pkg /tmp/Parallels Desktop Autodeploy.pkg -target /
#Cleanup
rm -rf /tmp/Parallels Desktop Autodeploy.pkg
rm -rf /tmp/Parallels Desktop Autodeploy.pkg.tar.gz

Seems to work well and cuts 9 gigabytes off the file size. Hope this was helpful to someone!

View solution in original post

5 REPLIES 5

cpdecker
Contributor III

I took a stab at this a couple of weeks ago.

Someone else will very likely chime in with a better way but here was my solution:

-Install Parallels on setup machine
-Install Windows 7 and set customized settings inside Windows 7
-Set Parallels VM sharing settings and preferences
-Exit Parallels
-Compress Parallels VM file (Windows 7.pvm) using tar command
-Add compressed file to Composer under /tmp/Windows 7.pvm.tar.gz and create .pkg
-Upload .pkg to Casper Admin
-Create script to unpackage the VM file and place it in the correct directory for the user:
-Bundle .pkg and script together in a policy with script set to run "after":

!/bin/sh

echo "$3 is the username"

Create Parallels folder if it doesn't exist

if test -e /Users/$3/Documents/Parallels;
then echo "Directory already exists";
else mkdir /Users/$3/Documents/Parallels; echo "Created Parallels directory";
fi

Set owner and permissions

chown $3 /Users/$3/Documents/Parallels
chmod 755 /Users/$3/Documents/Parallels

Move compressed file to Parallels folder

mv /tmp/Windows 7.pvm.tar.gz /Users/$3/Documents/Parallels

Unzip VM File

tar -vxzf /Users/$3/Documents/Parallels/Windows 7.pvm.tar.gz -C /Users/$3/Documents/Parallels/

Set owner and permissions on VM file

chmod -R 711 /Users/$3/Documents/Parallels/Windows 7.pvm
chown -R $3 /Users/$3/Documents/Parallels/Windows 7.pvm

Remove compressed file

rm -rf /Users/$3/Documents/Parallels/Windows 7.pvm.tar.gz

If you haven't seen it before, $3 is populated with the currently logged in user's username when being run by Casper. It won't be populated when you run it locally on your own.

My scripting is probably pretty sloppy compared to most on the site but this has been working reliably for me.

I am still installing Parallels from the website since I couldn't get a licensed package made properly, but I figure the heavy lifting is already done this way. It will still take forever to install via Self Service since the pkg is huge--7 GB for me.

This post was typed in haste--sorry for anything unclear or omitted. Hopefully this will give you an idea of how to proceed.

cpdecker
Contributor III

Looks like "#" turns lines into a header. They should have been comments in the script!

Let's try this...

#!/bin/sh

echo "$3 is the username"

#Create Parallels folder
if test -e /Users/$3/Documents/Parallels;
then
    echo "Directory already exists";
else
    mkdir /Users/$3/Documents/Parallels;
    echo "Created Parallels directory";
fi

#Set owner and permissions
chown $3 /Users/$3/Documents/Parallels
chmod 755 /Users/$3/Documents/Parallels

#Move compressed file to Parallels folder
mv /tmp/Windows 7.pvm.tar.gz /Users/$3/Documents/Parallels

#Unzip VM File
tar -vxzf /Users/$3/Documents/Parallels/Windows 7.pvm.tar.gz -C /Users/$3/Documents/Parallels/

#Set owner and permissions on VM file
chmod -R 711 /Users/$3/Documents/Parallels/Windows 7.pvm
chown -R $3 /Users/$3/Documents/Parallels/Windows 7.pvm

#Remove compressed file
rm -rf /Users/$3/Documents/Parallels/Windows 7.pvm.tar.gz

casareanderson
New Contributor III

@cpdecker thanks i will try it today

cpdecker
Contributor III

So...update!

Somehow went through all this trouble without realizing the Parallels Deployment Tool is a thing that exists: http://kb.parallels.com/en/120093

I have my VM, Parallels, and config file with license built in all bundled into the pkg now, and it works. However, still trying to figure out what to do about compressing this file as its 16 gigabytes!

Any suggestions, nation?

cpdecker
Contributor III

My solution was thus...

  1. Add customized Parallels virtual machine .pvm file, Parallels install .dmg file, and deploy.cfg with license key into Parallels Desktop Autodeploy.pkg (provided by Parallels site)
  2. Verify that installing through double-click on .pkg provides desired results--Parallels gets installed, licensed, and has the VM available in the list, VM works as intended
  3. Tarball the Parallels Desktop Autodeploy.pkg and place compressed file in Composer under /tmp/, build as PKG in composer, upload to Casper admin
sudo tar -czf Parallels Desktop Autodeploy.pkg.tar.gz Parallels Desktop Autodeploy.pkg
  1. Bundle this PKG and combine with an "after" script in the policy:
#!/bin/sh
#Extract
tar -vxzf /tmp/Parallels Desktop Autodeploy.pkg.tar.gz -C /tmp
#Install
sudo installer -pkg /tmp/Parallels Desktop Autodeploy.pkg -target /
#Cleanup
rm -rf /tmp/Parallels Desktop Autodeploy.pkg
rm -rf /tmp/Parallels Desktop Autodeploy.pkg.tar.gz

Seems to work well and cuts 9 gigabytes off the file size. Hope this was helpful to someone!