|
1 | | -# Installation and Usage on macOS |
| 1 | +# Installing on macOS |
2 | 2 |
|
3 | | -This guide provides the complete instructions for setting up and using the **pi-server-vm** project on a macOS system. |
| 3 | +This guide will walk you through the installation and setup of the Pi-Server-VM tools on a macOS system. |
4 | 4 |
|
5 | | ---- |
| 5 | +## Prerequisites |
6 | 6 |
|
7 | | -## Phase 1: Host System Preparation |
| 7 | +Before you begin, please ensure you have the latest version of Oracle VirtualBox installed on your Mac. The Pi-Server-VM tools are designed to manage VirtualBox, so it must be present on your machine. |
8 | 8 |
|
9 | | -### 1. Install VirtualBox |
| 9 | +## Step 1: Download the Latest Release |
10 | 10 |
|
11 | | -The project requires the **Oracle VM VirtualBox** application and its command-line tools. |
| 11 | +Navigate to the project official releases page to find the latest version. |
12 | 12 |
|
13 | | -- **[Download VirtualBox](https://www.virtualbox.org/wiki/Downloads)** |
| 13 | +➡️ **[Download the latest release](https://github.com/HenkVanHoek/pi-server-vm/releases/latest)** |
14 | 14 |
|
15 | | -Download and run the installer for macOS. During installation, you may be prompted to allow kernel extensions in your **System Settings -> Privacy & Security**. Please approve this for VirtualBox to function correctly. |
| 15 | +On the release page, find the "Assets" section and download the file named executables-macOS.tar.gz. |
16 | 16 |
|
17 | | ---- |
| 17 | +## Step 2: Extract the Archive |
18 | 18 |
|
19 | | -## Phase 2: Project Setup |
| 19 | +1. Open the Terminal application. |
| 20 | +2. Navigate to the directory where you saved the downloaded file. For most users, this will be the Downloads directory. |
20 | 21 |
|
21 | | -### 1. Download the Release Files |
| 22 | + cd ~/Downloads |
22 | 23 |
|
23 | | -Go to the [GitHub Releases page](https://github.com/HenkVanHoek/pi-server-vm/releases/latest) for this project. |
| 24 | +3. Use the tar command to extract the contents of the archive. |
24 | 25 |
|
25 | | -You will need to download **two** types of files for the latest release: |
26 | | -- The virtual machine template, which is a file ending in **.ova**. |
27 | | -- The command-line tools for macOS, which is a file ending in **.tar.gz**. |
| 26 | + tar -xzvf executables-macOS.tar.gz |
28 | 27 |
|
29 | | -### 2. Extract the Executables |
| 28 | +This will create a new directory named dist. Inside the dist directory, you will find a separate folder for each of the tools, for example, clone-vm and create-master-vm. |
30 | 29 |
|
31 | | -1. Open the **Terminal** app. |
32 | | -2. Navigate to your **Downloads** folder. |
33 | | -3. Run the **tar** command to extract the archive. The files will already be executable. |
| 30 | +## Step 3: Authorize the Applications |
34 | 31 |
|
35 | | - tar -xvzf executables-macOS.tar.gz |
| 32 | +Because this software is not downloaded from the Mac App Store, a macOS security feature called Gatekeeper will prevent it from running at first. You must perform a one-time action to tell macOS that you trust these tools. |
36 | 33 |
|
37 | | - This will create a new folder containing the **create-master-vm** and **clone-vm** tools. |
| 34 | +1. Make sure you are still in the same directory in your terminal (for example, the Downloads folder). |
| 35 | +2. Run the following commands for each of the tool folders you extracted. This command removes the quarantine attribute that macOS adds to downloaded files. |
38 | 36 |
|
39 | | -### 3. Import the Master Template Appliance |
| 37 | + For the clone-vm tool: |
40 | 38 |
|
41 | | -You must first import the pre-built **.ova** file into VirtualBox. |
| 39 | + xattr -cr dist/clone-vm |
42 | 40 |
|
43 | | -1. Open the **VirtualBox** application from your **/Applications** folder. |
44 | | -2. Go to the menu **File -> Import Appliance...** |
45 | | -3. Select the **.ova** file you downloaded. |
46 | | -4. On the settings review screen, you can leave all settings as they are and click **Import**. The network adapter will be automatically configured for bridged networking. |
| 41 | + For the create-master-vm tool: |
47 | 42 |
|
48 | | ---- |
| 43 | + xattr -cr dist/create-master-vm |
49 | 44 |
|
50 | | -## Phase 3: Creating Your First Virtual Pi |
| 45 | + For the web-app tool: |
51 | 46 |
|
52 | | -You are now ready to create your first clone. |
| 47 | + xattr -cr dist/pi-selfhosting-web |
53 | 48 |
|
54 | | -1. In your Terminal, navigate into the folder where you extracted the executables. |
55 | | -2. Run the **clone-vm** tool, providing a name for your new VM and any optional parameters. |
| 49 | +After running these commands, you will be able to run the executables from inside each folder without any security warnings. |
56 | 50 |
|
57 | | - # Example: Create a new VM named 'pi-test-macos' |
58 | | - ./clone-vm pi-test-macos |
| 51 | +## Step 4: Add Tools to Your System PATH (Recommended) |
59 | 52 |
|
60 | | - # Example: Create a more powerful VM and start it immediately |
61 | | - ./clone-vm my-powerful-pi --ram 4096 --cpus 4 --start |
| 53 | +For convenience, it is highly recommended to add the tool directories to your system PATH. This allows you to run commands like clone-vm from any location in your terminal without having to type the full path. |
62 | 54 |
|
63 | | -Your new virtual Pi will be created and will appear in the VirtualBox Manager. After it starts, it will be visible on your local network, ready for use. |
| 55 | +1. Move the extracted dist folder to a more permanent location. A common choice is to place it in your home directory. |
| 56 | + |
| 57 | + mv dist ~/pi-server-vm-tools |
| 58 | + |
| 59 | +2. Open the configuration file for your shell in a text editor. On modern macOS versions, the default shell is Zsh, and the file is .zshrc. |
| 60 | + |
| 61 | + nano ~/.zshrc |
| 62 | + |
| 63 | +3. Add the following lines to the very end of the file. This tells your terminal where to find the new executables. Make sure to replace /Users/your-username with the actual path to your home directory. |
| 64 | + |
| 65 | + # Add Pi-Server-VM tools to the system PATH |
| 66 | + export PATH="$PATH:/Users/your-username/pi-server-vm-tools/clone-vm" |
| 67 | + export PATH="$PATH:/Users/your-username/pi-server-vm-tools/create-master-vm" |
| 68 | + export PATH="$PATH:/Users/your-username/pi-server-vm-tools/pi-selfhosting-web" |
| 69 | + |
| 70 | +4. Save the file and close the editor. For the changes to take effect, you can either close and reopen your terminal, or run the following command: |
| 71 | + |
| 72 | + source ~/.zshrc |
| 73 | + |
| 74 | +You can now run the commands clone-vm, create-master-vm, and pi-selfhosting-web directly from your terminal. |
0 commit comments