CentOS安装docker,并且运行rustdesk服务器

一、更换源

cd /etc/yum.repos.d/
mv centos.repo centos.bak
nano -w centos.repo
# centos.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
     
[base]
    name=CentOS-$releasever - Base - mirrors.aliyun.com
    #failovermethod=priority
    baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/os/
            http://mirrors.aliyuncs.com/centos-stream/$stream/BaseOS/$basearch/os/
            http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/BaseOS/$basearch/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos-stream/RPM-GPG-KEY-CentOS-Official
     
#additional packages that may be useful
#[extras]
    #name=CentOS-$releasever - Extras - mirrors.aliyun.com
    #failovermethod=priority
    #baseurl=https://mirrors.aliyun.com/centos-stream/$stream/extras/$basearch/os/
    #        http://mirrors.aliyuncs.com/centos-stream/$stream/extras/$basearch/os/
    #        http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/extras/$basearch/os/
    #gpgcheck=1
    #gpgkey=https://mirrors.aliyun.com/centos-stream/RPM-GPG-KEY-CentOS-Official
     
    #additional packages that extend functionality of existing packages
[centosplus]
    name=CentOS-$releasever - Plus - mirrors.aliyun.com
    #failovermethod=priority
    baseurl=https://mirrors.aliyun.com/centos-stream/$stream/centosplus/$basearch/os/
            http://mirrors.aliyuncs.com/centos-stream/$stream/centosplus/$basearch/os/
            http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/centosplus/$basearch/os/
    gpgcheck=1
    enabled=0
    gpgkey=https://mirrors.aliyun.com/centos-stream/RPM-GPG-KEY-CentOS-Official
     
[PowerTools]
    name=CentOS-$releasever - PowerTools - mirrors.aliyun.com
    #failovermethod=priority
    baseurl=https://mirrors.aliyun.com/centos-stream/$stream/PowerTools/$basearch/os/
            http://mirrors.aliyuncs.com/centos-stream/$stream/PowerTools/$basearch/os/
            http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/PowerTools/$basearch/os/
    gpgcheck=1
    enabled=0
    gpgkey=https://mirrors.aliyun.com/centos-stream/RPM-GPG-KEY-CentOS-Official
     
     
[AppStream]
    name=CentOS-$releasever - AppStream - mirrors.aliyun.com
    #failovermethod=priority
    baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/
            http://mirrors.aliyuncs.com/centos-stream/$stream/AppStream/$basearch/os/
            http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/AppStream/$basearch/os/
    gpgcheck=1
    gpgkey=https://mirrors.aliyun.com/centos-stream/RPM-GPG-KEY-CentOS-Official

生成缓存

yum clean all
yum makecache

二、安装docker

步骤1:安装必要的依赖软件包

yum install -y yum-utils device-mapper-persistent-data lvm2

步骤2:添加Docker稳定版镜像

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

步骤3:安装Docker CE

yum install docker-ce docker-ce-cli http://containerd.io

步骤4:启动Docker

systemctl start docker

三、拉取rustdesk镜像

1.拉取docker镜像

docker pull rustdesk/rustdesk-server-s6

2.这里采用多用户模式运行的,所以端口号会不同,修改211对应2xx,和名字后面的数字一致

cd /srv/rustdesk
docker run --restart=always --name rustdesk-server111 \
  -p 21115:21115 -p 21116:21116 -p 21116:21116/udp \
  -p 21117:21117 -p 21118:21118 -p 21119:21119 \
  -e "RELAY=r.o0o.top:21117" \
  -e "ENCRYPTED_ONLY=1" \
  -v "$PWD/data111:/data" -d rustdesk/rustdesk-server-s6:latest

3.常用命令

docker stop/start/restart/kill/rm CONTAINER

四、设置防火墙

systemctl enable firewalld
firewall-cmd --permanent --zone=public --add-port=22/tcp
firewall-cmd --permanent --zone=public --add-port=21114-21119/tcp
firewall-cmd --permanent --zone=public --add-port=21116/udp
firewall-cmd --reload
firewall-cmd --list-all

关于Zeno Chen

本人涉及的领域较多,杂而不精 程序设计语言: Perl, Java, PHP, Python; 数据库系统: MySQL,Oracle; 偶尔做做电路板的开发,主攻STM32单片机
此条目发表在Linux分类目录。将固定链接加入收藏夹。