先电云计算PAAS

先电云计算PAAS

基础环境配置

server&&client#

vi /etc/selinux/config

SELINUX=disavled //若不将Selinux设为diabled则需要安装一个container-serlinux的包,该包要求版本大于2.14

setenforce 0 //reboot

systemctl stop firewalld

systemctl disable firewalld

iptavbles -F

iptable -X

iptable -Z

/usr/sbin/iptables-save

vi /etc/sysctl.conf

net.ipv4.ip_forward=1

net.ipv4.conf.default.rp_filter=0

net.ipv4.conf.all.rp_filter=0

sysctl -p

hostnamectl set-hostname server //server节点

hostnamectl set-hostname client //client节点

vi /etc/hoasts

10.0.3.137 server

10.0.3.138 client

ping server

ping client

server#

mv /etc/yum.repos.d/* /home

vi /etc/yum.repos.d/docker.repo

[centos]

name=centos

baseurl=ftp://192.168.100.10/centos

enabled=1

gpgcheck=0

[docker]

name=docker

baseurl=file:///opt/docker/docker

enabled=1

gpgcheck=0

mkdir /opt/docker

mount XianDian-PaaS-v2.2.iso /opt/docker/

yum clean all

yum list

yum install -y vdftpd

vi /etc/vsftpd/vsftpd.conf

anon_root=/opt

systemctl enable vsftpd

systemctl start vsftpd

client#

mv /etc/yum.repos.d/* /home

vi /etc/yum.repos.d/docker.repo

[centos]

name=centos

baseurl=ftp://192.168.100.10/centos

enabled=1

gpgcheck=0

[docker]

name=docker

baseurl=ftp://10.0.3.137/docker/docker

enabled=1

gpgcheck=0

yum clean all

yum list

服务安装

server&client#

yum install -y docker

systemctl restart docker

systenctl enable docker

server#

cd /opt/docker/images/rancher1.6.5/

ls //共有10个镜像

rancher_agent_v1.2.5.tar rancher-net_v0.11.3.tar

rancher_dns_v0.15.1.tar rancher_network-manager_v0.7.4.tar

rancher_healthcheck_v0.3.1.tar rancher_scheduler_v0.8.2.tar

rancher_metadata_v0.9.2.tar rancher_server_v1.6.5.tar

rancher_net_holder.tar registry_latest.tar

docker load -i registry_latest.tar

docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

docker.io/registry latest c9bd19d022f6 15 months ago 33.27 MB

docker run -d -p 5000:5000 --restart=always --name registry docker.io/registry:latest

20a07207bf28256d13fbc53cf2a1d978a4827bf8f360b32a8106d996f024c001

docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

20a07207bf28 docker.io/registry:latest "/entrypoint.sh /etc/" 8 seconds ago Up 3 seconds 0.0.0.0:5000->5000/tcp registry

server&client#

vi /etc/sysconfig/docker //设置仓库地址

ADD_REGISTRY='--add-registry 10.0.3.137:5000' //registry:注册 10.0.3.137:server的IP

INSECURE_REGISTRY='--insecure-registry 10.0.3.137:5000' //insecure:不稳定的

systemctl daemon-reload

systemctl restart docker

docker info //显示 Docker 系统信息,包括镜像和容器数

server#

docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

docker.io/registry latest c9bd19d022f6 15 months ago 33.27 MB

docker tag c9bd19d022f6 10.0.3.137:5000/registry:latest //ID要和名字一一对应,版本号用冒号隔开

docker push 10.0.3.137:5000/registry:latest

docker load -i rancher_server_v1.6.5.tar

docker images

REPOSITORY TAG IMAGE ID CREATED SIZE

f89070da7581 3 weeks ago 984.9 MB

10.0.3.137:5000/registry latest c9bd19d022f6 15 months ago 33.27 MB

docker.io/registry latest c9bd19d022f6 15 months ago 33.27 MB

docker tag f89070da7581 10.0.3.137:5000/rancher/server:v1.6.5 //名字含下划线的用“/”代替

docker push 10.0.3.137:5000/rancher/server:v1.6.5

docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:v1.6.5

//只有这两个容器需要run,别的是组件,不用run

docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

2ff52cf39d6f rancher/server:v1.6.5 "/usr/bin/entry /usr/" 18 seconds ago Up 6 seconds 3306/tcp, 0.0.0.0:8080->8080/tcp modest_turing

20a07207bf28 docker.io/registry:latest "/entrypoint.sh /etc/" 39 minutes ago Up 38 minutes 0.0.0.0:5000->5000/tcp registry

http://10.0.3.137:8080

将剩下的8个镜像都上传上去

docker load -i …

docker imabes

docker tag … …

docker push …

注意将每个镜像的ID和名字都要对上

docker kill 容器ID //用于杀死运行的容器,容器有容器的ID镜像有镜像的ID

docker rm 容器ID //删除一个或多个容器 -f 强制

docker rmi 镜像ID //删除本地一个或多个镜像 -f 强制

cliant#

从网页上设置client的ip获得一串脚本后复制过来运行

后面的应用

gogs

elasticsearch 2.x

Prometheus