How to Install Latest Go and Garble on Linux Web Server

This guide explains how to:

  • Check whether your current repository version of Go meets the required version

  • Remove older Go installations

  • Install the latest Go manually

  • Install Garble GitHub Repository


Check Available Go Version from Repository

Before installing manually, check whether your system repositories already provide a compatible Go version.

RHEL / AlmaLinux / RockyLinux / CentOS

dnf info golang

or on older systems:

yum info golang

Install from repository:

dnf install -y golang

Debian / Ubuntu

Update repositories:

apt update

Check available version:

apt policy golang-go

Install:

apt install -y golang-go

Verify Installed Go Version

go version

Example:

go version go1.25.9 linux/amd64

If the version is lower than the required version for Garble, proceed with the manual installation below.


Remove Older Go Installation

Remove existing Go binaries:

rm -rf /usr/local/go

Remove old PATH entries if necessary:

sed -i '/\/usr\/local\/go\/bin/d' ~/.bashrc

Install Latest Go Manually

Visit the official Go downloads page:

Go Official Downloads

Example installation for Go 1.26.2:

cd /usr/local/src
wget https://go.dev/dl/go1.26.2.linux-amd64.tar.gz

Extract and remove the tar.gz file:

tar -C /usr/local -xzf go1.26.2.linux-amd64.tar.gz
rm -rf /usr/local/src/go*.linux-amd64.tar.gz

Configure PATH

System-wide configuration:

cat > /etc/profile.d/golang.sh << 'EOF'
export PATH=/usr/local/go/bin:$PATH
EOF

Set permissions:

chmod +x /etc/profile.d/golang.sh

Load environment:

source /etc/profile.d/golang.sh

Verify Go Installation

go version

Expected output:

go version go1.26.2 linux/amd64

Install Garble

Install latest Garble:

go install mvdan.cc/garble@latest

Add Go User Binary Path

Temporary:

export PATH=$PATH:$(go env GOPATH)/bin

Permanent:

echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc
source ~/.bashrc

Verify Garble Installation

garble -h

Build Obfuscated Go Binary

Basic stripped build:

garble build -ldflags="-s -w"

Recommended hardened build:

garble build -tiny -seed=random -ldflags="-s -w"

Options:

  • -tiny → reduces runtime metadata

  • -seed=random → randomizes obfuscation every build

  • -s -w → strips symbols and debug information


Notes

Garble compatibility depends on the installed Go version.
Always verify the required Go version from:

go install mvdan.cc/garble@latest

If the installed version is unsupported, Go will display the minimum required version automatically.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to restrict direct root access in Linux

We can do it just in two steps. Step One: At first we will create new root user as follows (for...

How to extract .tar.gz files in Linux/UNIX OS

A tarball is a group of files that are bundled together using the tar command. Use the...

How to add welcome message when SSH start?

You need to change the contents of /etc/motd. Unfortunately, by default, /etc/motd is a link to...

How to change root password when SSH logged in

Run the following command: passwd Now type your new passwordOnce done, retype new passwordDone!...

How to install Pinguzo on any Linux/UNIX OS

Login to Pinguzo panel using Softaculous account or create an account of Pinguzo To add new...