CentOSRHEL Based

How To Install Portainer on CentOS Stream 10

Install Portainer on CentOS Stream 10

In this tutorial, we will show you how to install Portainer on CentOS Stream 10. Portainer has emerged as one of the most popular Docker management tools available today, offering a sleek and intuitive web interface that simplifies container management tasks. If you’re running CentOS Stream 10 and want to streamline your Docker workflow, installing Portainer will give you powerful visualization and management capabilities without the complexity of command-line only administration. This comprehensive guide walks you through every step of installing and configuring Portainer on CentOS Stream 10, from preparing your system to advanced management techniques.

Understanding Portainer and Its Benefits

Portainer is a lightweight, open-source management UI that allows you to easily manage your Docker environments. Available in both Community Edition (CE) and Business Edition (BE), Portainer provides an accessible alternative to command-line Docker management, making container orchestration more approachable for users of all skill levels.

The Community Edition, which we’ll focus on in this guide, offers robust features including:

  • Comprehensive container management (creation, deletion, starting, stopping)
  • Docker image management with registry integration
  • Network configuration and monitoring
  • Volume management for persistent storage
  • User access controls and team management
  • Resource usage visualization
  • Template-based application deployment

For organizations managing multiple Docker environments, Portainer significantly reduces the learning curve and operational overhead. Instead of memorizing numerous Docker CLI commands, administrators can perform complex operations through an intuitive dashboard. This visual approach not only speeds up common tasks but also reduces the potential for human error during configuration.

Portainer’s architecture is designed to be lightweight yet powerful. It runs as a Docker container itself, requiring minimal resources while providing maximum functionality. This makes it suitable for both development environments on modest hardware and production deployments on enterprise infrastructure.

Prerequisites for Installation

Before installing Portainer on CentOS Stream 10, ensure your system meets these requirements:

Hardware Requirements:

  • CPU: Minimum 1 GHz processor (2+ cores recommended for production)
  • RAM: At least 1GB (2GB or more recommended)
  • Storage: Minimum 20GB available disk space
  • Network: Stable internet connection for downloading packages

Software Prerequisites:

  • CentOS Stream 10 with latest updates
  • Root or sudo privileges
  • Basic familiarity with Linux command line
  • Terminal access to the server

Network Considerations:

  • Open ports for Portainer (typically 9443 for HTTPS and 8000 for the agent)
  • Proper firewall configuration to allow these ports
  • Network connectivity between your workstation and the server

CentOS Stream 10 provides an excellent foundation for Docker and Portainer due to its stability and long-term support. Having a fresh installation with all updates applied will minimize potential compatibility issues during the installation process.

Preparing Your CentOS Stream 10 Environment

The first step toward a successful Portainer installation is properly preparing your CentOS Stream 10 environment. This preparation ensures all dependencies are in place and the system is optimally configured.

Start by updating your system packages to the latest versions:

sudo dnf update -y

After updating, install the essential packages that will be needed during the installation process:

sudo dnf install -y curl wget tar dnf-plugins-core

Next, configure your firewall to allow the required ports for Portainer. If you’re using firewalld (the default in CentOS):

sudo firewall-cmd --permanent --add-port=9443/tcp
sudo firewall-cmd --permanent --add-port=8000/tcp
sudo firewall-cmd --reload

If SELinux is enabled on your system (which is the default for CentOS), you’ll need to configure it appropriately. While you could disable SELinux entirely, a better approach is to create the proper contexts:

sudo setsebool -P container_manage_cgroup 1

This allows Docker containers to function properly while maintaining overall system security.

Verify your system is ready by checking network connectivity:

ping -c 4 google.com

A successful ping confirms your system has internet access for downloading Docker and Portainer images.

Installing Docker on CentOS Stream 10

Portainer requires Docker to be installed, as it runs as a Docker container itself. Follow these steps to install Docker on CentOS Stream 10:

