Skip to content

Commit 279e052

Browse files
authored
Merge pull request #105299 from mitchcr/patch-1
Update create-upload-ubuntu.md
2 parents 95d5096 + 6df3fee commit 279e052

File tree

1 file changed

+33
-33
lines changed

1 file changed

+33
-33
lines changed

articles/virtual-machines/linux/create-upload-ubuntu.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,27 @@ This article assumes that you've already installed an Ubuntu Linux operating sys
4545
Before editing `/etc/apt/sources.list`, it's recommended to make a backup:
4646

4747
```console
48-
# sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
48+
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
4949
```
5050

5151
Ubuntu 18.04 and Ubuntu 20.04:
5252

5353
```console
54-
# sudo sed -i 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//http:\/\/azure\.archive\.ubuntu\.com\/ubuntu\//g' /etc/apt/sources.list
55-
# sudo sed -i 's/http:\/\/[a-z][a-z]\.archive\.ubuntu\.com\/ubuntu\//http:\/\/azure\.archive\.ubuntu\.com\/ubuntu\//g' /etc/apt/sources.list
56-
# sudo apt-get update
54+
sudo sed -i 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//http:\/\/azure\.archive\.ubuntu\.com\/ubuntu\//g' /etc/apt/sources.list
55+
sudo sed -i 's/http:\/\/[a-z][a-z]\.archive\.ubuntu\.com\/ubuntu\//http:\/\/azure\.archive\.ubuntu\.com\/ubuntu\//g' /etc/apt/sources.list
56+
sudo apt-get update
5757
```
5858

