对于Centos7离线安装Docker感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍centos7离线安装docker,并为您提供关于centos7离线安装docker,离线安装docker-
对于Centos7 离线安装 Docker感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍centos7离线安装docker,并为您提供关于centos 7离线安装docker, 离线安装docker-compose、Centos MacBook Docker 离线安装 InfluxDB 超级简单、Centos MacBook Docker离线安装InfluxDB超级简单、Centos 在线安装 docker的有用信息。
本文目录一览:- Centos7 离线安装 Docker(centos7离线安装docker)
- centos 7离线安装docker, 离线安装docker-compose
- Centos MacBook Docker 离线安装 InfluxDB 超级简单
- Centos MacBook Docker离线安装InfluxDB超级简单
- Centos 在线安装 docker
Centos7 离线安装 Docker(centos7离线安装docker)
下载 Docker 并安装
docker 包下载地址
#下载docker-20.10.0包
https://download.docker.com/linux/static/stable/x86_64/docker-20.10.0.tgz
#上传到Centos系统/data/目录,如
scp docker-20.10.0.tgz root@192.168.0.5:/data/
#进入data目录,解压docker包
cd /data
tar -zxvf docker-20.10.0.tgz
#将解压出来的docker文件内容移动到 /usr/bin/ 目录下
cp docker/* /usr/bin/
#查看docker版本
docker version
#查看docker信息
docker info
配置 Docker 开机自启动服务
#添加docker.service文件
vi /etc/systemd/system/docker.service
#按i插入模式,复制如下内容:
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
#添加文件可执行权限
chmod +x /etc/systemd/system/docker.service
#重新加载配置文件
systemctl daemon-reload
#启动Docker
systemctl start docker
#查看docker启动状态
systemctl status docker
#查看启动容器
docker ps
#设置开机自启动
systemctl enable docker.service
#查看docker开机启动状态 enabled:开启, disabled:关闭
systemctl is-enabled docker.service
centos 7离线安装docker, 离线安装docker-compose
因某些环境,不能联外网,或者在线安装时下载docker安装包非常慢,所以使用docker yum源方法行不通,于是使用离线安装。
安装步骤:
第1步,下载docker-ce相关安装包
(1) 下载国内镜像源docker-ce.repo文件,下载地址:http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
(2) 下载 container-selinux 安装包,下载地址:https://pkgs.org/download/container-selinux
点击连接进入container-selinux下载页面
(3) 下载最新的docker-ce、docker-ce-cli、containerd.io安装包,
下载地址:https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
(4) 下载docker-compose安装包,
国内下载地址:http://get.daocloud.io ,
国外下载地址:https://github.com/docker/compose/releases
第2步,上传安装包到centos
用xftp将docker-ce、docker-ce-cli、containerd.io、docker-compose、docker-ce.repo安装包上传到centos。
第3步,安装docker-ce
卸载旧版本
yum remove docker-ce docker-selinux docker-ce-cli containerd.io
将上传好的docker-ce.repo文件拷贝到/etc/yum.repos.d/ 目录下。
cp /tools/docker/docker-ce.repo /etc/yum.repos.d/
按顺序依次安装containerd.io、docker-ce-cli、container-selinux、docker-ce包。
yum update
rpm -ivh containerd.io-1.2.6-3.3.el7.x86_64.rpm
rpm -ivh docker-ce-cli-19.03.9-3.el7.x86_64.rpm
rpm -ivh container-selinux-2.107-3.el7.noarch.rpm rpm -ivh docker-ce-19.03.9-3.el7.x86_64.rpm
启动docker,设置开机自动启动
systemctl start docker systemctl enable docker
查看docker版本
docker version
第4步,安装docker-compose
将docker-compose文件拷贝到 /user/local/bin/ 目录
cp /tools/docker/docker-compose /usr/local/bin/
安装docker-compose
chmod +x /usr/local/bin/docker-compose
查看docker-compose版本
docker-compose --version
Centos MacBook Docker 离线安装 InfluxDB 超级简单
CentOS 离线安装 InfluxDB
InfluxDB 和 IotDB 介绍与性能对比
InfluxDB 官方下载地址
#解压
tar -zxvf influxdb-1.7.10-static_linux_amd64.tar.gz
#nohup后台启动,指定配置文件,输出日志到log.file文件
nohup /home/influxdb-1.7.10-1/influxd -config /home/influxdb-1.7.10-1/influxdb.conf >> /home/influxdb-1.7.10-1/log.file 2>&1 &
#增加 开机自启动
vim /etc/rc.d/rc.local
#打开后, 最后添加如下命令
nohup /home/influxdb-1.7.10-1/influxd -config /home/influxdb-1.7.10-1/influxdb.conf >> /home/influxdb-1.7.10-1/log.file 2>&1 &
终端连接 InfluxDB
cd /home/influxdb-1.7.10-1/
#连接InfluxDB 默认没有设置用户名和密码
./influx
#如果设置了用户名和密码时
./influx -username ''admin'' -password ''abcd_2021''
#远程连接其他InfluxDB
./influx -host 192.168.1.2 -port 8086 -username admin -password abcd_2021
开启 udp
修改配置文件: influxdb.conf
[[udp]] enabled = true 开启 udp
Java 调用时 influxDB.write (8089, builder.build ());
MacBook 离线安装 InfluxDB
#下载
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.6.4_darwin_amd64.tar.gz
#解压
tar -zxvf influxdb-1.6.4_darwin_amd64.tar.gz
#进入目录
cd software/influxdb-1.6.4-1/usr/bin
#启动服务,默认配置启动
./influxd
#指定配置启动
./influxd -config ../../etc/influxdb/influxdb.conf
#连接influxDB
./influx
#远程连接其他InfluxDB
./influx -host 192.168.1.2 -port 8086 -username admin -password abcd_2021
Docker 安装 InfluxDB
Centos7 离线安装 Docker
#下载镜像
docker pull influxdb
#运行容器,把配置文件挂载到宿主机/data/influxdb目录,把数据文件也挂载出来,防止数据丢失, 挂载时区,不然默认是0时区
docker run -d --name my-influxdb \
-p 8086:8086 \
-p 8083:8083 \
-p 2003:2003 \
-e INFLUXDB_GRAPHITE_ENABLED=true \
-v /data/influxdb/conf/influxdb.conf:/etc/influxdb/influxdb.conf \
-v /data/influxdb:/var/lib/influxdb \
-v /etc/localtime:/etc/localtime \
influxdb
InfluxDB 使用
默认是不用用户名和密码的,是否开启认证,默认值:false
cat /data/influxdb/conf/influxdb.conf
[meta]
dir = "/var/lib/influxdb/meta"
[data]
dir = "/var/lib/influxdb/data"
engine = "tsm1"
wal-dir = "/var/lib/influxdb/wal"
[http]
auth-enabled = false
创建用户名和密码后,修改为开启认证
#连接influxDB
./influx
#如果是容器启动,进入容器
docker exec -it my-influxdb /bin/bash
输入 influx
#创建用户名和密码,并给所有权限
create user "admin" with password ''abcd_2021'' with all privileges
#登录
auth admin abcd_2021
#查询数据库
show databases;
#创建数据库
create database demo
创建好用户名和密码后,修改 auth-enabled = true 重启服务或重启容器生效,就必须要使用 用户名和密码连接
#http方式创建数据库testdb
curl -i -X POST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE testdb"
#http方式创建用户名和密码
curl -XPOST http://localhost:8086/query --data-urlencode "q=create user "admin123" with password ''admin123'' with all privileges"
#其他方式
./influx -database ''testdb'' -execute ''auth admin123 admin123''
InfluxDB 保存策略
#显示test数据库策略 如果没有指定策略默认是autogen
show retention policies on test
#对test数据库创建一个策略,2小时之前数据删除,一个副本,设置为默认策略
create retention policy "abc" on "test" duration 2h replication 1 default
#10天前数据删除 比如:h(小时),w(星期)
create retention policy "rp_10d" on "iotdata" duration 10d replication 1 default
#修改默认策略
alter retention policy "autogen" on "demo" duration 10d replication 1 default
alter retention policy "autogen" on "demo" duration 15d replication 1 default
#修改策略
alter retention policy "rp_10d" ON "demo" duration 10d replication 1 default
#插入数据不指定策略,按默认策略保存
insert into devops,host=server01 cpu=23.1,mem=0.61
#指定策略保存数据
insert into "autogen" devops,host=server01 cpu=23.1,mem=0.71
#查询时不指定策略,按默认策略查询
select * from "devops"
#指定策略查询数据
select * from "autogen"."devops"
show tag keys from 表名
show field keys from 表名
Centos MacBook Docker离线安装InfluxDB超级简单
CentOS离线安装InfluxDB
InfluxDB和IotDB介绍与性能对比
InfluxDB官方下载地址
#解压
tar -zxvf influxdb-1.7.10-static_linux_amd64.tar.gz
#nohup后台启动,指定配置文件,输出日志到log.file文件
nohup /home/influxdb-1.7.10-1/influxd -config /home/influxdb-1.7.10-1/influxdb.conf >> /home/influxdb-1.7.10-1/log.file 2>&1 &
#增加 开机自启动
vim /etc/rc.d/rc.local
#打开后, 最后添加如下命令
nohup /home/influxdb-1.7.10-1/influxd -config /home/influxdb-1.7.10-1/influxdb.conf >> /home/influxdb-1.7.10-1/log.file 2>&1 &
终端连接InfluxDB
cd /home/influxdb-1.7.10-1/
#连接InfluxDB 默认没有设置用户名和密码
./influx
#如果设置了用户名和密码时
./influx -username ''admin'' -password ''abcd_2021''
#远程连接其他InfluxDB
./influx -host 192.168.1.2 -port 8086 -username admin -password abcd_2021
开启udp
修改配置文件: influxdb.conf
[[udp]]
enabled = true 开启udp
Java调用时 influxDB.write(8089, builder.build());
MacBook离线安装InfluxDB
#下载
wget https://dl.influxdata.com/influxdb/releases/influxdb-1.6.4_darwin_amd64.tar.gz
#解压
tar -zxvf influxdb-1.6.4_darwin_amd64.tar.gz
#进入目录
cd software/influxdb-1.6.4-1/usr/bin
#启动服务,默认配置启动
./influxd
#指定配置启动
./influxd -config ../../etc/influxdb/influxdb.conf
#连接influxDB
./influx
#远程连接其他InfluxDB
./influx -host 192.168.1.2 -port 8086 -username admin -password abcd_2021
Docker安装InfluxDB
Centos7离线安装Docker
#下载镜像
docker pull influxdb
#运行容器,把配置文件挂载到宿主机/data/influxdb目录,把数据文件也挂载出来,防止数据丢失, 挂载时区,不然默认是0时区
docker run -d --name my-influxdb \
-p 8086:8086 \
-p 8083:8083 \
-p 2003:2003 \
-e INFLUXDB_GRAPHITE_ENABLED=true \
-v /data/influxdb/conf/influxdb.conf:/etc/influxdb/influxdb.conf \
-v /data/influxdb:/var/lib/influxdb \
-v /etc/localtime:/etc/localtime \
influxdb
InfluxDB使用
默认是不用用户名和密码的, 是否开启认证,默认值:false
cat /data/influxdb/conf/influxdb.conf
[meta]
dir = "/var/lib/influxdb/meta"
[data]
dir = "/var/lib/influxdb/data"
engine = "tsm1"
wal-dir = "/var/lib/influxdb/wal"
[http]
auth-enabled = false
创建用户名和密码后,修改为开启认证
#连接influxDB
./influx
#如果是容器启动,进入容器
docker exec -it my-influxdb /bin/bash
输入 influx
#创建用户名和密码,并给所有权限
create user "admin" with password ''abcd_2021'' with all privileges
#登录
auth admin abcd_2021
#查询数据库
show databases;
#创建数据库
create database demo
创建好用户名和密码后,修改auth-enabled = true
重启服务或重启容器生效,就必须要使用 用户名和密码连接
#http方式创建数据库testdb
curl -i -X POST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE testdb"
#http方式创建用户名和密码
curl -XPOST http://localhost:8086/query --data-urlencode "q=create user "admin123" with password ''admin123'' with all privileges"
#其他方式
./influx -database ''testdb'' -execute ''auth admin123 admin123''
InfluxDB保存策略
#显示test数据库策略 如果没有指定策略默认是autogen
show retention policies on test
#对test数据库创建一个策略,2小时之前数据删除,一个副本,设置为默认策略
create retention policy "abc" on "test" duration 2h replication 1 default
#10天前数据删除 比如:h(小时),w(星期)
create retention policy "rp_10d" on "iotdata" duration 10d replication 1 default
#修改默认策略
alter retention policy "autogen" on "demo" duration 10d replication 1 default
alter retention policy "autogen" on "demo" duration 15d replication 1 default
#修改策略
alter retention policy "rp_10d" ON "demo" duration 10d replication 1 default
#插入数据不指定策略,按默认策略保存
insert into devops,host=server01 cpu=23.1,mem=0.61
#指定策略保存数据
insert into "autogen" devops,host=server01 cpu=23.1,mem=0.71
#查询时不指定策略,按默认策略查询
select * from "devops"
#指定策略查询数据
select * from "autogen"."devops"
show tag keys from 表名
show field keys from 表名
Centos 在线安装 docker
在安装 Docker 之前,先说一下配置,我这里是 Centos7 Linux 内核:官方建议 3.10 以上,3.8 以上貌似也可。
在线安装一定要的你机器联网了啊。
如果之前安装过旧版的 docker,可以先卸载
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine \
docker-ce
为了保证在线安装顺利需要安装一下 gcc 的环境。
yum -y install gcc
yum -y install gcc-c++
以下命令安装 yum 工具
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2 --skip-broken
执行以下命令设置 stable 镜像仓库
yum-config-manager \
--add-repo \
https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i ''s/download.docker.com/mirrors.aliyun.com\/docker-ce/g'' /etc/yum.repos.d/docker-ce.repo0
顺便更新 yum 包软件索引,以后使用 yum 安装稍微会快一点
yum makecache fast
配置好环境问题后,执行以下命令安装 Docker,docker-ce 为社区免费版本。稍等片刻,docker 即可安装成功
yum -y install docker-ce docker-ce-cli containerd.io
启动 docker
systemctl start docker
查看 docker 版本
docker version
一些常用命令
systemctl daemon-reload //重载系统服务
systemctl list-unit-files --type service //查看全部服务命令
systemctl status docker // 查看docker服务状态
systemctl enable docker //设置docker开机自启动
systemctl disable docker // 关闭docker开机启动
systemctl start docker // 启动docker服务
systemctl stop docker // 停止docker服务
systemctl restart docker // 重启docker服务
配置马爸爸云镜像加速器,因为众所周知的原因,需要加速器, 当然,最好是配置自己的镜像地址,别人的其实也无所谓,能加速就行
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
下面是设置桌面端的
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-''EOF''
{
"registry-mirrors": ["https://qlmy5iw9.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
容器随着 docker 启动
docker update --restart=always mysql5.7(mysql5.7是容器名字)
转载文章,并非原创,docker 官网其实都有,怕以后找不到了在这里做个备份,如果引用请注明出处
关于Centos7 离线安装 Docker和centos7离线安装docker的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于centos 7离线安装docker, 离线安装docker-compose、Centos MacBook Docker 离线安装 InfluxDB 超级简单、Centos MacBook Docker离线安装InfluxDB超级简单、Centos 在线安装 docker等相关知识的信息别忘了在本站进行查找喔。
本文标签: