{"id":14080,"date":"2024-06-13T13:35:11","date_gmt":"2024-06-13T10:35:11","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=14080"},"modified":"2024-06-13T15:51:48","modified_gmt":"2024-06-13T12:51:48","slug":"how-to-install-gogolang-on-rocky-linux-8-10-systems","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/how-to-install-gogolang-on-rocky-linux-8-10-systems\/","title":{"rendered":"How to Install GO(Golang) on Rocky Linux 8.10 Systems"},"content":{"rendered":"\n
Go, also known as Golang, is a statically typed, compiled programming language designed by Google. It is known for its simplicity, efficiency, and strong concurrency capabilities. This guide will walk you through the steps to install Go on your Rocky Linux 8.10 system.<\/p>\n\n\n\n
Before you begin, ensure you have:<\/p>\n\n\n\n
Start by updating your system to ensure all existing packages are up to date.<\/p>\n\n\n\n
$ sudo dnf update -y<\/code><\/pre>\n\n\n\nStep 2: Download the Go Binary<\/h4>\n\n\n\n
Visit the official Go downloads page<\/a> to find the latest version of Go. At the time of writing, the latest version is 1.18. Download the Go tarball using wget<\/code>.<\/p>\n\n\n\n$ wget https:\/\/golang.org\/dl\/go1.18.linux-amd64.tar.gz<\/code><\/pre>\n\n\n\nStep 3: Extract the Archive<\/h4>\n\n\n\n
Extract the downloaded tarball to the \/usr\/local<\/code> directory.<\/p>\n\n\n\n$ sudo tar -C \/usr\/local -xzf go1.18.linux-amd64.tar.gz<\/code><\/pre>\n\n\n\nThis command installs Go in the \/usr\/local\/go<\/code> directory.<\/p>\n\n\n\nStep 4: Set Up Go Environment<\/h4>\n\n\n\n
Next, you need to set up the Go environment variables. Add the following lines to your shell profile file (~\/.bashrc<\/code>, ~\/.zshrc<\/code>, etc.) to set up the Go environment variables.<\/p>\n\n\n\n$ echo "export PATH=$PATH:\/usr\/local\/go\/bin" >> ~\/.bashrc\n$ source ~\/.bashrc<\/code><\/pre>\n\n\n\nThis adds Go’s binary directory to your system’s PATH<\/code>, enabling you to run Go commands from any terminal session.<\/p>\n\n\n\nStep 5: Verify the Installation<\/h4>\n\n\n\n
To verify that Go is installed correctly, check its version.<\/p>\n\n\n\n
$ go version<\/code><\/pre>\n\n\n\nYou should see output similar to:<\/p>\n\n\n\n
$ go version go1.18 linux\/amd64<\/code><\/pre>\n\n\n\nStep 6: Create a Go Workspace<\/h4>\n\n\n\n
Go encourages a specific workspace structure. By default, your Go workspace should be in your home directory. Create a directory named go<\/code> and subdirectories for your Go projects.<\/p>\n\n\n\n$ mkdir -p ~\/go\/{bin,src,pkg}<\/code><\/pre>\n\n\n\n\nsrc<\/code>: contains your Go source files<\/li>\n\n\n\npkg<\/code>: contains package objects<\/li>\n\n\n\nbin<\/code>: contains executable commands<\/li>\n<\/ul>\n\n\n\nStep 7: Write a Simple Go Program<\/h4>\n\n\n\n
Create a new directory for your first Go project and write a simple Go program.<\/p>\n\n\n\n
$ mkdir -p ~\/go\/src\/hello\n$ nano ~\/go\/src\/hello\/hello.go<\/code><\/pre>\n\n\n\nAdd the following content to hello.go<\/code>:<\/p>\n\n\n\npackage main\n\nimport "fmt"\n\nfunc main() {\n fmt.Println("Hello, World!")\n}<\/code><\/pre>\n\n\n\nSave and exit the text editor.<\/p>\n\n\n\n
Step 8: Build and Run the Go Program<\/h4>\n\n\n\n
Navigate to your project directory and use the go run<\/code> command to build and run your program.<\/p>\n\n\n\n$ cd ~\/go\/src\/hello\n$ go run hello.go<\/code><\/pre>\n\n\n\nYou should see the output:<\/p>\n\n\n\n
Hello, World!<\/code><\/pre>\n\n\n\nConclusion<\/h4>\n\n\n\n
You have successfully installed Go on your Rocky Linux 8.10 system. You can now start developing your applications in Go, taking advantage of its powerful features and efficient performance. For more information on using Go, refer to the official Go documentation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"Go, also known as Golang, is a statically typed, compiled programming language designed by Google. It is known for its simplicity, efficiency, and strong concurrency capabilities. This guide will walk…<\/p>\n","protected":false},"author":1,"featured_media":14257,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,25,27,28,16,18],"tags":[193,274,354,424,433,1268,531,573,591],"yoast_head":"\n
How to Install GO(Golang) on Rocky Linux 8.10 Systems<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n\n\n\n\n\n\t\n\t\n\t\n