Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # 1. 安装 podman-docker fail2ban firewalld 包
- echo "Installing podman-docker..."
- yum install -y epel-release
- sudo dnf install -y podman-docker fail2ban firewalld
- # 2. 创建并编辑 /etc/systemd/system/docker.service 文件
- echo "Creating /etc/systemd/system/docker.service..."
- sudo bash -c 'cat <<EOF > /etc/systemd/system/docker.service
- [Unit]
- Description=Podman API Service
- Documentation=man:podman-system-service(1)
- Wants=network.target
- [Service]
- Type=exec
- Environment=LOGGING="--log-level=info"
- ExecStart=/usr/bin/podman system service
- KillMode=process
- [Install]
- WantedBy=multi-user.target
- EOF'
- # 3. 重新加载 systemd 配置
- echo "Reloading systemd daemon..."
- sudo systemctl daemon-reload
- # 4. 启动 docker 服务(实际上是 Podman 服务)
- echo "Starting docker service..."
- sudo systemctl start docker
- # 5. 设置 docker 服务开机自启
- echo "Enabling docker service to start on boot..."
- sudo systemctl enable docker
- sudo systemctl enable --now podman.socket
- echo "Podman (as Docker) setup is complete!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement