How To Install Portainer on Debian 12
In this tutorial, we will show you how to install Portainer on Debian 12. Portainer is a lightweight, open-source tool for managing Docker environments. It provides a user-friendly interface that simplifies the complexities of Docker, making it accessible to developers, system administrators, and those new to containerization.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the Portainer on a Debian 12 (Bookworm).
Prerequisites
- A server running one of the following operating systems: Debian 12 (Bookworm).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- Make sure your Debian 12 system is connected to the internet. An active connection is essential for downloading the required packages and updates during the installation.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Portainer on Debian 12 Bookworm
Step 1. Keeping your system up-to-date is a best practice in system administration. Start by updating the system packages with the following commands:
sudo apt update sudo apt upgrade sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release
Step 2. Installing Docker.
The Portainer runs as a Docker container, so we need to install Docker first. Now add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Set up the stable repository:
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Update the apt package index, and install the latest version of Docker Engine and containerd:
sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io
To ensure Docker has been installed correctly, run:
sudo docker run hello-world
This command downloads a test image and runs it in a container. If the installation is successful, a welcome message will be displayed.
Step 3. Installing Portainer on Debian 12.
Now, let’s install Portainer. Run the following commands:
sudo docker pull portainer/portainer-ce
Run the Portainer container:
sudo docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
Step 4. Access Portainer Web Ui.
To verify the installation, open a web browser and navigate to http://localhost:9000
. You should see the Portainer login screen.
Once logged in, you’ll be greeted by the Portainer dashboard. Here, you can manage containers, images, networks, and volumes. You can also monitor the health of your Docker environment and manage Docker Swarm clusters if you have them.
Congratulations! You have successfully installed Portainer. Thanks for using this tutorial to install the latest version of the Portainer on Debian 12 Bookworm. For additional help or useful information, we recommend you check the official Portainer website.