Getting Started with RHEL System Registration
Getting Started with RHEL System Registration Subscription Central 1-latest Red Hat Customer Content Services
rhc connect --activation-key=<activation_key_name> --organization=<organization_ID> Connecting kvm-07-guest03.hv2.lab.eng.bos.redhat.com to Red Hat. This might take a few seconds. • Connected to Red Hat Subscription Management • Connected to Red Hat Insights • Activated the Remote Host Configuration daemon Successfully connected to Red Hat! Manage your connected systems: https://red.ht/connector rhc connect --username=<username> --password=<password> rhc disconnect Disconnecting <USDHOSTNAME> from console.redhat.com. This might take a few seconds. Deactivated the Red Hat connector daemon Manage your Red Hat connector systems: https://red.ht/connector subscription-manager register --activation-key=<activation_key_name> --organization=<organization_ID> The system has been registered with id: 62edc0f8-855b-4184-b1b8-72a9dc793b96 install insights-client insights-client --register subscription-manager register --username=<username> --password=<password> The system has been registered with ID: 541084ff2-44cab-4eb1-9fa1-7683431bcf install insights-client insights-client --register subscription-manager unregister Unregistering from: subscription.rhsm.redhat.com:443/subscription System has been unregistered [hypervisor1] type=hyperv server=hypervisor1.example.com username=virt_who_user encrypted_password=bd257f93d@482B76e6390cc54aec1a4d hypervisor_id=hostname owner=1234567 [global] interval=3600 1 debug=True 2 [defaults] owner=1234567 1 hypervisor_id=hostname 2 [system_environment] http_proxy= https://proxy.example.com:443 1 no_proxy=* 2 subscription-manager list --all --available --matches ' Host-based Subscription Name ' subscription-manager attach --pool= Pool_ID subscription-manager list --consumed subscription-manager register --auto-attach firewall-cmd --add-port="443/tcp" firewall-cmd --add-port="443/tcp" --permanent yum install virt-who http_proxy= https://proxy.example.com:443 NO_PROXY=* systemctl enable --now virt-who yum install virt-who http_proxy= https://proxy.example.com:443 NO_PROXY=* cp /etc/virt-who.d/template.conf /etc/virt-who.d/ local.conf [local] 1 type=libvirt 2 owner=1234567 3 hypervisor_id=hostname 4 systemctl enable --now virt-who virt-who-password cp /etc/virt-who.d/template.conf /etc/virt-who.d/ vcenter1 .conf [vcenter1] 1 type=esx 2 server=vcenter1.example.com 3 username=virt_who_user 4 encrypted_password=bd257f93d@482B76e6390cc54aec1a4d 5 owner=1234567 6 hypervisor_id=hostname 7 filter_hosts=esx1.example.com, esx2.example.com 8 systemctl restart virt-who virt-who-password cp /etc/virt-who.d/template.conf /etc/virt-who.d/ hyperv1 .conf [hyperv1] 1 type=hyperv 2 server=hyperv1.example.com 3 username=virt_who_user 4 encrypted_password=bd257f93d@482B76e6390cc54aec1a4d 5 owner=1234567 6 hypervisor_id=hostname 7 systemctl restart virt-who oc new-project virt-who oc create serviceaccount virt-who oc create clusterrole lsnodes --verb=list --resource=nodes oc create clusterrole lsvmis --verb=list --resource=vmis oc adm policy add-cluster-role-to-user lsnodes system:serviceaccount:virt-who:virt-who oc adm policy add-cluster-role-to-user lsvmis system:serviceaccount:virt-who:virt-who oc get vmis -A --as=system:serviceaccount:virt-who:virt-who [virtwho-host]USD yum install virt-who subscription-manager orgs cp /etc/virt-who.d/template.conf /etc/virt-who.d/openshift-cluster-1.conf [cnv] type=kubevirt kubeconfig=/root/.kube/config hypervisor_id=hostname owner=<owner_number> oc serviceaccounts get-token virt-who oc login https://api.testcluster-1.example.org:6443 --token=<token> get secret -n openshift-kube-apiserver-operator loadbalancer-serving-signer -o jsonpath='{.data.tls\.crt}' | base64 -d > USDcluster-ca.pem [virtwho-host]USD cat /root/.kube/config apiVersion: v1 clusters: - cluster: server: https://api.testcluster.example.org:6443 certificate-authority: /root/testcluster-ca.pem name: api-testcluster-example-org:6443 contexts: - context: cluster: api-test-cluster-example-org:6443 namespace: default virt-who --print systemctl enable virt-who systemctl restart virt-who subscription-manager register --auto-attach systemctl status virt-who.service [global] debug=True { "guestId": "422f24ed-71f1-8ddf-de53-86da7900df12", "state": 5, "attributes": { "active": 0, "virtWhoType": "esx", "hypervisorType": "vmware" } }, +-------------------------------------------+ Configuration Status +-------------------------------------------+ Configuration Name: esx_config1 Source Status: success Destination Status: success Configuration Name: hyperv-55 Source Status: failure Destination Status: failure "configurations": [ { "name":"esx-conf1", "source":{ "connection":"https://esx_system.example.com", "status":"success", "last_successful_retrieve":"2020-02-28 07:25:25 UTC", "hypervisors":20, "guests":37 }, "destination":{ "connection":"candlepin.example.com", "status":"success", "last_successful_send":"2020-02-28 07:25:27 UTC", "last_successful_send_job_status":"FINISHED" } }, { "name":"hyperv-55", "source":{ "connection":"windows10-3.company.com", "status":"failure", "message":"Unable to connect to server: invalid credentials", "last_successful_retrieve":null }, "destination":{ "connection":"candlepin.company.com", "status":"failure", "message":"ConnectionRefusedError: [Errno 111] Connection refused", "last_successful_send":null, "last_successful_send_job_status":null } } ] } virt-who --debug --one-shot --config /tmp/ conf_name .conf #virt-who --debug --status --config /tmp/conf_name.conf #virt-who --debug --status --json --config /tmp/conf_name.conf systemctl stop virt-who virt-who -op >/tmp/virt-who.json systemctl start virt-who cat /tmp/virt-who.json | json_reformat | grep name | sort | uniq -c | sort -nr | head -n10 3 "name": "localhost" 1 "name": "rhel1.example.com" 1 "name": "rhel2.example.com" 1 "name": "rhel3.example.com" 1 "name": "rhel4.example.com" 1 "name": "rhvh1.example.com" 1 "name": "rhvh2.example.com" 1 "name": "rhvh3.example.com" 1 "name": "rhvh4.example.com" 1 "name": "rhvh5.example.com" systemctl stop virt-who virt-who -op >/tmp/virt-who.json systemctl start virt-who cat /tmp/virt-who.json | json_reformat | grep "guestId" | sort | uniq -c | sort -nr | head -n10 systemctl stop virt-who virt-who -op >/tmp/virt-who.json systemctl start virt-who cat /tmp/virt-who.json | json_reformat | grep name | sort | uniq -c | wc -l virt-who --status --json systemctl stop virt-who virt-who -op >/tmp/virt-who.json systemctl start virt-who cat /tmp/virt-who.json | json_reformat | grep "guestId" | sort | uniq -c | wc -l virt-who --status --json [system_environment] no_proxy=* subscription-manager list --consumed +-------------------------------------------+ Consumed Product Subscriptions +-------------------------------------------+ ProductName: Red Hat Enterprise Linux Server ContractNumber: 1458961 SerialNumber: 171286550006020205 Active: True Begins: 2009-01-01 Expires: 2011-12-31 subscription-manager list --available --all +-------------------------------------------+ Available Subscriptions +-------------------------------------------+ ProductName: RHEL for Physical Servers ProductId: MKT-rhel-server PoolId: ff8080812bc382e3012bc3845ca000cb Quantity: 10 Expires: 2011-09-20 ProductName: RHEL Workstation ProductId: MKT-rhel-workstation-mkt PoolId: 5e09a31f95885cc4 Quantity: 10 Expires: 2011-09-20 subscription-manager syspurpose role --list subscription-manager syspurpose role --list --username=<username> --password=<password> --organization=<organization_ID> --token=<token> +-------------------------------------------+ Available role +-------------------------------------------+ - Red Hat Enterprise Linux Workstation - Red Hat Enterprise Linux Server - Red Hat Enterprise Linux Compute Node subscription-manager syspurpose addons --list There are no available values for the system purpose "addons" from the available subscriptions in this organization. subscription-manager syspurpose role --set="foo" subscription-manager syspurpose role --set="foo" --username=<username> --password=<password> --organization=<organization_ID> --token=<token> Warning: Provided value "foo" is not included in the list of valid values - Red Hat Enterprise Linux Workstation - Red Hat Enterprise Linux Server - Red Hat Enterprise Linux Compute Node role set to "foo". rm -f /var/lib/rhsm/packages/packages.json service rhsmcertd stop rhsmcertd --now yum update