First, add the Docker repository to your system:

sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Now install Docker Engine and required components:

sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

After installation, start and enable the Docker service to ensure it runs automatically on system boot:

sudo systemctl start docker
sudo systemctl enable docker

Verify your Docker installation by running:

sudo docker --version
sudo docker run hello-world

The first command should display the Docker version information, while the second will download a test image and run it in a container, confirming that Docker is functioning correctly.

For convenience, consider adding your user to the Docker group to allow running Docker commands without sudo:

sudo usermod -aG docker $USER

Note that you’ll need to log out and log back in for this change to take effect.

If you encounter any issues during Docker installation, common troubleshooting steps include:

  • Verifying your internet connection
  • Ensuring your CentOS Stream 10 repositories are properly configured
  • Checking for conflicting packages with dnf list installed | grep docker
  • Inspecting Docker service status with systemctl status docker

Creating Storage for Portainer

Portainer requires persistent storage to maintain its configuration and data across container restarts or upgrades. Docker volumes provide an ideal solution for this requirement.

Create a dedicated Docker volume for Portainer with the following command:

sudo docker volume create portainer_data

This volume will store all Portainer configuration data, including user accounts, endpoints, and settings. Using a named volume ensures your data persists even if the Portainer container is removed or updated.

Verify that the volume was created successfully:

sudo docker volume ls

You should see portainer_data in the list of volumes.

Understanding how Docker volumes work is important for proper management. Volumes are stored in the Docker data directory (typically /var/lib/docker/volumes/ on CentOS Stream 10) and are managed by Docker itself. This approach offers several advantages over binding to a host directory:

  • Better performance, especially on certain storage drivers
  • Easier backups and migrations
  • Automatic management by Docker
  • Cross-platform compatibility

For production environments, consider implementing regular backups of this volume to prevent data loss.

Installing Portainer Community Edition

With Docker running and storage prepared, you’re ready to install Portainer Community Edition. The installation process involves pulling the Portainer image and creating a container with the appropriate configuration.

First, pull the latest Portainer CE image:

sudo docker pull portainer/portainer-ce:latest

Next, create and start the Portainer container with the following command:

sudo docker run -d \
  --name portainer \
  --restart=always \
  -p 8000:8000 \
  -p 9443:9443 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v portainer_data:/data \
  portainer/portainer-ce:latest

Let’s break down this command:

  • -d: Runs the container in detached mode (background)
  • --name portainer: Assigns a name to the container for easier reference
  • --restart=always: Ensures the container automatically restarts if it stops or if the system reboots
  • -p 8000:8000: Maps port 8000 for the Portainer agent
  • -p 9443:9443: Maps port 9443 for the Portainer web interface (HTTPS)
  • -v /var/run/docker.sock:/var/run/docker.sock: Gives Portainer access to the Docker API
  • -v portainer_data:/data: Mounts the persistent volume we created earlier

Verify that the Portainer container is running:

sudo docker ps

This command should show the Portainer container in the list with status “Up”.

For environments with specific requirements, you can customize the installation with additional parameters. For example, to use a different port for the web interface:

sudo docker run -d --name portainer --restart=always -p 8000:8000 -p 8080:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

This configuration uses port 8080 instead of 9443 for the web interface.

Securing Your Portainer Installation

Security should be a priority for any production deployment. Follow these best practices to secure your Portainer installation:

Use SSL/TLS Encryption:
By default, Portainer CE uses HTTPS on port 9443 with a self-signed certificate. For production use, consider using your own certificates:

sudo docker run -d \
  --name portainer \
  --restart=always \
  -p 8000:8000 \
  -p 9443:9443 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v portainer_data:/data \
  -v /path/to/your/certs:/certs \
  portainer/portainer-ce:latest \
  --sslcert /certs/portainer.crt \
  --sslkey /certs/portainer.key

