Install Go via APT on Debian | Generated by AI

Home PDF

To install Go using apt on a Debian-based Linux system (e.g., Ubuntu), follow these steps. Note that apt may install an older version of Go (e.g., 1.18 on Ubuntu 22.04), so you should verify if it meets your project’s requirements (check the go.mod file in ~/Projects/clash-core for the required Go version).

Steps to Install Go Using APT

  1. Update the Package Index
    • Ensure your package lists are up to date:
      sudo apt update
      
  2. Install Go
    • Install the Go package:
      sudo apt install golang-go
      
    • This installs the Go compiler, tools, and standard library.
  3. Verify the Installation
    • Check the installed Go version:
      go version
      
    • You should see output like:
      go version go1.18.1 linux/amd64
      

      (The version depends on your distribution’s package repository.)

  4. Set Up GOPATH (Optional)
    • Modern Go versions (1.13+) use modules, so GOPATH is optional, but setting it can be useful for some projects.
    • Edit your shell profile (e.g., ~/.bashrc or ~/.zshrc):
      nano ~/.bashrc
      
    • Add the following:
      export GOPATH=$HOME/go
      export PATH=$PATH:$GOPATH/bin
      
    • Save and reload the shell configuration:
      source ~/.bashrc
      
  5. Retry the Build
    • Navigate to your project directory:
      cd ~/Projects/clash-core
      
    • Run the make command again:
      make
      

Notes

Sources

If the installed version is too old or you encounter issues, let me know your Linux distribution (e.g., Ubuntu 22.04) and the required Go version, and I’ll guide you further!


Back 2025.06.28 Donate