Skip to content

Unofficial Laravel Homestead for Parallels Desktop on Apple Silicon

License

Notifications You must be signed in to change notification settings

yodoware/homestead-arm64

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Laravel Homestead Unofficial Build for Parallels Desktop on Apple Silicon

This is an unofficial build of Laravel Homestead for Parallels Desktop on Apple Silicon. Make sure you have Parallels Desktop Pro Edition or above in order to use the parallels provider.

To use this box from the laravel/homestead PHP package, edit your Homestead.yaml as follows before vagrant up.

provider: parallels
box: yodoware/homestead-arm64
version: '>= 11.3.0'

Repository

https://github.com/yodoware/homestead-arm64

Environment

This box is built under the following environment.

  • Apple M1
  • macOS Big Sur 11.3.1
  • Parallels Desktop 16 for Mac, Pro Edition 16.5.0 (50692)
  • Vagrant 2.2.15

How this box is built

Started from the VM image of Ubuntu 20.04 ARM64.

Installed Parallels Tools.

Set up the VM as follows.

sudo adduser vagrant
sudo gpasswd -a vagrant sudo
sudo systemctl set-default multi-user.target
sudo apt-get update
sudo apt-get install -y openssh-server
sudo apt-get install -y grub2-common
sudo vi /etc/default/grub
  GRUB_TIMEOUT=5
  GRUB_TERMINAL=console
sudo update-grub

Set up the build environment following the official Laravel Settler document.

Edited the following file to disable automatic installation of Parallels Tools.

  • bento/packer_templates/_common/parallels.sh
-parallels-iso|parallels-pvm)
+parallels-iso)

Created the following file.

  • bento/packer_templates/ubuntu/ubuntu-20.04-arm64.json
{
  "builders": [
    {
      "boot_wait": "5s",
      "output_directory": "{{ user `build_directory` }}/packer-{{user `template`}}-parallels",
      "parallels_tools_mode": "disable",
      "parallels_tools_flavor": "lin",
      "prlctl_version_file": ".prlctl_version",
      "shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
      "ssh_password": "vagrant",
      "ssh_port": 22,
      "ssh_timeout": "10000s",
      "ssh_username": "vagrant",
      "type": "parallels-pvm",
      "source_path": "/Users/YOURNAME/Parallels/Homestead.pvm",
      "vm_name": "{{ user `template` }}"
    }
  ],
  "post-processors": [
    {
      "output": "{{ user `build_directory` }}/{{user `box_basename`}}.{{.Provider}}.box",
      "type": "vagrant"
    }
  ],
  "provisioners": [
    {
      "environment_vars": [
        "HOME_DIR=/home/vagrant",
        "http_proxy={{user `http_proxy`}}",
        "https_proxy={{user `https_proxy`}}",
        "no_proxy={{user `no_proxy`}}"
      ],
      "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E sh -eux '{{.Path}}'",
      "expect_disconnect": true,
      "scripts": [
        "{{template_dir}}/scripts/update.sh",
        "{{template_dir}}/../_common/sshd.sh",
        "{{template_dir}}/scripts/networking.sh",
        "{{template_dir}}/scripts/sudoers.sh",
        "{{template_dir}}/scripts/vagrant.sh",
        "{{template_dir}}/../_common/virtualbox.sh",
        "{{template_dir}}/scripts/vmware.sh",
        "{{template_dir}}/../_common/parallels.sh",
        "{{template_dir}}/scripts/hyperv.sh",
        "{{template_dir}}/scripts/homestead.sh",
        "{{template_dir}}/../_common/minimize.sh"
      ],
      "type": "shell"
    }
  ],
  "variables": {
    "box_basename": "ubuntu-20.04",
    "build_directory": "../../builds",
    "build_timestamp": "{{isotime \"20060102150405\"}}",
    "cpus": "2",
    "disk_size": "524288",
    "git_revision": "__unknown_git_revision__",
    "guest_additions_url": "",
    "headless": "",
    "http_directory": "{{template_dir}}/http",
    "http_proxy": "{{env `http_proxy`}}",
    "https_proxy": "{{env `https_proxy`}}",
    "hyperv_generation": "2",
    "hyperv_switch": "bento",
    "iso_checksum": "5922d88e2e5de002bc3af1c2ef2c21ee6fa61132c26d6b742e1ebc366bfbbe3d",
    "iso_name": "ubuntu-20.04.1-legacy-server-arm64.iso",
    "memory": "2048",
    "mirror": "http://cdimage.ubuntu.com",
    "mirror_directory": "ubuntu-legacy-server/releases/20.04/release",
    "name": "ubuntu-20.04",
    "no_proxy": "{{env `no_proxy`}}",
    "preseed_path": "preseed.cfg",
    "template": "ubuntu-20.04-arm64",
    "version": "TIMESTAMP"
  }
}

Commented out the following which failed to be installed somehow.

  • settler/scripts/provision.sh
# Install LMM for database snapshots
apt-get install -y thin-provisioning-tools bc
git clone https://github.com/Lullabot/lmm.git /opt/lmm
sed -e 's/mysql/homestead-vg/' -i /opt/lmm/config.sh
ln -s /opt/lmm/lmm /usr/local/sbin/lmm

# Create a thinly provisioned volume to move the database to. We use 64G as the
# size leaving ~5GB free for other volumes.
mkdir -p /homestead-vg/master
sudo lvs
lvcreate -L 64G -T homestead-vg/thinpool

# Create a 64GB volume for the database. If needed, it can be expanded with
# lvextend.
lvcreate -V64G -T homestead-vg/thinpool -n mysql-master
mkfs.ext4 /dev/homestead-vg/mysql-master
echo "/dev/homestead-vg/mysql-master\t/homestead-vg/master\text4\terrors=remount-ro\t0\t1" >> /etc/fstab
mount -a
chown mysql:mysql /homestead-vg/master

# Move the data directory and symlink it in.
systemctl stop mysql
mv /var/lib/mysql/* /homestead-vg/master
rm -rf /var/lib/mysql
ln -s /homestead-vg/master /var/lib/mysql

# Allow mysqld to access the new data directories.
echo '/homestead-vg/ r,' >> /etc/apparmor.d/local/usr.sbin.mysqld
echo '/homestead-vg/** rwk,' >> /etc/apparmor.d/local/usr.sbin.mysqld
# Install Heroku CLI
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh

Built the box as follows.

packer build -only=parallels-pvm ubuntu-20.04-arm64.json

About

Unofficial Laravel Homestead for Parallels Desktop on Apple Silicon

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages