Linux安装Portainer(简洁版)
- 项目简介
- Docker安装
1.安装命令:curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun2.启动:systemctl start docker3.停止:systemctl stop docker4.重启:systemctl restart docker5.开机启动:systemctl enable docker6.镜像加速:
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{"registry-mirrors": ["https://8q5nyauc.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
- 安装目录
mkdir -p /opt/portainer/data && cd /opt/portainer
- 安装包下载
wget https://github.com/portainer/portainer/releases/download/2.18.4/portainer-2.18.4-linux-amd64.tar.gz
# 注意:https://github.com/portainer/portainer/releases获取下载链接并替换
- 安装包解压
for file in *.tar.gz; do tar -zxvf "$file" --strip-components=1; done
- 环境变量
echo -e "\n# 设置portainer环境变量" >> /etc/profile
echo -e "export PORTAINER_HOME=/opt/portainer" >> /etc/profile
echo -e "export PATH=\$PORTAINER_HOME:\$PATH" >> /etc/profile
source /etc/profile
- 常用命令
启动:nohup portainer -p :8282 -d /opt/portainer/data > /opt/portainer/portainer.log &
查看:ps -ef | grep -i portainer
关闭:pkill -f "portainer"
注意:启动后光标复原Ctrl+C
- 开机启动
#----------------------------------------------------------
sudo tee /usr/bin/portainer.sh <<-'EOF'
#! /bin/bash
nohup /opt/portainer/portainer -p :8282 -d /opt/portainer/data > /opt/portainer/portainer.log &
EOF
chmod +x /usr/bin/portainer.sh
#----------------------------------------------------------
sudo tee /etc/systemd/system/portainer.service <<-'EOF'
[Unit]
Description=portainer
After=syslog.target network.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/portainer.sh
[Install]
WantedBy=multi-user.target
EOF
#----------------------------------------------------------
systemctl enable portainer
#----------------------------------------------------------
firewall-cmd --zone=public --add-port=8282/tcp --permanent && firewall-cmd --reload
#----------------------------------------------------------
# 启动portainer
systemctl start portainer
# 停止portainer
systemctl stop portainer
# 重启portainer
systemctl restart portainer
# 查看portainer状态
systemctl status portainer
- 访问路径
http://your-server-ip:8282
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/60172.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!