5959
4. The Ubuntu Azure images are now using the [Azure-tailored kernel](https://ubuntu.com/blog/microsoft-and-canonical-increase-velocity-with-azure-tailored-kernel). Update the operating system to the latest Azure-tailored kernel and install Azure Linux tools (including Hyper-V dependencies) by running the following commands:
6060

6161
Ubuntu 18.04 and Ubuntu 20.04:
6262

6363
```console
64-
# sudo apt update
65-
# sudo apt install linux-azure linux-image-azure linux-headers-azure linux-tools-common linux-cloud-tools-common linux-tools-azure linux-cloud-tools-azure
64+
sudo apt update
65+
sudo apt install linux-azure linux-image-azure linux-headers-azure linux-tools-common linux-cloud-tools-common linux-tools-azure linux-cloud-tools-azure
6666
(recommended) # sudo apt full-upgrade
6767

68-
# sudo reboot
68+
sudo reboot
6969
```
7070

7171
5. Modify the kernel boot line for Grub to include additional kernel parameters for Azure. To do this open `/etc/default/grub` in a text editor, find the variable called `GRUB_CMDLINE_LINUX_DEFAULT` (or add it if needed) and edit it to include the following parameters:
@@ -81,8 +81,8 @@ This article assumes that you've already installed an Ubuntu Linux operating sys
8181
7. Install cloud-init (the provisioning agent) and the Azure Linux Agent (the guest extensions handler). Cloud-init uses `netplan` to configure the system network configuration (during provisioning and each subsequent boot) and `gdisk` to partition resource disks.
8282

8383
```console
84-
# sudo apt update
85-
# sudo apt install cloud-init gdisk netplan.io walinuxagent && systemctl stop walinuxagent
84+
sudo apt update
85+
sudo apt install cloud-init gdisk netplan.io walinuxagent && systemctl stop walinuxagent
8686
```
8787

8888
> [!Note]
@@ -91,19 +91,19 @@ This article assumes that you've already installed an Ubuntu Linux operating sys
9191
8. Remove cloud-init default configs and leftover `netplan` artifacts that may conflict with cloud-init provisioning on Azure:
9292

9393
```console
94-
# rm -f /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg /etc/cloud/cloud.cfg.d/curtin-preserve-sources.cfg /etc/cloud/cloud.cfg.d/99-installer.cfg /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg
95-
# rm -f /etc/cloud/ds-identify.cfg
96-
# rm -f /etc/netplan/*.yaml
94+
rm -f /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg /etc/cloud/cloud.cfg.d/curtin-preserve-sources.cfg /etc/cloud/cloud.cfg.d/99-installer.cfg /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg
95+
rm -f /etc/cloud/ds-identify.cfg
96+
rm -f /etc/netplan/*.yaml
9797
```
9898

9999
9. Configure cloud-init to provision the system using the Azure datasource:
100100

101101
```bash
102-
# cat > /etc/cloud/cloud.cfg.d/90_dpkg.cfg << EOF
102+
cat > /etc/cloud/cloud.cfg.d/90_dpkg.cfg << EOF
103103
datasource_list: [ Azure ]
104104
EOF
105105

106-
# cat > /etc/cloud/cloud.cfg.d/90-azure.cfg << EOF
106+
cat > /etc/cloud/cloud.cfg.d/90-azure.cfg << EOF
107107
system_info:
108108
package_mirrors:
109109
- arches: [i386, amd64]
@@ -120,7 +120,7 @@ This article assumes that you've already installed an Ubuntu Linux operating sys
120120
security: http://ports.ubuntu.com/ubuntu-ports
121121
EOF
122122

123-
# cat > /etc/cloud/cloud.cfg.d/10-azure-kvp.cfg << EOF
123+
cat > /etc/cloud/cloud.cfg.d/10-azure-kvp.cfg << EOF
124124
reporting:
125125
logging:
126126
type: log
@@ -150,11 +150,11 @@ This article assumes that you've already installed an Ubuntu Linux operating sys
150150
11. Clean cloud-init and Azure Linux agent runtime artifacts and logs:
151151

152152
```console
153-
# sudo cloud-init clean --logs --seed
154-
# sudo rm -rf /var/lib/cloud/
155-
# sudo systemctl stop walinuxagent.service
156-
# sudo rm -rf /var/lib/waagent/
157-
# sudo rm -f /var/log/waagent.log
153+
sudo cloud-init clean --logs --seed
154+
sudo rm -rf /var/lib/cloud/
155+
sudo systemctl stop walinuxagent.service
156+
sudo rm -rf /var/lib/waagent/
157+
sudo rm -f /var/log/waagent.log
158158
```
159159

160160
12. Run the following commands to deprovision the virtual machine and prepare it for provisioning on Azure:
@@ -166,10 +166,10 @@ This article assumes that you've already installed an Ubuntu Linux operating sys
166166
> Deprovisioning using the command above does not guarantee that the image is cleared of all sensitive information and is suitable for redistribution.
167167

168168
```console
169-
# sudo waagent -force -deprovision+user
170-
# rm -f ~/.bash_history
171-
# export HISTSIZE=0
172-
# logout
169+
sudo waagent -force -deprovision+user
170+
rm -f ~/.bash_history
171+
export HISTSIZE=0
172+
logout
173173
```
174174

175175
13. Click **Action -> Shut Down** in Hyper-V Manager.
@@ -182,31 +182,31 @@ This article assumes that you've already installed an Ubuntu Linux operating sys
182182
1. Change directory to the boot EFI directory:
183183
184184
```console
185-
# cd /boot/efi/EFI
185+
cd /boot/efi/EFI
186186
```
187187

188-
1. Copy the ubuntu directory to a new directory named boot:
188+
2. Copy the ubuntu directory to a new directory named boot:
189189
190190
```console
191-
# sudo cp -r ubuntu/ boot
191+
sudo cp -r ubuntu/ boot
192192
```
193193

194-
1. Change directory to the newly created boot directory:
194+
3. Change directory to the newly created boot directory:
195195

196196
```console
197-
# cd boot
197+
cd boot
198198
```
199199
200-
1. Rename the shimx64.efi file:
200+
4. Rename the shimx64.efi file:
201201

202202
```console
203-
# sudo mv shimx64.efi bootx64.efi
203+
sudo mv shimx64.efi bootx64.efi
204204
```
205205

206-
1. Rename the grub.cfg file to bootx64.cfg:
206+
5. Rename the grub.cfg file to bootx64.cfg:
207207

208208
```console
209-
# sudo mv grub.cfg bootx64.cfg
209+
sudo mv grub.cfg bootx64.cfg
210210
```
211211

212212
## Next steps

0 commit comments

Comments
 (0)