{"id":14015,"date":"2023-04-19T17:26:54","date_gmt":"2023-04-19T17:26:54","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=14015"},"modified":"2023-04-28T09:46:25","modified_gmt":"2023-04-28T09:46:25","slug":"how-to-install-golang-on-centos","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-golang-on-centos\/","title":{"rendered":"How to Install Golang on CentOS"},"content":{"rendered":"<p>Go or Golang is an open-source programming language that is widely used for building high-performance and scalable applications. It was developed by Google and is known for its simplicity, efficiency, and concurrency features. In this guide, we will show you how to install Golang on CentOS.<\/p>\n<h2>Step 1: Update the System:<\/h2>\n<p>The first step is to update the system to ensure that all packages are up to date. Run the following command:<\/p>\n<pre>sudo yum update -y<\/pre>\n<p>This will update all the installed packages on your CentOS system.<\/p>\n<h2>Step 2: Download Golang:<\/h2>\n<p>Next, download the Golang package from the official website. You can use the wget command to download the package:<\/p>\n<pre>sudo wget https:\/\/golang.org\/dl\/go1.16.3.linux-amd64.tar.gz<\/pre>\n<p>This command will download the Golang package to the current working directory.<\/p>\n<h2>Step 3: Extract Golang:<\/h2>\n<p>After downloading the package, extract it using the following command:<\/p>\n<pre>sudo tar -xvf go1.16.3.linux-amd64.tar.gz<\/pre>\n<p>This will extract the Golang package to the \/usr\/local directory.<\/p>\n<h2>Step 4: Set Environment Variables:<\/h2>\n<p>To use Golang, you need to set some environment variables. Open the \/etc\/profile file using any text editor and add the following lines at the end of the file:<\/p>\n<pre>export PATH=$PATH:\/usr\/local\/go\/bin\r\nexport GOPATH=$HOME\/go\r\nexport PATH=$PATH:$GOPATH\/bin<\/pre>\n<p>Save and close the file. Then, load the profile file to apply the changes:<\/p>\n<pre>source \/etc\/profile<\/pre>\n<h2>Step 5: Verify Installation:<\/h2>\n<p>Finally, verify the Golang installation by running the following command:<\/p>\n<pre>go version<\/pre>\n<p>If Golang is installed properly, it will show the version number.<\/p>\n<h2>Commands Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">sudo yum update -y<\/span> &#8211; Updates all the installed packages on CentOS.<\/li>\n<li><span class=\"fw-bold\">sudo wget https:\/\/golang.org\/dl\/go1.16.3.linux-amd64.tar.gz<\/span> &#8211; Downloads the Golang package from the official website.<\/li>\n<li><span class=\"fw-bold\">sudo tar -xvf go1.16.3.linux-amd64.tar.gz<\/span> &#8211; Extracts the Golang package to the \/usr\/local directory.<\/li>\n<li><span class=\"fw-bold\">export PATH=$PATH:\/usr\/local\/go\/bin<\/span> &#8211; Sets the Golang binary path.<\/li>\n<li><span class=\"fw-bold\">export GOPATH=$HOME\/go<\/span> &#8211; Sets the location of the Go workspace.<\/li>\n<li><span class=\"fw-bold\">export PATH=$PATH:$GOPATH\/bin<\/span> &#8211; Adds the GOPATH\/bin directory to the PATH.<\/li>\n<li><span class=\"fw-bold\">source \/etc\/profile<\/span> &#8211; Loads the profile file to apply the changes.<\/li>\n<li><span class=\"fw-bold\">go version<\/span> &#8211; Verifies the Golang installation.<\/li>\n<\/ul>\n<h2>Conclusion:<\/h2>\n<p>In this guide, we have shown you how to install Golang on CentOS. We started by updating the system, downloading the Golang package, and extracting it to the \/usr\/local directory. Then, we set the environment variables to use Golang and verified the installation. By following these steps, you should now have Golang installed and ready to use for building high-performance and scalable applications. Golang is a popular programming language for developers because of its simple syntax, powerful tools, and community-driven development.<\/p>\n<p>Installing Golang on CentOS is a straightforward process that involves downloading the package from the official website, extracting it to the system, setting environment variables, and verifying the installation. By following the steps outlined in this guide, you should now have Golang installed on your CentOS system.<\/p>\n<p>In conclusion, Golang is an excellent programming language for building high-performance and scalable applications. By installing Golang on CentOS, you can take advantage of its powerful features and tools. If you encounter any issues during the installation process, feel free to leave a comment or suggest improvements to this guide.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Go or Golang is an open-source programming language that is widely used for building high-performance and scalable applications. It was developed by Google and is known for its simplicity, efficiency,&#8230;<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055,996],"tags":[1244,2007,2006,1975],"class_list":["post-14015","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","tag-centos","tag-go","tag-golang","tag-install"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/14015","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=14015"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/14015\/revisions"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=14015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=14015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=14015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}