centos7.5安装golang

本文介绍如何在Linux环境下手动安装Go1.10.2版本。具体步骤包括:下载安装包、解压安装包到指定目录、配置环境变量等。通过这些步骤可以成功在Linux系统中设置好Go语言的开发环境。

1.下载

[root@localhost bin]#wget  https://dl.google.com/go/go1.10.2.linux-amd64.tar.gz
[root@localhost bin]# mv go1.10.2.linux-amd64.tar.gz /usr/local/src

2.解压安装

[root@localhost bin]# cd /usr/local/src
[root@localhost bin]# tar -zxvf go1.10.2.linux-amd64.tar.gz 

3.配置环境

[root@localhost bin]# vi /etc/profile

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
"/etc/profile" 76L, 1819C
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then
            . "$i"
        else
            . "$i" >/dev/null
        fi
    fi
done

unset i
unset -f pathmunge
# set path for golang
export PATH=$PATH:/usr/local/src/go/bin

[root@localhost bin]# source /etc/profile
[root@localhost bin]# go version
go version go1.10.2 linux/amd64

转载于:https://www.cnblogs.com/pu20065226/p/10622294.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值