Last modified 6 years ago Last modified on 01/04/11 13:54:47

How To

Below are a few examples of how to use Pulp to get content synced locally to your server and make available to systems that need it. The examples assume you have installed Pulp and it is running correctly using the instructions here.

Basic Usage

Best way to get started is the pulp-admin command that is installed as part of Pulp. Help information is the best way to get started:

$ pulp-admin --help
Usage: pulp-admin <options> <command>
Supported Commands:
	auth           stores pulp authentication credentials
	consumer       consumer specific actions to pulp server
	consumergroup  consumer group specific actions to pulp server
	distribution   distribution specific actions to pulp server
	errata         errata specific actions to pulp server
	package        package specific actions to pulp server
	packagegroup   package group specific actions to pulp server
	repo           repository specific actions to pulp server
	user           user specific actions to pulp server

  -h, --help            show this help message and exit

  Pulp User Account Credentials:
    -u USERNAME, --username=USERNAME
                        account username
    -p PASSWORD, --password=PASSWORD
                        account password
    -s SERVER, --server=SERVER
                        pulp server host

Each command has its own associated help documentation:

$ pulp-admin repo --help
Usage: pulp-admin <options> repo <action> <options>
Supported Actions:
	list           list available repositories
	status         show the status of a repository
	content        list the contents of a repository
	create         create a repository      
	clone          clone a repository       
	delete         delete a repository      
	update         update a repository      
	sync           synchronize data to a repository from its feed
	cancel_sync    cancel a running sync    
	upload         upload package(s) to a repository
	schedules      list all repository schedules
	listkeys       list gpg keys            
	publish        enable/disable repository being published by apache

  -h, --help  show this help message and exit

Authenticate yourself to the Pulp server

Pulp ships with a default 'admin' account defined in /etc/pulp/pulp.conf:

default_login: admin
# Highly recommend you change this with "pulp-admin user update" 
default_password: admin
  • First thing you should do is change your admin's password using the 'user update' command:
    $ pulp-admin --username=admin --password=admin user update --username=admin --password=<new password> --name="Some Admin"
    Successfully updated [ admin ] with name [ Some Admin ]
  • Now you can store your credentials in your home directory by issuing the "auth login" command. This allows you to issue requests to the Pulp server without typing your username and password each time.
    $ pulp-admin auth login --username=admin --password=****
    User credentials successfully stored at [/home/someadmin/.pulp]
  • Now you are not required to pass your username and password with each call to pulp-admin:
    $ pulp-admin repo list
    No repositories available to list

Synchronize Fedora 14

Now that we are setup to issue commands to the Pulp server lets see if we can get some content synchronized.

First step is to pick a repository to download from:

  • create a repo in pulp. Note the --feed parameter denotes the type of repository we are syncing from and the URL to find the base of the repository. The type helps Pulp figure out what synchronization strategy to use when copying the content down to the Pulp server.
    $ pulp-admin repo create --id=f14-x86_64 --feed=yum:
    Successfully created repository [ f14-x86_64 ]
  • Now we can sync that repo. You can watch this progress or CTRL+C and come back later to see if it finished.
    $ pulp-admin repo sync --id=f14-x86_64 --foreground
    Sync for repository f14-x86_64 started
    You can safely CTRL+C this current command and it will continue
    [                                                     ] 0%

Setup a synchronization schedule

Now that you have initially synced Fedora 14 to your Pulp server you may want to setup a schedule so Pulp will periodically check the remote repository for new packages.


Register a Consumer (System) to Pulp

After you get content synchronized to Pulp you probably want to connect a system to Pulp so it can start installing packages from your now local repository. The package you need on your system you want to get connected to Pulp's repositories is pulp-client. See the Installation Page on how to get pulp-client installed.

  • Once pulp-client is installed on your client machine you can (as root):
    $ sudo pulp-client --username=admin --password=**** consumer create --id=myclient
    Successfully created consumer [ myclient ]
  • Now that the Pulp server knows about your client we can see what repos are available
    $ sudo pulp-client --username=admin --password=**** repo list
           List of Available Repositories
    Label              	f14-x86_64               
    Name               	f14-x86_64               
    FeedType           	yum                      
    Arch               	noarch                   
    Sync Schedule      	None                     
    Packages           	0                        
    Files              	0                        
    Distributions      	None                     
    Publish            	True                     
    Clones             	[]                       
  • Now lets bind this client machine to the f14-x86_64 repository so it can issue local yum commands:
    $ sudo pulp-client consumer bind --repoid=f14-x86_64
    Successfully subscribed consumer [myclient] to repo [f14-x86_64]
  • Now you should be able to see a repo config file in /etc/yum.repos.d/pulp.repo
    $ cat /etc/yum.repos.d/pulp.repo 
    # Pulp Repositories
    # Managed by Pulp client
    name = f14-x86_64
    baseurl = https://localhost/pulp/repos/fedora/linux/releases/14/Fedora/x86_64/os
    enabled = 1
    sslverify = 0
  • And should be able to install packages from this repo:
    $ sudo yum --disablerepo=* --enablerepo=f14-x86_64 install zsh
      Installing     : zsh-4.3.10-5.fc13.x86_64                                                         1/1 
      zsh.x86_64 0:4.3.10-5.fc13