Remotes and Package Management
About 1233 wordsAbout 4 min
2025-12-22
Remotes in Conan are servers that store packages - think of them as "app stores" for C++ libraries. Just like you have different app stores (Apple App Store, Google Play Store, etc.), Conan has different package repositories where you can download and upload libraries.
What are Remotes?
A remote is essentially a Conan package server that:
- Stores packages (binaries and recipes)
- Handles package uploads from developers
- Serves packages to consumers
- Manages package metadata and search
Default Remotes
ConanCenter (The Main Repository)
# ConanCenter is pre-configured and contains thousands of packages
conan remote list
# Output shows something like:
# conancenter: https://center.conan.io [Verify SSL: True, Enabled: True]Searching ConanCenter
# Search for packages
conan search fmt
conan search boost
conan search "opengl*" --remote=conancenter
# Get package information
conan show fmt/10.0.0Custom Remotes
Why Create Custom Remotes?
- Private Libraries - Your company's internal libraries
- Third-party Integration - Libraries from partners/customers
- Offline Development - Mirror of packages for air-gapped environments
- Performance - Local mirrors for faster downloads
- Control - Curated package repositories with security reviews
Setting Up Your Own Conan Server
Option 1: Artifactory (Recommended for Enterprises)
JFrog Artifactory is the most popular Conan repository server.
# Add Artifactory remote
conan remote add mycompany https://mycompany.jfrog.io/artifactory/api/conan/conan-local
# Authenticate
export CONAN_LOGIN_USERNAME=myuser
export CONAN_PASSWORD=mypassword
conan remote auth mycompanyFeatures of Artifactory:
- User management and permissions
- Package promotion between environments
- Replication and backup
- Analytics and monitoring
- Integration with CI/CD
Option 2: Conan Server (Simple Setup)
Conan Server is a lightweight option for small teams:
# Install conan server
pip install conan-server
# Start the server
conan_server
# This starts a server on http://localhost:9300Option 3: Cloud Solutions
GitHub Packages
# Add GitHub Packages as remote
conan remote add github-packages https://npm.pkg.github.com/@your-org
# Authenticate with GitHub token
export CONAN_LOGIN_USERNAME=your-github-username
export CONAN_PASSWORD=your-github-token
conan remote auth github-packagesGitLab Package Registry
# Add GitLab Packages
conan remote add gitlab-packages https://gitlab.com/api/v4/packages/conan
# Authenticate
export CONAN_LOGIN_USERNAME=your-gitlab-username
export CONAN_PASSWORD=your-gitlab-token
conan remote auth gitlab-packagesAWS CodeArtifact
# Add AWS CodeArtifact
conan remote add codeartifact https://your-domain-123456789.d.codeartifact.us-west-2.amazonaws.com/conan/your-repo/
# Authenticate with AWS
aws codeartifact login --tool conan --repository your-repo --domain your-domain --domain-owner 123456789Creating a Local Conan Server
Quick Setup for Development
# 1. Create a working directory
mkdir conan-server && cd conan-server
# 2. Initialize Conan server
conan server
# 3. This creates a server configuration in the current directory
# 4. Access at http://localhost:9300Configuration File
Create server.conf:
[server]
jwt_secret=your-secret-key
jwt_expire_minutes=60
write_permissions = */*@*/*
read_permissions = */*@*/*
[users]
admin=password123
developer1=devpassword1Starting the Server
# Start with custom configuration
conan server --server_file server.conf --host 0.0.0.0 --port 8080
# Server is now available at http://your-server:8080Adding and Managing Remotes
Add a Remote
# Basic remote
conan remote add myremote https://my-conan-server.com
# Remote with specific name
conan remote add mycompany-remote https://artifactory.mycompany.com/conan
# Add remote with disabled SSL verification (not recommended for production)
conan remote add insecure-remote http://insecure-server.com --insecureUpdate Remote
# Change remote URL
conan remote update myremote https://new-url.com
# Disable/enable remote
conan remote disable myremote
conan remote enable myremote
# Remove remote
conan remote remove myremoteList and Show Remotes
# List all remotes
conan remote list
# Show remote details
conan remote show myremote
# Check remote connectivity
conan ping myremoteAuthentication and Security
Username/Password Authentication
# Set authentication for remote
conan remote auth myremote --username=jdoe --password=secret123
# Or use interactive prompt
conan remote auth myremoteToken-Based Authentication
# For JFrog Artifactory
conan remote auth myremote --username=jdoe --password=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
# For GitHub/GitLab
conan remote auth myremote --username=jdoe --password=ghp_xxxxxxxxxxxxxxxxxxxxEnvironment-Based Authentication
# Set environment variables
export CONAN_LOGIN_USERNAME=jdoe
export CONAN_PASSWORD=your_token_here
# Conan will use these for authentication
conan install . --remote=myremoteCertificate-Based Authentication
# For self-signed certificates
conan remote add my-https-remote https://self-signed-server.com --verify-ssl=false
# For specific CA certificates
export REQUESTS_CA_BUNDLE=/path/to/ca-bundle.crt
export SSL_CERT_FILE=/path/to/ca-bundle.crtPublishing Packages to Custom Remotes
Upload Packages
# Upload a single package
conan upload mylib/1.0.0@user/channel --remote=myremote
# Upload with all binaries
conan upload mylib/1.0.0@user/channel --remote=myremote --all
# Upload specific packages only
conan upload mylib/1.0.0@user/channel --remote=myremote --package-folder=mybinary
# Upload with confirmation
conan upload mylib/1.0.0@user/channel --remote=myremote --confirmUpload Patterns
# Upload all packages matching pattern
conan upload "*@user/channel" --remote=myremote
# Upload with specific versioning
conan upload "mylib/1.*" --remote=myremote
# Upload only if package doesn't exist
conan upload mylib/1.0.0@user/channel --remote=myremote --skip-uploadedUpload with Retry and Error Handling
# Retry on failures
conan upload mylib/1.0.0@user/channel --remote=myremote --retry=3 --retry-wait=10
# Upload with query conditions
conan upload mylib/1.0.0@user/channel --remote=myremote --query "arch=x86_64 AND build_type=Release"Working with Package Repositories
Repository Structure
my-company-remote/
├── libraries/
│ ├── mylib/1.0.0/
│ │ ├── user1/channel/
│ │ └── user2/stable/
│ └── otherlib/2.1.0/
│ └── user1/testing/
├── internal/
│ └── proprietary/1.0.0/
└── third-party/
└── vendor-lib/3.0.0/Package Promotion Workflow
# 1. Develop and test in testing channel
conan create . mylib/1.0.0@user/testing
# 2. Upload to testing remote
conan upload mylib/1.0.0@user/testing --remote=testing-remote
# 3. Promote to staging after QA approval
conan copy mylib/1.0.0@user/testing mylib/1.0.0@user/staging --remote=testing-remote --destination=staging-remote
# 4. Promote to production
conan copy mylib/1.0.0@user/staging mylib/1.0.0@user/stable --remote=staging-remote --destination=prod-remoteMirroring and Replication
Local Mirror Setup
# Add ConanCenter as a mirror
conan remote add conan-center-mirror https://center.conan.io
# Mirror specific packages
conan download fmt/10.0.0 --remote=conan-center-mirror
conan upload fmt/10.0.0 --remote=local-mirrorArtifactory Remote Replication
# Artifactory replication configuration
replications:
- url: "https://local-artifactory.company.com/artifactory/api/conan/conan-local"
cronExp: "0 0 2 * * ?" # Daily at 2 AM
repoKey: conan-local
proxy: trueTroubleshooting Remote Issues
Common Problems
Authentication Failures
# Check authentication
conan remote auth myremote --username=test --password=test
# Clear authentication cache
conan remote logout myremotePackage Not Found
# Search for packages
conan search --remote=myremote mylib
# Check if package exists
conan search --remote=myremote "*mylib*"
# Download recipe only
conan download mylib/1.0.0@user/channel --remote=myremote --recipe-onlySSL/TLS Issues
# Disable SSL verification (development only)
conan remote add my-remote http://insecure-server.com --insecure
# Update CA certificates
sudo apt update && sudo apt install ca-certificates
# Check SSL certificate
openssl s_client -connect myremote.com:443Debug Remote Operations
# Verbose output
conan install . --remote=myremote --verbose
# Check package info before downloading
conan info mylib/1.0.0@user/channel --remote=myremote
# Download and show progress
conan download mylib/1.0.0@user/channel --remote=myremote --progressRemote Best Practices
Security
- Use HTTPS - Never use unencrypted HTTP in production
- Authentication tokens - Use API tokens instead of passwords
- Certificate validation - Don't disable SSL verification in production
- User permissions - Configure proper access controls
Performance
- Local mirrors - Set up mirrors close to your developers
- Concurrent downloads - Enable parallel package downloads
- Package retention - Clean up old versions to save space
- Bandwidth throttling - Configure limits for large teams
Organization
- Naming conventions - Use clear, descriptive remote names
- Environment separation - Separate dev/staging/production remotes
- Package promotion - Implement proper promotion workflows
- Monitoring - Track usage and package metrics
Key Points: Remotes and Package Management
- Remotes are package servers - Like app stores for C++ libraries
- Multiple options - Artifactory, Conan Server, cloud providers
- Authentication required - Username/password, tokens, certificates
- Upload/download workflow - Share packages across teams
- Security best practices - HTTPS, proper authentication, permissions
- Performance optimization - Local mirrors, concurrent operations
- Enterprise features - Replication, analytics, package promotion