Implement Strong Authentication:
During the initial setup, you’ll create an admin user. Use a strong, unique password and consider setting up additional users with appropriate permissions rather than sharing the admin account.

Network Security:
Consider running Portainer behind a reverse proxy like Nginx or Traefik for additional security layers. This can provide features like IP filtering, rate limiting, and additional authentication methods.

Regular Updates:
Keep both Docker and Portainer updated to benefit from the latest security patches:

sudo docker pull portainer/portainer-ce:latest
sudo docker stop portainer
sudo docker rm portainer
# Then run the docker run command again to create a new container with the latest image

For environments with stringent security requirements, consider implementing additional measures such as network segmentation and regular security audits.

Accessing the Portainer Web Interface

With Portainer installed and running, you can now access its web interface. Open your web browser and navigate to:

https://your-server-ip:9443

Since Portainer uses a self-signed certificate by default, your browser may display a security warning. You can safely proceed past this warning for your own installation (though consider proper certificates for production use as mentioned earlier).

Install Portainer on CentOS Stream 10

You’ll be greeted with the initial setup screen where you’ll create your administrator account. Create a username and strong password, then click “Create user”.

After creating your admin account, you’ll be prompted to select the type of environment to manage. Choose “Docker” to manage the local Docker environment where Portainer is installed.

The Portainer dashboard will then load, giving you full access to its features. Take a moment to familiarize yourself with the layout:

  • The left sidebar provides access to different management sections
  • The main area displays content relevant to your current selection
  • The top bar includes user settings and global actions

This user-friendly interface makes Docker management more accessible, even for those new to containerization.

Configuring Portainer for First Use

After initial login, you’ll need to configure Portainer for optimal use. Start by establishing a connection to your local Docker environment:

  1. Go to the “Environments” section from the sidebar
  2. Click on “local” to access the Docker environment running on your server
  3. You should see the Docker environment details, including version information

Next, explore and adjust the Portainer settings to match your requirements:

  1. Navigate to “Settings” in the sidebar
  2. Review and configure general settings like authentication method and template repository
  3. Consider enabling “Hide internal Portainer containers” to declutter your container list

For users new to Portainer, explore the interface to understand the different sections:

  • Environments: Manage Docker hosts and clusters
  • Containers: Create and manage Docker containers
  • Images: Pull, build, and manage Docker images
  • Networks: Configure and manage Docker networks
  • Volumes: Create and manage persistent storage
  • Stacks: Deploy multi-container applications using Docker Compose

Take time to explore each section to understand the capabilities Portainer offers. The intuitive interface makes it easy to learn as you navigate through different features.

Managing Docker Containers with Portainer

One of Portainer’s key strengths is simplifying container management tasks. Here’s how to perform common container operations:

Creating Containers:

  1. Navigate to “Containers” in the sidebar
  2. Click “Add container”
  3. Specify a name for your container
  4. Select an image from the registry or your local images
  5. Configure ports, volumes, networks, and environment variables
  6. Click “Deploy the container”

Managing Existing Containers:
From the Containers page, you can:

  • Start, stop, restart, or kill containers using the quick-action buttons
  • Click on a container name to access detailed management options
  • View container stats, logs, and console access
  • Inspect container configuration
  • Create a new image from a container

Viewing Logs:
Troubleshooting container issues is easier with log access:

  1. Select your container from the list
  2. Click the “Logs” tab
  3. View real-time logs or download them for analysis

Accessing Container Console:
For direct interaction with a container:

  1. Select your container
  2. Click the “Console” tab
  3. Choose a command (typically /bin/bash or /bin/sh)
  4. Click “Connect” to open an interactive terminal

Container Resource Management:
Portainer allows you to monitor and limit container resources:

  1. When creating or editing a container, expand the “Advanced container settings”
  2. Set CPU and memory limits as needed
  3. Monitor resource usage from the container details page

These visual management capabilities significantly reduce the learning curve compared to command-line Docker management.

