Parallels linux shared folder

Recreating my perfect web development environment using a Parallels VM and CentOS

As MacUpdate has just launched an excellent bundle deal that includes the virtualization software Parallels Desktop for Mac, I decided the time was ripe to replace my ageing copy of VMWare Fusion with its creaky installation of Ubuntu Server. Almost all of my web development work is done on my Macbook Pro, and my previous setup of running Ubuntu in a VM as my local web server has worked very well. As my external hosting is done on a VPS running CentOS, I thought it’d be a good idea to start running the popular OS locally as well. Parallels meanwhile has been garnering good reviews, and I was particularly drawn to the improved 3D performance over VMWare Fusion (who doesn’t love a bit of gaming now and then), as well as the improved power management features, which should lead to longer battery life.

I had my VMWare Fusion/Ubuntu server setup configured to my particular tastes, and if the new setup was going to work out, Parallels would have to be able to replicate all of that functionality. In particular it would have to:

  1. Let me configure the guest OS (CentOS Linux) with a fixed IP address accessible from the host computer (Mac OS), and
  2. Let me keep my development files outside of the VM, i.e. on the host computer, so that I can edit the files in Mac OS, yet have them served by the VM.

Happy to report that everything went swimmingly, and I’m back up and running with my development work within a day. There was a fair bit of trial and error along the way, and I’ve recorded the steps here for your enjoyment. Hope it helps!

Prepare Parallels networking

The first thing we need to do is tweak Parallel’s networking settings. What we need to do is leave a gap in the DHCP range that we can use to assign a static IP address to our VM.

  1. Open the Parallels preferences, and switch to the Advanced tab.
  2. Click Change settings next to Network.
  3. Under Shared, ensure IPv4 DHCP is enabled
  4. Configure the following values:
    • Start Address: 10.211.55.20
    • End Address: 10.211.55.254
    • Subnet mask: 255.255.255.0

Install CentOS

Next we download and install CentOS. I’ve chosen to download the CentOS 6 minimal distribution as I wanted to keep things compact, and install only the components I need. I’ve chosen to forego a GUI for example. The installation itself is pretty straightforward, but pay particular attention to the network configuration bit.

  1. Download a CentOS 6 64-bit minimal distribution. The filename should be something like CentOS-6.4-x86_64-minimal.iso, but that will depend on the exact version you’re downloading.
  2. Open Parallels and select the downloaded ISO. The installation will run.
  3. Select Install or upgrade an existing system.
  4. Live dangerously and skip the media test. The CentOS installer will now launch.
  5. Click Next, the select your language keyboard preferences.
  6. Choose Basic Storage Devices.
  7. Choose Discard any data when configure the filesystem.
  8. Specify the domain name. I’ve named mine «firefly». You can use anything you like, but remember it as we’ll be using this again later.
  9. Click Configure Network:
    1. Select System eth0 and click Edit.
    2. Tick Connect automatically and Available to all users.
    3. Under IPV4 settings select Manual from the Method drop down.
    4. Under Addresses, click Add and enter the following details:
      • Address: 10.211.55.2
      • Netmask: 255.255.255.0
      • Gateway: 10.211.55.20 (the first IP in the DHCP range)
    5. Under DNS servers, enter 10.211.55.20 again.
    6. Click Apply then close the Network dialogue.

    Check and prepare CentOS installation

    1. Login as root with the password you chose during the installation.
    2. Check the network settings are correct by entering:
    yum -y install setuptool system-config-securitylevel-tui authconfig system-config-network-tui ntsysv
    1. Now choose Firewall configuration and then Run tool.
    2. The firewall should be enabled.
    3. Choose Customize then tick the boxes for SSH and WWW to allow access from the host machine.
    4. Click Forward, Close, OK, then Yes.

    Add the following line to the bottom of the file (again substitute my name for the one you specified when you added the:

    Install Parallels Tools

    The installation of Parallels Tools is required for certain important features to work, notably sharing folders between the guest and host.

    1. With the virtual machine selected, choose Virtual Machine from the Parallels menu, and click Install Parallels Tools…
    2. This is supposed to mount the the Parallels Tools ISO, but as that didn’t work for me, I had to manually mount it:
    mount -o exec /dev/cdrom /media

    Install and configure Apache

    chkconfig --level 23 httpd on

    Set Apache’s document root to a folder on the host computer

    I prefer keeping my actual development files outside the virtual machine. If the VM ever gets corrupted, I know my important files will still be safe and sound. This could also aid you in making backups, as your backup program wouldn’t have to backup the entire virtual machine every time a file is changed. Nowadays, Parallels has good Time Machine integration, so it’ll only back up incrementally (not so for VMWare Fusion at the time of writing), but I just feel much safer not having my files wrapped up in a container.

    1. With the virtual machine selected, choose Virtual Machine from the Parallels menu, and click Configure.
    2. Under the Options tab, select Sharing.
    3. Click Custom Folders.
    4. Add the folder that contains all your web files, with «Read & Write» permissions.
    5. You might have to reboot the VM at this point to pick up the new shared folder(s).
    6. Parallels mounts shared folders in /media/psf, so you should now be able see your shared folders there.
    7. By default, Apache’s document root (the directory from which it serves files), is set to /var/www/html. We’ll replace that folder with a symbolic link to the folder we just shared. First we delete the html folder:

    Install PHP

    Install and configure MySQL

    yum -y install mysql mysql-server
    chkconfig --levels 235 mysqld on
    mysqladmin -u root password

    Optionally install and configure phpMyAdmin

    1. phpMyAdmin is not available in one of the default repositories, so we need to enable the EPEL (Extra Packages for Enterprise Linux) repository. Go here and download the listed RPM package to your VM.
    2. From the directory where the RPM is saved, enter:
    vi /etc/httpd/conf.d/phpMyAdmin.conf


    Posted Tue, 12 Mar 2013 — 15:15

    Источник

    Parallels Desktop

    Parallels Desktop is a hypervisor for macOS which allows users to install a variety of operating systems as «virtual machines» (guests) on the host system, reducing the need for managing multiple physical machines. A more complete description on virtualization can be found at Wikipedia.

    Installation of Arch as a guest

    Parallels Desktop supports Linux guests out of the box, but only offers support for a few Linux distributions — excluding Arch Linux. This means the installation of Parallels tools have not been tested by the vendor, and requires some manual intervention to work under Arch. If you do not wish to use Parallels tools, installation is as simple as choosing «other linux» when creating a new virtual machine and proceeding as you would on any real machine.

    Parallels Desktop on an Apple Mac x86_64 hardware

    In addition to the instructions below, there is an installation guide for Arch Linux in Parallels Knowledgebase.

    Parallels Desktop on an Apple Mac M1 and higher

    You can use the Archboot aarch64 images to install a VM as you like it.

    If you want a plain image right to start: Download VM, for login information please look at the Readme

    Parallels tools

    Overview

    To improve interoperability between the host and the guest operating systems, Parallels provides a package called «Parallels tools» which contains kernel modules and userspace utilities. See Parallels Tools Overview for a list of its features.

    This article assumes users want to make full use of the tools, including Xorg configuration. If you are running a headless server, you can skip over the sections relating to X.

    When referring to the version of parallel tools the form is .. For example: 9.0.24237.1028877 corresponds to Parallels version 9.0.24237 with tools version 1028877

    Configuring Xorg

    The Parallels tools installer will take care of configuring Xorg, so just follow the instructions at Xorg to install the relevant packages on your system. Install the xf86-video-vesa package to use the vesa driver.

    Preparing dependencies

    You need to install standard build utilities gcc , dkms and linux-headers .

    Installing Parallels tools

    This article or section is out of date.

    Reason: Those kernel versions are outdated and not the LTS kernel. Are the patching instructions still relevant? (Discuss in Talk:Parallels Desktop)

    Choose «install Parallels Tools» from the «Virtual Machine» menu. Parallels Tools are located on a cd-image, which will be connected to your virtual machine. You have to mount it first:

    Now you can proceed to install Parallels tools using the installation script as follows:

    Parallels tools work fine out of the box in most cases, but sometimes you need to patch it:

    Liunx Kernel Parallels Desktop Parallels Tools Work out of box
    5.17 17.1.4 51567 Yes
    5.18 17.1.4 51567 No
    5.18 18.0.0 53049 Yes

    If you have Parallels Desktop 17.1.4 but installed a VM with kernel version 5.18 (check with uname -a ), follow the troubleshooting section below:

    Troubleshooting: Patch Parallels 17 to support Kernel 5.18

    Choose «install Parallels Tools» from the «Virtual Machine» menu. Parallels Tools are located on a cd-image, which will be connected to your virtual machine.

    You need root permission in this process. Become root user, then mount the Tools virtual CD in your Linux VM:

    Copy the full CD directory to home directory and rename it to prl-tools-build :

    $ cp -R /mnt ~ $ cd ~ $ mv mnt prl-tools-build

    Download the community patch, then prepare kmods/ to be patched::

    $ wget https://raw.githubusercontent.com/wegank/nixos-config/7b89b4c6d1a87c83f10aa5d0f96fe0229795056e/hardware/parallels-unfree/prl-tools.patch $ cd ~/prl-tools-build/kmods $ tar zxf prl_mod.tar.gz $ rm prl_mod.tar.gz

    Apply the patch, then install:

    $ cd ~/prl-tools-build $ patch -p1 < prl-tools.patch $ cd kmods $ tar zcf prl_mod.tar.gz * $ cd ~/prl-tools-build $ ./install

    (See this thread for a community-provided patch from Parallels forum.) (See this thread for a step-by-step instruction on how to apply any Parallels Tools patch provided in the forum.)

    Using the tools

    Sharing folders

    • You can specify which folders on your hosts system you would like to share with your guests under "virtual machine > configuration > sharing".
    • The folder will appear at /mnt/psf .

    Dynamic Display Resolution

    A very helpful tool is prlcc . It changes the resolution of the display (in the guest - not the host) automatically when your resize your window. If this tool is not running, the contents of the window gets stretched or shrunken. prlcc is usually started automatically and runs in the background. If not, run the following (or place it in a configuration file like /etc/X11/xinit/xinitrc.d/90-prlcc ):

    Synchronize clipboard

    The tool prlcp can be run to synchronize the clipboard between guest and host. Like the previous tool, if it is not executed automatically, it is recommended to start it in a configuration file like .xinitrc :

    Future work

    In general, updating system packages like the linux kernel or Xorg can break Parallels tools and you will need to re-install them. In some cases, new packages will be incompatible with the tools and they will stop working - in that case you will need to roll back the newly installed packages and wait until Parallels releases a new product build before updating your guest (in the hope they have resolved any previous incompatibilities).

    See also

    Источник

    Читайте также:  Локальная сеть интернет linux mint
Оцените статью
Adblock
detector