(一)Linux操作系统安装(详细信息参见:http://my.oschina.net/u/1458864/blog/366665)
1.安装Oracle VM VirtualBox
2.安装vagrant
3.下载box
4.vagrant添加box到虚拟机中(http://my.oschina.net/u/1458864/blog/366665)
初始化vagrant:vagrant init(详细信息参见vagrant的配置说明)
向vagrant中添加box:vagrant box add base F:\docker\box\precise64.box
启动一个box:vagrant up
5.远程登录box,进行认证。用户名:vagrant 密码vagrant
(二)docker安装(详细信息参见:http://my.oschina.net/u/1458864/blog/366672)
1.更新ubuntu系统内核
sudo apt-get update
sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
2.添加docker的repository到本地秘钥库
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
3.Docker添加到你的apt软件安装源中
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main /etc/apt/sources.list.d/docker.list"
sudo apt-get install software-properties-common #增加 add-apt-repository 命令
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:dotcloud/lxc-docker #增加一个ppa源,如:ppa:user/ppa-name
sudo apt-get update #更新系统
sudo apt-get install lxc-docker
(三)docker使用(详细信息参见:http://my.oschina.net/u/1458864/blog/366682)
1.docker images
2.docker search ubuntu
3.docker pull ubuntu
4.docker run -i -t -p 3306:3306 ubuntu (后台运行并映射3306端口)
5.docker ps -a
6.docker logs containerID
7.docker rm containerID
8.docker rmi imageID
9.sudo docker run -t -i -v /home/linjiqin/dev/docker:/home/mycontainer:rw -p 8000:8000 mydocker /bin/bash (共享磁盘)
10.sudo docker --name --link (对容器命名和容器之间访问映射)
11.docker attach containerID
12.docker push ubuntu
(四)docker创建私有库(详细信息参见:http://my.oschina.net/u/1458864/blog/369057)
1.docker pull registry
2.docker run -i -t -p 5000:5000 registry
3.docker tag ubuntu 192.168.33.10:5000/ubuntu
4.docker push 192.168.33.10:5000/ubuntu
5.curl http://192.168.33.10:5000/v1/search
6.docker 的https安全认证,需要在docker客户端中配置Ubuntu下配置文件地址为:/etc/init/docker.conf 在其中增加--insecure-registry 192.168.33.10:5000
(五)java环境搭建
1.安装jdk、tomcat、nexus、mysql
2.环境变量配置文件修改vi ~/.bashrc
export JAVA_HOME=/opt/jdk1.7
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export M2_HOME=/opt/maven
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
export RUN_AS_USER=root
3.修改启动脚本vi /ect/rc.local
export JAVA_HOME=/opt/jdk1.7
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export M2_HOME=/opt/maven
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
export RUN_AS_USER=root
service tomcat
service nexus start
4.mysql权限修改
vi /ect/mysql/my.conf
修改bind_address 0.0.0.0
登录mysql mysql -u root -r
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘mypwd‘ WITH GRANT OPTION;
flush privileges;