安装golang
centos7 直接安装golang
  1. yum install golang

centos6需添加软件源,然后再安装

  1. rpm -ivh http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
  2. yum install golang
 
安装依赖包
  1. yum groupinstall 'Development tools'
  2. yum install glibc-static ​sqlite-devel.x86_64 libselinux-static libsepol-static
  3. yum install libuuid-devel libattr-devel zlib-devel libacl-devel e2fsprogs-devel libblkid-devel lzo-devel  asciidoc xmlto

编译device mapper

  1. git clone --no-checkout https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2 && cd /usr/local/lvm2 && git checkout -q v2_02_103
  2. #如果下载超时,使用https://github.com/steven676/lvm2.git代替,或直接从https://git.fedorahosted.org/cgit/lvm2.git/refs/tags下载
  3. cd /usr/local/lvm2 && ./configure --enable-static_link && make  && make install

此处要注意别用./configure --enable-static_link && make device-mapper && make install_device-mapper只编译device mapper,这样有可能因为lvm与device mapper不匹配,而导致lvm无法运行,在物理机下次重启时,所有lvm文件系统都不可用,只能重装操作系统了。
 

编译安装sqlite
  1. wget http://www.sqlite.org/2015/sqlite-autoconf-3080803.tar.gz
  2. ./configure
  3. make
  4. make install

安装btrfs-progs

centos7
  1. yum install btrfs-progs

centos6

  1. git clone git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
  2. cd btrfs-progs
  3. ./autogen.sh
  4. ./configure
  5. make
  6. make install
 

设置环境变量

  1. export GOPATH=/path/to/go   #docker目录放在/path/to/go/docker
  2. export AUTO_GOPATH=1
 

编译docker
静态编译

  1. ./hack/make.sh binary

 

动态编译docker

  1. ./hack/make.sh dynbinary
 
 

TroubleShooting

 
  • 执行lvm --version出错:
lvm: relocation error: lvm: symbol dm_get_status_cache, version Base not defined in file libdevmapper.so.1.02 with link time reference
这是由于之更新了device mapper,没有更新lvm导致,直接运行:
  1. cd /usr/local/lvm2 && ./configure --enable-udev_sync && make && make install
  • 启动docker时报如下警告
 level="warning" msg="WARNING: Udev sync is not supported. This will lead to unexpected behavior, data loss and errors"
原因在于编译device mapper时没有添加对 udev sync的支持,执行如下命令重新编译:
  1. yum install libudev-devel
  2. cd /usr/local/lvm2 && ./configure --enable-udev_sync && make && make install
  3. cd docker && ./hack/make.sh dynbinary