Working with Docker Images in Portainer

Portainer streamlines Docker image management with an intuitive interface:

Pulling Images:

  1. Navigate to “Images” in the sidebar
  2. Click “Pull image”
  3. Enter the image name (e.g., nginx:latest)
  4. Click “Pull the image”

Managing Local Images:
The Images page displays all local images with options to:

  • Remove unused images
  • Build new images
  • Export images
  • See which containers use each image

Building Custom Images:
Portainer supports building images from Dockerfiles:

  1. Navigate to Images
  2. Click “Build a new image”
  3. Upload your Dockerfile or enter it directly
  4. Specify build options
  5. Click “Build the image”

Registry Management:
Configure access to private registries:

  1. Go to “Registries” in the sidebar
  2. Click “Add registry”
  3. Enter your registry details
  4. Test the connection
  5. Save the configuration

With proper registry configuration, you can seamlessly pull and push images to both public and private repositories directly from the Portainer interface.

Advanced Portainer Features

Portainer offers several advanced features for sophisticated container management:

Managing Multiple Environments:
Connect Portainer to multiple Docker hosts or Kubernetes clusters:

  1. Go to “Environments” and click “Add environment”
  2. Choose the environment type (Docker, Kubernetes, etc.)
  3. Enter connection details
  4. Click “Add environment”

Portainer Agent Deployment:
For remote Docker hosts, deploy the Portainer Agent:

docker run -d --name portainer_agent --restart=always -p 9001:9001 -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/volumes:/var/lib/docker/volumes portainer/agent:latest

Then add this endpoint in Portainer with the agent URL.

Stack Deployment:
Deploy multi-container applications using Docker Compose:

  1. Navigate to “Stacks” in the sidebar
  2. Click “Add stack”
  3. Upload your docker-compose.yml file or enter it directly
  4. Configure deployment options
  5. Deploy the stack

Resource Controls:
Implement fine-grained access controls:

  1. When creating resources, expand the “Access control” section
  2. Select whether the resource is publicly accessible or restricted
  3. Assign specific users or teams if restricted

Edge Computing Support:
For distributed environments, Portainer Edge provides tools to manage remote Docker instances with limited connectivity, ideal for IoT and edge computing scenarios.

These advanced features make Portainer suitable for complex enterprise deployments while maintaining its user-friendly approach.

Troubleshooting Common Issues

Even with careful installation, you may encounter issues. Here are solutions to common problems:

Web Interface Not Accessible:

  1. Verify the Portainer container is running: docker ps | grep portainer
  2. Check firewall settings: sudo firewall-cmd --list-ports
  3. Ensure your browser is using the correct URL with HTTPS: https://your-server-ip:9443
  4. Inspect container logs: docker logs portainer

Docker Socket Connection Issues:
If Portainer can’t connect to Docker:

  1. Verify the Docker socket is properly mounted: docker inspect portainer
  2. Check Docker service status: systemctl status docker
  3. Restart the Portainer container: docker restart portainer

Permission Problems:

  1. Ensure proper volume permissions: ls -la /var/run/docker.sock
  2. Add your user to the Docker group if needed: sudo usermod -aG docker $USER

Container Deployment Failures:
If container creation fails:

  1. Check for port conflicts: netstat -tulpn | grep <port-number>
  2. Verify image availability: docker images
  3. Check resource limitations: free -m and df -h

Update and Upgrade Issues:
When updating Portainer:

  1. Always back up your data before upgrading
  2. Use volume mounts to preserve configuration
  3. Follow the correct upgrade process for your version

For persistent issues, consult the official Portainer documentation or the active community forums. The Portainer team maintains excellent documentation with specific troubleshooting guides for common scenarios.

Congratulations! You have successfully installed Portainer. Thanks for using this tutorial for installing Portainer on CentOS Stream 10 system. For additional help or useful information, we recommend you check the official Portainer website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button