1. download golang
wget https://go.dev/dl/go1.25.7.linux-amd64.tar.gz
2. check after downlaod
[root@teguhth-all golang]# wget https://go.dev/dl/go1.25.7.linux-amd64.tar.gz
--2026-02-09 15:59:22-- https://go.dev/dl/go1.25.7.linux-amd64.tar.gz
Resolving go.dev (go.dev)... 216.239.34.21, 216.239.38.21, 216.239.32.21, ...
Connecting to go.dev (go.dev)|216.239.34.21|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://dl.google.com/go/go1.25.7.linux-amd64.tar.gz [following]
--2026-02-09 15:59:22-- https://dl.google.com/go/go1.25.7.linux-amd64.tar.gz
Resolving dl.google.com (dl.google.com)... 74.125.24.136, 74.125.24.91, 74.125.24.190, ...
Connecting to dl.google.com (dl.google.com)|74.125.24.136|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 59768749 (57M) [application/x-gzip]
Saving to: ‘go1.25.7.linux-amd64.tar.gz’
go1.25.7.linux-amd64.tar.gz 100%[================================================================================>] 57.00M 24.2MB/s in 2.4s
2026-02-09 15:59:25 (24.2 MB/s) - ‘go1.25.7.linux-amd64.tar.gz’ saved [59768749/59768749]
[root@teguhth-all golang]#
[root@teguhth-all golang]# pwd
/data/golang
[root@teguhth-all golang]# ls -lh
total 115M
-rw-r--r-- 1 root root 57M Feb 4 22:48 go1.25.7.linux-amd64.tar.gz
[root@teguhth-all golang]#
3. create golang directory & extract
mkdir -p /usr/local/go
tar -C /usr/local -xzf go1.25.7.linux-amd64.tar.gz
[root@teguhth-all golang]# tar -C /usr/local -xzf go1.25.7.linux-amd64.tar.gz
[root@teguhth-all golang]#
4. check after
[root@teguhth-all go]# pwd
/usr/local/go
[root@teguhth-all go]# ls
api bin codereview.cfg CONTRIBUTING.md doc go.env lib LICENSE misc PATENTS pkg README.md SECURITY.md src test VERSION
[root@teguhth-all go]#
5. add bash profile
[root@teguhth-all golang]# cat ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export PATH="$PATH:/opt/mssql-tools18/bin"
export ORACLE_HOME=/opt/oracle/client_19c
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
export PATH=$PATH:/usr/local/go/bin
[root@teguhth-all golang]#
6. reload bash profile
source ~/.bash_profile
7. check version
go version
file /usr/local/go/bin/go
[root@teguhth-all golang]# go version
go version go1.25.7 linux/amd64
[root@teguhth-all golang]#
8. file executable Go
file /usr/local/go/bin/go
[root@teguhth-all golang]# file /usr/local/go/bin/go
/usr/local/go/bin/go: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=c3c588911b99ce6ed284e7faca817eb2a41a6bcc, not stripped
[root@teguhth-all golang]#
10. test
mkdir -p /opt/golang
[root@teguhth-all golang]# cat hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello Golang!")
}
11. run golang go
[root@teguhth-all testgo]# go run /opt/golang/hello.go
Hello Golang!
[root@teguhth-all testgo]#
[root@teguhth-all golang]# go run hello.go
Hello Golang!
[root@teguhth-all golang]#

.jpeg)

No comments:
Post a Comment