You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/golang-on-azure/baseline-testing.md
+23-22Lines changed: 23 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,22 +6,20 @@ weight: 5
6
6
layout: learningpathall
7
7
---
8
8
9
+
## Baseline testing: run a Go web server on Azure Arm64
9
10
10
-
### Baseline Testing: Running a Go Web Server on Azure Arm64
11
-
To validate your Go toolchain and runtime environment, you can build and run a lightweight web server. This ensures that compilation, networking, and runtime execution are working correctly on your Ubuntu Pro 24.04 LTS Arm64 virtual machine running on Azure Cobalt 100.
11
+
To validate your Go toolchain and runtime environment, build and run a lightweight web server. This confirms that compilation, networking, and runtime execution work correctly on your Ubuntu Pro 24.04 LTS Arm64 virtual machine on Azure Cobalt 100.
12
12
13
-
1. Create the project directory
14
-
15
-
Start by creating a new folder to hold your Go web project and navigate to it:
13
+
## Create the project directory
16
14
15
+
Create a folder for your Go web project and navigate to it:
17
16
```console
18
17
mkdir goweb && cd goweb
19
18
```
20
19
21
-
2. Create an HTML Page with Bootstrap Styling
22
-
23
-
Next, create a simple web page that your Go server will serve. Using the nano editor (or any editor of your choice), create a file named `index.html`:
20
+
## Create an HTML page with Bootstrap styling
24
21
22
+
Next, create a simple web page that your Go server will serve. Open an editor and create `index.html`:
25
23
```console
26
24
nano index.html
27
25
```
@@ -65,15 +63,16 @@ Paste the following HTML code into the `index.html` file. This page uses Bootstr
65
63
</body>
66
64
</html>
67
65
```
68
-
3. Create Golang Web Server
69
66
70
67
Now, let’s create the Go program that will serve your static HTML page and expose a simple API endpoint.
71
68
69
+
Open an editor and create `main.go`:
72
70
```console
73
71
nano main.go
74
72
```
75
-
Paste the following code into the `main.go` file. This sets up a very basic web server that serves files from the current folder, including the `index.html` you just created. When it runs, it will print a message showing the server address.
73
+
Paste the following code into the `main.go` file. This sets up a basic web server that serves files from the current folder, including the `index.html` you just created. When it runs, it will print a message showing the server address.
76
74
75
+
Paste the following code into `main.go`:
77
76
```go
78
77
package main
79
78
import (
@@ -105,24 +104,21 @@ func main() {
105
104
```
106
105
{{% notice Note %}}Running on port 80 requires root privileges. Use sudo with the full Go path if needed.{{% /notice %}}
107
106
108
-
4. Run the Web Server
109
-
110
-
Compile and start your Go program with:
107
+
## Run the web server
111
108
109
+
Compile and start the server:
112
110
```console
113
111
sudo /usr/local/go/bin/go run main.go
114
112
```
115
113
116
-
This command compiles the Go source code into a binary and immediately starts the server on port 80. If the server starts successfully, you will see the following message in your terminal:
117
-
114
+
Expected output:
118
115
```output
119
116
2025/08/19 04:35:06 Server running on http://0.0.0.0:80
120
117
```
121
-
5. Allow HTTP Traffic in Firewall
122
118
123
119
On Ubuntu Pro 24.04 LTS virtual machines, UFW (Uncomplicated Firewall) is used to manage firewall rules. By default, it allows only SSH (port 22), while other inbound connections are blocked.
124
120
125
-
Even if you have already configured Azure Network Security Group (NSG) rules to allow inbound traffic on port 80, the VM level firewall may still block HTTP requests until explicitly opened.
121
+
Even if you have already configured Azure Network Security Group (NSG) rules to allow inbound traffic on port 80, the VM level firewall might still block HTTP requests until explicitly opened.
126
122
127
123
Run the following commands to allow HTTP traffic on port 80:
128
124
@@ -145,14 +141,19 @@ To Action From
145
141
80/tcp (v6) ALLOW Anywhere (v6)
146
142
```
147
143
148
-
6. Open in a Browser
149
-
To quickly get your VM’s public IP address and form the URL, run:
144
+
{{% notice Note %}}
145
+
If UFW is already active, `sudo ufw enable` might warn you about disrupting SSH. Proceed only if you understand the impact, or use an Azure VM serial console as a recovery option.
146
+
{{% /notice %}}
150
147
148
+
## Open the site in a browser
149
+
150
+
Print your VM’s public URL:
151
151
```console
152
152
echo "http://$(curl -s ifconfig.me)/"
153
153
```
154
-
Open this URL in your browser, and you should see the styled HTML landing page being served directly by your Go application.
155
154
156
-

155
+
Open this URL in your browser. You should see the styled HTML landing page served by your Go application.
156
+
157
+

157
158
158
-
Reaching this page in your browser confirms that Go is installed correctly, your environment is configured, and your Go web server is working end-to-end on Azure Cobalt 100 (Arm64). You can now proceed to perform further benchmarking tests.
159
+
Reaching this page confirms that Go is installed, the environment is configured, and your Go web server works end-to-end on Azure Cobalt 100 (Arm64). You can now proceed to benchmarking tests.
Copy file name to clipboardExpand all lines: content/learning-paths/servers-and-cloud-computing/golang-on-azure/deploy.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,23 +23,23 @@ There are many enhancements added to Golang version 1.18, that have resulted in
23
23
The [Arm Ecosystem Dashboard](https://developer.arm.com/ecosystem-dashboard/) also recommends Golang version 1.18 as the minimum recommended on the Arm platforms.
24
24
{{% /notice %}}
25
25
26
-
## Extract the archive to `/usr/local`
26
+
## Extract the archive
27
27
28
28
Unpack the downloaded archive into `/usr/local`, which is the conventional directory for installing system-wide software on Linux. This ensures the Go toolchain is available for all users and integrates cleanly with the system’s environment.
29
29
30
30
```console
31
31
sudo tar -C /usr/local -xzf ./go1.25.0.linux-arm64.tar.gz
32
32
```
33
33
34
-
## Add Go to your shell `PATH`
34
+
## Add Go to your shell PATH
35
35
36
36
To make the Go toolchain accessible from any directory, add its binary location to your shell’s `PATH` environment variable. Updating your `.bashrc` file ensures this change persists across sessions:
0 commit comments