1.准备
在各种涉及到下载的操作,除了被墙打不开以外,还会有域名解析错误,修改dns服务
- nmtui
修改dns为:
- nameserver 8.8.8.8
- nameserver 8.8.4.4
2.安装依赖
- yum -y install gcc git wget go
3.配置gopath
- vi /etc/profile
- #######
- export GOPATH=/root/go
- #######
- source /etc/profile
5.安装Docker
docker安装可以通过
- yum -y install docker
但是由于版本太老,会报client api和server api版本不一致的错误,可以参照:
6.编译安装cloudfocker
- go get github.com/cloudcredo/cloudfocker/fock
编译好的fock可执行文件在/root/go/bin下
7.检验安装
- mv fock /usr/bin
- fock docker
7.下载cloudfoundry的docker镜像
- fock this
但是无法下载docker镜像
可先自行下载镜像上传到服务器上,下载地址
然后执行
- cat fee97b71-17d7-4fab-a5b0-69d4112521e6 | docker import - cloudfocker-base
相当于手工完成了
- fock this
8.新增buildpacks
- fock add-buildpack https://github.com/cloudfoundry/java-buildpack
9.部署一个Java测试程序
- cd /root/go/src/github.com/cloudcredo/cloudfocker/sample-apps/java
- fock up
出现以下表示部署成功:
- Started the CloudFocker container.
- Deleting the CloudFocker container...
- cloudfocker-staging
- Deleted container.
- Starting the CloudFocker container...
- c63b7062ccae17d7a6dd4cae98d0db92242eef660cb1d9031d119fa228da583d
- Started the CloudFocker container.
- Connect to your running application at http://localhost:8080/
效果如图:
这一步如果顺利的话,可以打开http://ip:8080,但是总是会出现无法下载依赖的tomcat。我这部署成功也是有概率的
10.更多请关注CloudFocker