linux-centos-docker安装zerotier
版本: centos7.9 (7.7以上的版本都可用)
注意事项
安装zerotier需要内核版本高一点,我这里用的是5.X
这里发现报错信息:FATAL: kernel too old
就是内核版本过低,需要升级
具体流程
查看当前内核版本
uname -r
我这里是5.4.273-1.el7.elrepo.x86_64
如果是3.X的话,需要升级
升级内核步骤
-
更新yum: yum update
-
安装elrepo: yum install https://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
-
执行: yum --enablerepo=elrepo-kernel install kernel-lt
-
编辑elrepo源
vi /etc/yum.repos.d/elrepo.repo
# 找到下面这个地方,替换这四个字段信息 [elrepo] name=elrepo baseurl=https://mirrors.aliyun.com/elrepo/archive/kernel/el7/x86_64 gpgcheck=0 enabled=1
-
yum clean all && yum makecache
-
安装 yum install -y kernel-lt-5.4.273-1.el7.elrepo
-
安装 yum install -y kernel-lt-devel-5.4.266-1.el7.elrepo
-
设置启动内核为最新安装的 grub2-set-default 0
-
重启服务器 reboot
检查内核版本
uname -r
docker-compose启动
暴露端口 3000/TCP 9993/UDP
version: "3.1"
services:
postgres:
image: postgres:15.2-alpine
container_name: postgres
restart: unless-stopped # always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ztnet
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- app-network
zerotier:
image: zyclonite/zerotier:1.12.2
hostname: zerotier
container_name: zerotier
restart: unless-stopped # always
volumes:
- zerotier:/var/lib/zerotier-one
cap_add:
- NET_ADMIN
- SYS_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
networks:
- app-network
ports:
- "9993:9993/udp"
environment:
- ZT_OVERRIDE_LOCAL_CONF=true
- ZT_ALLOW_MANAGEMENT_FROM=172.31.255.0/29
ztnet:
image: sinamics/ztnet:latest
container_name: ztnet
working_dir: /app
volumes:
- zerotier:/var/lib/zerotier-one
restart: unless-stopped # always
ports:
- 3000:3000
# - 127.0.0.1:3000:3000 <--- Use / Uncomment this line to restrict access to localhost only
environment:
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ztnet
NEXTAUTH_URL: "http://localhost:3000" # !! Important !! Set the NEXTAUTH_URL environment variable to the canonical URL or IP of your site with port 3000
NEXTAUTH_SECRET: "random_secret"
NEXTAUTH_URL_INTERNAL: "http://ztnet:3000" # Internal NextAuth URL for 'ztnet' container on port 3000. Do not change unless modifying container name.
networks:
- app-network
links:
- postgres
depends_on:
- postgres
- zerotier
volumes:
zerotier:
postgres-data:
networks:
app-network:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.31.255.0/29
标签:kernel,postgres,部署,elrepo,yum,内核,zerotier,docker
From: https://www.cnblogs.com/xy20211005/p/18188340