This script creates /usr/local/portainer/, writes a docker-compose.yml file for the agent, and launches it with docker compose up -d.
Run as root or with sudo:
sudo bash install-portainer-agent.sh
nano install-portainer-agent.sh
- Save the script as
install-portainer-agent.sh - Make it executable:
chmod +x install-portainer-agent.sh - Run with sudo:
sudo bash install-portainer-agent.sh - Once running, add the agent endpoint in Portainer UI using the host IP and port 9001
Or You can Use this script to deploy on host directly
curl -fsSL https://raw.githubusercontent.com/SkyLuke91/Portainer-agent-installation-script/main/install-portainer-agent.sh -o install-portainer-agent.sh
chmod +x install-portainer-agent.sh
sudo bash install-portainer-agent.sh