Advertisement
Chriser_

快速安装

Dec 18th, 2024 (edited)
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.06 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # 1. 安装 podman-docker fail2ban firewalld 包
  4. echo "Installing podman-docker..."
  5. yum install -y epel-release
  6. sudo dnf install -y podman-docker fail2ban firewalld
  7.  
  8. # 2. 创建并编辑 /etc/systemd/system/docker.service 文件
  9. echo "Creating /etc/systemd/system/docker.service..."
  10. sudo bash -c 'cat <<EOF > /etc/systemd/system/docker.service
  11. [Unit]
  12. Description=Podman API Service
  13. Documentation=man:podman-system-service(1)
  14. Wants=network.target
  15.  
  16. [Service]
  17. Type=exec
  18. Environment=LOGGING="--log-level=info"
  19. ExecStart=/usr/bin/podman system service
  20. KillMode=process
  21.  
  22. [Install]
  23. WantedBy=multi-user.target
  24. EOF'
  25.  
  26. # 3. 重新加载 systemd 配置
  27. echo "Reloading systemd daemon..."
  28. sudo systemctl daemon-reload
  29.  
  30. # 4. 启动 docker 服务(实际上是 Podman 服务)
  31. echo "Starting docker service..."
  32. sudo systemctl start docker
  33.  
  34. # 5. 设置 docker 服务开机自启
  35. echo "Enabling docker service to start on boot..."
  36. sudo systemctl enable docker
  37. sudo systemctl enable --now podman.socket
  38. echo "Podman (as Docker) setup is complete!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement