Azure VPS setup notes » History » Version 12
Jon Goldberg, 11/09/2020 07:35 PM
1 | 12 | Jon Goldberg | {{last_updated_at}} by {{last_updated_by}} |
---|---|---|---|
2 | |||
3 | 1 | Jon Goldberg | # Azure VPS setup notes |
4 | |||
5 | 6 | Jon Goldberg | Azure is more complex than, say, Linode. To set up a free account, you must: |
6 | * Get a Sponsorship. |
||
7 | * Create a Subscription linked to the Sponsorship. |
||
8 | * Create a Resource Group linked to the Subscription. |
||
9 | * Create a Virtual Machine (and associated resources) linked to the Resource Group. |
||
10 | 1 | Jon Goldberg | |
11 | 6 | Jon Goldberg | [**NOTE**: Most of Microsoft's pages break with an ad blocker enabled.] |
12 | |||
13 | ### Get a Sponsorship |
||
14 | * [Go to the Nonprofit Microsoft Getting Started page](https://nonprofit.microsoft.com/en-us/getting-started). Fill out the paperwork to be approved as a 501c3. Approval can take 1 day or 3-4 weeks - I've seen both multiple times. |
||
15 | 7 | Jon Goldberg | * Once approved, go to https://www.microsoft.com/en-us/nonprofits/azure to claim credits. |
16 | 6 | Jon Goldberg | |
17 | ### Create a Subscription |
||
18 | |||
19 | 1 | Jon Goldberg | * Check that you have credits in your sponsored account: https://www.microsoftazuresponsorships.com/Balance |
20 | 6 | Jon Goldberg | * Visit the [Azure Portal](https://portal.azure.com). |
21 | * Click the **Subscriptions** icon. |
||
22 | * Click the **Add** button. |
||
23 | * Add a subscription of type "Microsoft Azure Sponsorship" from the Azure portal. You will likely need to select **Show other subscription types** to see it. |
||
24 | 1 | Jon Goldberg | * **Note**: Even sponsored subscriptions require a credit card, make sure you have one available. |
25 | |||
26 | 6 | Jon Goldberg | #### Create a resource group |
27 | * Select "Resource Group" from the main Azure portal. |
||
28 | * Select **Add** and give it a name. |
||
29 | * Your subscription should be pre-selected since you only have the one. |
||
30 | * Click **Review and Create**. |
||
31 | 1 | Jon Goldberg | |
32 | 6 | Jon Goldberg | #### Create a virtual machine |
33 | * Click on your new resource group in the Azure Portal. |
||
34 | * Click **Add**. |
||
35 | * Search for the name of the image you want (e.g. Debian). |
||
36 | * See the screenshots below for configuration of the "Basics" and "Disk" tabs. The other tabs I keep with the defaults. |
||
37 | * I've attached a downloaded template for this VM, which as of now I haven't used yet, not sure how it works. |
||
38 | 1 | Jon Goldberg | |
39 | 9 | Jon Goldberg | ![Create a VM - Basics Tab](https://hq.megaphonetech.com/attachments/download/1771/Selection_999(010).png) |
40 | |||
41 | ![Create a VM - Disks Tab](https://hq.megaphonetech.com/attachments/download/1770/Selection_999(011).png) |
||
42 | |||
43 | 6 | Jon Goldberg | #### Post-provisioning configuration |
44 | 5 | Jon Goldberg | |
45 | 10 | Jon Goldberg | ##### Partition and format the attached disk |
46 | Your VM (if it's D2s v3) will have an "OS disk" of 30GB it ships with. Your attached disk is unformatted. Partition and format the new disk with: |
||
47 | |||
48 | ```shell |
||
49 | sudo parted --script -a optimal /dev/sdb mklabel gpt -- mkpart primary ext4 '0%' '100%' |
||
50 | sudo mkfs -t ext4 /dev/sdb1 |
||
51 | ``` |
||
52 | 11 | Jon Goldberg | ##### Mount the attached disk |
53 | Using the Microsoft Azure serial console, [follow these directions](https://unix.stackexchange.com/questions/131311/moving-var-home-to-separate-partition) for moving the contents of the `/var` directory to the attached disk and mount it. |
||
54 | 10 | Jon Goldberg | |
55 | 6 | Jon Goldberg | ##### Modify Firewall Rules |
56 | * Click on your new virtual machine in the Azure portal. |
||
57 | * Click **Networking** in the side navigation. |
||
58 | * You should see your firewall settings. They should look like the screenshot below, except they'll be missing the two items circled. |
||
59 | * Add the "allow_ping" and "Port_5665" rules to the *Inbound Port Rules* as shown in the screenshot. |
||
60 | |||
61 | 8 | Jon Goldberg | ![Firewall Rules](https://hq.megaphonetech.com/attachments/download/1772/Selection_999(012).png) |
62 | |||
63 | 6 | Jon Goldberg | ##### Add a swapfile |
64 | [Complete instructions are here](https://support.microsoft.com/en-us/help/4010058/how-to-add-a-swap-file-in-linux-azure-virtual-machines) but in short, add this to `/etc/waagent.conf` for an 8GB swapfile: |
||
65 | |||
66 | ``` |
||
67 | ResourceDisk.Format=y |
||
68 | ResourceDisk.EnableSwap=y |
||
69 | ResourceDisk.SwapSizeMB=8192 |
||
70 | ``` |
||
71 | |||
72 | Then run `service walinuxagent restart`. |