由于现在udev没有可用静态库,所以只能编译device mapper的动态链接库,也就只能编译动态链接版的docker。
  • centos7编译device mapper出错,错误信息如下,未解决,求助?
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(seusers.o): In function `getseuserbyname':
(.text+0x334): warning: Using 'getgrouplist' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(seusers.o): In function `getseuserbyname':
(.text+0x306): warning: Using 'getgrnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(seusers.o): In function `getseuserbyname':
(.text+0x570): warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(load_policy.o): In function `selinux_mkload_policy':
(.text+0x302): undefined reference to `lzma_stream_decoder'
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(load_policy.o): In function `selinux_mkload_policy':
(.text+0x411): undefined reference to `lzma_code'
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(load_policy.o): In function `selinux_mkload_policy':
(.text+0x482): undefined reference to `lzma_end'
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(load_policy.o): In function `selinux_mkload_policy':
(.text+0x642): undefined reference to `lzma_end'
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(label_file.o): In function `closef':
(.text+0x136): undefined reference to `pcre_free'
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(label_file.o): In function `closef':
(.text+0x13f): undefined reference to `pcre_free_study'
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(label_file.o): In function `compile_regex.isra.5':
(.text+0x270): undefined reference to `pcre_compile'
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(label_file.o): In function `compile_regex.isra.5':
(.text+0x291): undefined reference to `pcre_study'
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(label_file.o): In function `lookup':
(.text+0x4fa): undefined reference to `pcre_exec'
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libselinux.a(label_file.o): In function `lookup':
(.text+0x572): undefined reference to `pcre_exec'
collect2: error: ld returned 1 exit status
make[1]: *** [dmsetup.static] Error 1
make[1]: Leaving directory `/root/lvm2-2_02_103/tools'
make: *** [tools.device-mapper] Error 2
 
 
  • 静态编译版的docker在启动时出错(动态编译版运行正常),信息如下,未解决,求助。
# /root/go/docker/bundles/1.4.1-dev/binary/docker-1.4.1-dev -H unix:///var/run/docker.sock -H tcp://0.0.0.0:5050 -d -g /home/docker/  --bridge="" --group=""
INFO[0000] +job serveapi(unix:///var/run/docker.sock, tcp://0.0.0.0:5050) 
INFO[0000] WARNING: You are running linux kernel version 2.6.32-431.el6.x86_64, which might be unstable running docker. Please upgrade your kernel to 3.8.0. 
WARN[0000] WARNING: Udev sync is not supported. This will lead to unexpected behavior, data loss and errors 
INFO[0000] Listening for HTTP on unix (/var/run/docker.sock) 
INFO[0000] Listening for HTTP on tcp (0.0.0.0:5050)     
INFO[0000] /!\ DON'T BIND ON ANOTHER IP ADDRESS THAN 127.0.0.1 IF YOU DON'T KNOW WHAT YOU'RE DOING /!\ 
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x0]

runtime stack:
runtime: unexpected return pc for runtime.sigpanic called from 0x988759
runtime.throw(0x12bdce5)
/usr/lib/golang/src/pkg/runtime/panic.c:520 +0x69
runtime: unexpected return pc for runtime.sigpanic called from 0x988759
runtime.sigpanic()
/usr/lib/golang/src/pkg/runtime/os_linux.c:222 +0x3d

goroutine 24 [syscall]:
runtime.cgocall(0x402028, 0xc208399038)
/usr/lib/golang/src/pkg/runtime/cgocall.c:143 +0xe5 fp=0xc208399020 sp=0xc208398fd8
github.com/docker/docker/pkg/devicemapper._Cfunc_dm_udev_wait(0x0, 0xc2085970c0)
github.com/docker/docker/pkg/devicemapper/_obj/_cgo_defun.c:257 +0x31 fp=0xc208399038 sp=0xc208399020
github.com/docker/docker/pkg/devicemapper.dmUdevWaitFct(0x0, 0xc208399080)
/root/go/docker/pkg/devicemapper/devmapper_wrapper.go:247 +0x28 fp=0xc208399058 sp=0xc208399038
github.com/docker/docker/pkg/devicemapper.UdevWait(0x0, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/pkg/devicemapper/devmapper.go:287 +0x44 fp=0xc2083990c8 sp=0xc208399058
github.com/docker/docker/pkg/devicemapper.ActivateDevice(0xc208587b90, 0x25, 0xc2083508c0, 0x19, 0x1, 0x280000000, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/pkg/devicemapper/devmapper.go:641 +0x6a9 fp=0xc208399210 sp=0xc2083990c8
github.com/docker/docker/daemon/graphdriver/devmapper.(*DeviceSet).activateDeviceIfNeeded(0xc208041680, 0xc2080040c0, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/daemon/graphdriver/devmapper/deviceset.go:429 +0x1d3 fp=0xc2083992a8 sp=0xc208399210
github.com/docker/docker/daemon/graphdriver/devmapper.(*DeviceSet).setupBaseImage(0xc208041680, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/daemon/graphdriver/devmapper/deviceset.go:688 +0x472 fp=0xc208399378 sp=0xc2083992a8
github.com/docker/docker/daemon/graphdriver/devmapper.(*DeviceSet).initDevmapper(0xc208041680, 0x200001, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/daemon/graphdriver/devmapper/deviceset.go:1098 +0x1202 fp=0xc2083995e8 sp=0xc208399378
github.com/docker/docker/daemon/graphdriver/devmapper.NewDeviceSet(0xc2080817e0, 0x19, 0xc20000ef01, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/daemon/graphdriver/devmapper/deviceset.go:1688 +0x457 fp=0xc2083997c0 sp=0xc2083995e8
github.com/docker/docker/daemon/graphdriver/devmapper.Init(0xc2080817e0, 0x19, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/daemon/graphdriver/devmapper/driver.go:43 +0x16e fp=0xc208399890 sp=0xc2083997c0
github.com/docker/docker/daemon/graphdriver.GetDriver(0xcd1010, 0xc, 0xc20808e6e0, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/root/go/docker/.gopath/src/github.com/docker/docker/daemon/graphdriver/driver.go:136 +0x187 fp=0xc208399940 sp=0xc208399890
github.com/docker/docker/daemon/graphdriver.New(0xc20808e6e0, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7ff36b7071b0, 0xc2080019c0)
/root/go/docker/.gopath/src/github.com/docker/docker/daemon/graphdriver/driver.go:150 +0x2ac fp=0xc208399a98 sp=0xc208399940
github.com/docker/docker/daemon.NewDaemonFromDirectory(0x12dfc40, 0xc2080b7340, 0x0, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/daemon/daemon.go:861 +0x8b2 fp=0xc208399e18 sp=0xc208399a98
github.com/docker/docker/daemon.NewDaemon(0x12dfc40, 0xc2080b7340, 0x0, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/daemon/daemon.go:781 +0x43 fp=0xc208399e58 sp=0xc208399e18
main.func·002()
/root/go/docker/docker/daemon.go:104 +0x46 fp=0xc208399fa8 sp=0xc208399e58
runtime.goexit()
/usr/lib/golang/src/pkg/runtime/proc.c:1445 fp=0xc208399fb0 sp=0xc208399fa8
created by main.mainDaemon
/root/go/docker/docker/daemon.go:127 +0x336

goroutine 16 [chan receive]:
github.com/docker/docker/api/server.ServeApi(0xc20804cb00, 0x7ff36b70c3a8)
/root/go/docker/.gopath/src/github.com/docker/docker/api/server/server.go:1653 +0x473
github.com/docker/docker/engine.(*Job).Run(0xc20804cb00, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/engine/job.go:83 +0x837
main.mainDaemon()
/root/go/docker/docker/daemon.go:142 +0x5ba
main.main()
/root/go/docker/docker/docker.go:73 +0x424

goroutine 19 [finalizer wait]:
runtime.park(0x41a4b0, 0x12dc658, 0x12c3529)
/usr/lib/golang/src/pkg/runtime/proc.c:1369 +0x89
runtime.parkunlock(0x12dc658, 0x12c3529)
/usr/lib/golang/src/pkg/runtime/proc.c:1385 +0x3b
runfinq()
/usr/lib/golang/src/pkg/runtime/mgc0.c:2644 +0xcf
runtime.goexit()
/usr/lib/golang/src/pkg/runtime/proc.c:1445

goroutine 20 [syscall]:
os/signal.loop()
/usr/lib/golang/src/pkg/os/signal/signal_unix.go:21 +0x1e
created by os/signal.init·1
/usr/lib/golang/src/pkg/os/signal/signal_unix.go:27 +0x32

goroutine 17 [syscall]:
runtime.goexit()
/usr/lib/golang/src/pkg/runtime/proc.c:1445

goroutine 23 [chan receive]:
github.com/docker/docker/pkg/signal.func·002()
/root/go/docker/.gopath/src/github.com/docker/docker/pkg/signal/trap.go:30 +0x88
created by github.com/docker/docker/pkg/signal.Trap
/root/go/docker/.gopath/src/github.com/docker/docker/pkg/signal/trap.go:53 +0x28f

goroutine 25 [chan receive]:
github.com/docker/docker/pkg/listenbuffer.(*defaultListener).Accept(0xc20845c320, 0x0, 0x0, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/pkg/listenbuffer/buffer.go:43 +0xb3
net/http.(*Server).Serve(0xc208438de0, 0x7ff36b712a28, 0xc20845c320, 0x0, 0x0)
/usr/lib/golang/src/pkg/net/http/server.go:1698 +0x91
github.com/docker/docker/api/server.(*HttpServer).Serve(0xc20845c4a0, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/api/server/server.go:51 +0x4c
github.com/docker/docker/api/server.func·006()
/root/go/docker/.gopath/src/github.com/docker/docker/api/server/server.go:1648 +0x267
created by github.com/docker/docker/api/server.ServeApi
/root/go/docker/.gopath/src/github.com/docker/docker/api/server/server.go:1649 +0x3fa

goroutine 26 [chan receive]:
github.com/docker/docker/pkg/listenbuffer.(*defaultListener).Accept(0xc208351bc0, 0x0, 0x0, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/pkg/listenbuffer/buffer.go:43 +0xb3
net/http.(*Server).Serve(0xc2080056e0, 0x7ff36b712a28, 0xc208351bc0, 0x0, 0x0)
/usr/lib/golang/src/pkg/net/http/server.go:1698 +0x91
github.com/docker/docker/api/server.(*HttpServer).Serve(0xc208351fa0, 0x0, 0x0)
/root/go/docker/.gopath/src/github.com/docker/docker/api/server/server.go:51 +0x4c
github.com/docker/docker/api/server.func·006()
/root/go/docker/.gopath/src/github.com/docker/docker/api/server/server.go:1648 +0x267
created by github.com/docker/docker/api/server.ServeApi
/root/go/docker/.gopath/src/github.com/docker/docker/api/server/server.go:1649 +0x3fa

 

参考文献:

http://www.tuicool.com/articles/6VBnQj
转自http://www.centoscn.com/image-text/install/2015/0404/5093.html

go 安装的更多相关文章

  1. docker——容器安装tomcat

    写在前面: 继续docker的学习,学习了docker的基本常用命令之后,我在docker上安装jdk,tomcat两个基本的java web工具,这里对操作流程记录一下. 软件准备: 1.jdk-7 ...

  2. 网络原因导致 npm 软件包 node-sass / gulp-sass 安装失败的处理办法

    如果你正在构建一个基于 gulp 的前端自动化开发环境,那么极有可能会用到 gulp-sass ,由于网络原因你可能会安装失败,因为安装过程中部分细节会到亚马逊云服务器上获取文件.本文主要讨论在不变更 ...

  3. Sublime Text3安装JsHint

    介绍 Sublime Text3使用jshint依赖Nodejs,SublimeLinter和Sublimelinter-jshint. NodeJs的安装省略. 安装SublimeLinter Su ...

  4. Fabio 安装和简单使用

    Fabio(Go 语言):https://github.com/eBay/fabio Fabio 是一个快速.现代.zero-conf 负载均衡 HTTP(S) 路由器,用于部署 Consul 管理的 ...

  5. gentoo 安装

    加载完光驱后 1进行ping命令查看网络是否通畅 2设置硬盘的标识为GPT(主要用于64位且启动模式为UEFI,还有一个是MBR,主要用于32位且启动模式为bois) parted -a optima ...

  6. Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级

    Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级 环境:OEL 5.7 + Oracle 10.2.0.5 RAC 5.安装Database软件 5. ...

  7. Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part1:准备工作

    Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part1:准备工作 环境:OEL 5.7 + Oracle 10.2.0.5 RAC 1.实施前准备工作 1.1 服务器安装操 ...

  8. 【原】nodejs全局安装和本地安装的区别

    来微信支付有2年多了,从2年前的互联网模式转变为O2O模式,主要的场景是跟线下的商户去打交道,不像以往的互联网模式,有产品经理提需求,我们帮忙去解决问题. 转型后是这样的,团队成员更多需要去寻找业务的 ...

  9. tLinux 2.2下安装Mono 4.8

    Tlinux2.2发行版基于CentOS 7.2.1511研发而成,内核版本与Tlinux2.0发行版保持完全一致,更加稳定,并保持对Tlinux2.0的完全兼容.Mono 4版本要求CentOS 7 ...

  10. 工欲善其事,必先利其器 之 VS2013全攻略(安装,技巧,快捷键,插件)!

    如有需要WPF工具的朋友可以移步 工欲善其事,必先利其器 之 WPF篇: 随着开发轨迹来看高效WPF开发的工具和技巧 之前一篇<c++的性能, c#的产能?!鱼和熊掌可以兼得,.NET NATI ...

随机推荐

  1. mysql之对索引的操作

    1. 为什么使用索引? 数据库对象索引与书的目录非常类似,主要是为了提高从表中检索数据的速度.由于数据储存在数据库表中,所以索引是创建在数据库表对象之上的,由表中的一个字段或多个字段生成的键组成,这些 ...

  2. Windows内核下操作字符串!

    * Windows内核下操作字符串! */ #include <ntddk.h> #include <ntstrsafe.h> #define BUFFER_SIZE 1024 ...

  3. SignalR —— Asp.net RealTime的春天

    一般的例子:http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/tutorial-gettin ...

  4. css构造块级元素

    css 1. 宽高width:数值;height:数值;也可用百分比!长高的设置不会被后代继承2. 背景(1)背景颜色background-color:颜色值;元素的背景颜色默认为transparen ...

  5. GridView点击排序

    快速预览:GridView无代码分页排序GridView选中,编辑,取消,删除GridView正反双向排序GridView和下拉菜单DropDownList结合GridView和CheckBox结合鼠 ...

  6. 如何:从代码创建 UML 类图(ZZ)

      您拖动的一个或多个类将显示在关系图上. 它们依赖的类将显示在"UML 模型资源管理器"中. 参见 模型表示类型的方式. 将程序代码中的类添加到 UML 模型 打开一个 C# 项 ...

  7. ashx 集成于Ihandle 简易 高性能 web

    不用搞MV4..如果你用.ashx写的后台..自己加一个switch case就实现了路由...更方便,还不用配置   scaffold 不是dynamic data里面的东西吗   现在我全是ash ...

  8. 使 SortList 实现重复键排序

    SortList 默认对按Key来排序,且Key值不能重复,但有时可能需要用有重复值的Key来排序,以下是实现方式: 1.对强类型:以float为例 #region 使SortList能对重复键排序 ...

  9. OpenCV 3.0 VS2010 Configuration

    Add in the system Path: C:\opencv\build\x86\vc10\bin; Project->Project Property->Configuration ...

  10. jquery限制div字符长度,超出部分已“…”显示

    $(".content").each(function(){ if($(this).text().length>100){ $(this).text($(this).text ...