0

I want to install the go lang package on a separate folder, instead of using apt-get install to install it. I'm not keen to use apt-get for many reasons that would be too long to explain here.

I did the following

apt-get download golang-go

Then I unpacked it like that

dpkg -x golang-go_2%3a1.6-1ubuntu4_amd64.deb .

I have the folder usr and within 3 folders,bin,lib and share and within it, logical links.

What should be my next steps?

0
1

Bad method

It is bad idea. I did extraction as you wrote and I have broken links and can't launch go:

$ cd /tmp/
$ apt-get download golang-go
$ dpkg -x golang-go_2%3a1.6-1ubuntu4_amd64.deb go
$ tree go -f | grep bin
    ├── go/usr/bin
    │   ├── go/usr/bin/go -> ../lib/go-1.6/bin/go
    │   └── go/usr/bin/gofmt -> ../lib/go-1.6/bin/gofmt
$ ./go/usr/bin/go
bash: ./go/usr/bin/go: No such file or directory

You can try other bigger package -

$ apt-get download golang-1.6-go
$ dpkg -x golang-1.6-go_1.6.2-0ubuntu5~16.04.4_amd64.deb go
$ tree go -f | grep bin    ├── go/usr/bin
    │   ├── go/usr/bin/go -> ../lib/go-1.6/bin/go
    │   └── go/usr/bin/gofmt -> ../lib/go-1.6/bin/gofmt
    │       ├── go/usr/lib/go-1.6/bin
    │       │   ├── go/usr/lib/go-1.6/bin/go
    │       │   └── go/usr/lib/go-1.6/bin/gofmt
    │       │   │   │   ├── go/usr/lib/go-1.6/pkg/linux_amd64/encoding/binary.a
$ go/usr/bin/go version
go version go1.6.2 linux/amd64

It is better, but what if go would not find some libraries?

Really for working golang installation you need more packages - see simulation below:

$ apt-get install golang --simulate
NOTE: This is only a simulation!
      apt-get needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  golang-1.6 golang-1.6-doc golang-1.6-go golang-1.6-race-detector-runtime golang-1.6-src golang-doc golang-go golang-race-detector-runtime
  golang-src
Suggested packages:
  bzr git mercurial subversion
The following NEW packages will be installed:
  golang golang-1.6 golang-1.6-doc golang-1.6-go golang-1.6-race-detector-runtime golang-1.6-src golang-doc golang-go golang-race-detector-runtime
  golang-src
0 upgraded, 10 newly installed, 0 to remove and 12 not upgraded.

Good methods

Really you have the following options:

  • Сreate debootstrap or schroot or Docker container/directory or something similar to isolate Go environment.

  • Install go with Snap:

    snap install go16-lbo
    

    and test it with

    snap run go16-lbo help
    
  • Install go1.10 with ubuntu-make:

    sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
    sudo apt-get update
    sudo apt-get install ubuntu-make
    umake go
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.