This article will show you how to integrate spacewalk 1.7 with postgresql.Before you do,you must configure yum repository.Append following lines to your file:
- [Satellite]
- name=SpacewalkSatellite
- baseurl=http://spacewalk.redhat.com/yum/1.7/RHEL/6/x86_64/
- enabled=1
- gpgcheck=1
- gpgkey=http://spacewalk.redhat.com/yum/RPM-GPG-KEY-spacewalk-2012
- [Satellite-Client]
- name=SpacewalkSatellite
- baseurl=http://spacewalk.redhat.com/yum/1.7-client/RHEL/6/x86_64/
- enabled=1
- gpgcheck=1
- gpgkey=http://spacewalk.redhat.com/yum/RPM-GPG-KEY-spacewalk-2012
- [epel]
- name=RedHatEnterpriseLinux$releasever-$basearch-Debug
- baseurl=http://dl.fedoraproject.org/pub/epel/6/x86_64/
- enabled=1
- gpgcheck=1
- gpgkey=http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6
- [Centos]
- name=Centos
- baseurl=http://mirrors.163.com/centos/6.2/os/x86_64/
- enabled=1
- gpgcheck=1
- gpgkey=http://mirrors.163.com/centos/6.2/os/x86_64/RPM-GPG-KEY-CentOS-6
- [Centos-Update]
- name=Centos
- baseurl=http://mirrors.163.com/centos/6.2/updates/x86_64/
- enabled=1
- gpgcheck=1
- gpgkey=http://mirrors.163.com/centos/6.2/os/x86_64/RPM-GPG-KEY-CentOS-6
- [Jpackes]
- name=jpackage
- baseurl=http://mirrors.dotsrc.org/jpackage/5.0/generic/free/
- enabled=1
- gpgcheck=1
After,use following command to install spacewalk:
- yum-yinstallspacewalk-postgresql
Configure postgresql database
You will need to becomethe operating system user under which Postgresql was installed (usually postgres) to create the firstuser account. It could also be that you were assigned a Postgresql user name that is different from youroperating system user name.By default,postgresql has already created a user postgres.
- [root@sate~]#id-apostgres
- uid=26(postgres)gid=26(postgres)groups=26(postgres)
1.Create database and user:
Before you do,you mustinitialize postgrsql and start it by following command.
- [root@sate~]#su-postgres
- -bash-4.1$PGPASSWORD=redhat //Set the spaceuser's password
- -bash-4.1$createdbspacewalk //Create database
- -bash-4.1$createlangplpgsqlspacewalk
- -bash-4.1$createuser-P-sDRspaceuser //Create user
- Enterpasswordfornewrole:
- Enteritagain:
2.Append following contents to /var/lib/pgsql/data/pg_hba.conf:
- hostallall172.16.255.0/24trust
3.Append following lines to /var/lib/pgsql/data/psotgresql.conf:
- listen_addresses='*'
4.Restart postgresql service:
5.Connect to spacewalk database:
- [root@sate~]#su-postgres
- postgres=#\cspacewalk
- psql(8.4.9)
- Youarenowconnectedtodatabase"spacewalk".
- spacewalk=#
- spacewalk=#\db
- Listoftablespaces
- Name|Owner|Location
- ------------+----------+----------
- pg_default|postgres|
- pg_global|postgres|
- (2rows)
Configure Spacewalk by spacewalk-setup command
- [root@sate~]#spacewalk-setup--disconnected
- **Database:SettingupdatabaseconnectionforPostgresqlbackend.
- Hostname(leaveemptyforlocal)?sate.xzxj.edu.cn
- Port[5432]?
- Database?spacewalk
- Username?spaceuser
- Password?
- ***Progress:##################################
- *Settingupusersandgroups.
- **GPG:InitializingGPGandimportingkey.
- Youmustenteranemailaddress.
- AdminEmailAddress?root@localhost
- *Performinginitialconfiguration.
- *ActivatingSpacewalk.
- **LoadingSpacewalkCertificate.
- **Verifyingcertificatelocally.
- **ActivatingSpacewalk.
- *EnablingMonitoring.
- *ConfiguringapacheSSLvirtualhost.
- Shouldsetupconfigureapache'sdefaultsslserverforyou(savesoriginalssl.conf)[Y]?
- *Configuringtomcat.
- **/etc/tomcat6/server.xmlhasbeenbackeduptoserver.xml-swsave
- Reversed(orprevIoUslyapplied)patchdetected!Skippingpatch.
- 1outof1hunkignored--savingrejectstofileweb.xml.rej
- *Configuringjabberd.
- *CreatingSSLcertificates.
- CAcertificatepassword?
- Re-enterCAcertificatepassword?
- Organization?xzxj
- OrganizationUnit[sate.xzxj.edu.cn]?
- EmailAddress[root@localhost]?
- City?ShangHai
- State?ShangHai
- Countrycode(Examples:"US","JP","IN",ortype"?"toseealist)?CN
- **SSL:GeneratingCAcertificate.
- **SSL:DeployingCAcertificate.
- **SSL:Generatingservercertificate.
- **SSL:StoringSSLcertificates.
- *Deployingconfigurationfiles.
- *Updateconfigurationindatabase.
- *SettingupCobbler..
- cobblerddoesnotappeartoberunning/accessible
- CobblerrequirestftpandxinetdservicesbeturnedonforPXEprovisioningfunctionality.Enabletheseservices[Y]?
- cobblerddoesnotappeartoberunning/accessible
- *Restartingservices.
- Installationcomplete.
- Visithttps://sate.xzxj.edu.cntocreatetheSpacewalkadministratoraccount.
Check Spacewalk service
- [root@sate~]#spacewalk-servicestatus
- router(pid16795)isrunning...
- sm(pid16802)isrunning...
- c2s(pid16809)isrunning...
- s2s(pid16816)isrunning...
- osa-dispatcher(pid16832)isrunning...
- tomcat6(pid16901)isrunning...[OK]
- httpd(pid17126)isrunning...
- 2012-03-0918:41:43Monitoring:-----------InstallSoftwareConfigSTATUS---------------
- 2012-03-0918:41:44Monitoring:-----------NotifEscalatorSTATUS---------------
- 2012-03-0918:41:46Monitoring:-----------GenerateNotifConfigSTATUS---------------
- 2012-03-0918:41:47Monitoring:-----------NotifLauncherSTATUS---------------
- 2012-03-0918:41:49Monitoring:-----------NotifierSTATUS---------------
- 2012-03-0918:41:54Monitoring:-----------AckProcessorSTATUS---------------
- 2012-03-0918:41:55Monitoring:-----------TSDBLocalQueueSTATUS---------------
- 2012-03-0918:42:02MonitoringScout:-----------InstallSoftwareConfigSTATUS---------------
- rhn-searchisrunning(17338).
- cobblerd(pid17393)isrunning...
- RHNTaskomaticisrunning(17451).
Create the Spacewalk administrator account
After created,use administrator account to access:
View Database information
1.List tables:
- [root@sate~]#su-postgres
- -bash-4.1$psqlspacewalk
- psql(8.4.9)
- Type"help"forhelp.
- spacewalk=#\dt
- Listofrelations
- Schema|Name|Type|Owner
- --------+--------------------------------+-------+-----------
- public|dual|table|spaceuser
- public|pxtsessions|table|spaceuser
- public|qrtz_blob_triggers|table|spaceuser
- public|qrtz_calendars|table|spaceuser
- public|qrtz_cron_triggers|table|spaceuser
- public|qrtz_fired_triggers|table|spaceuser
- public|qrtz_job_details|table|spaceuser
- public|qrtz_job_listeners|table|spaceuser
- public|qrtz_locks|table|spaceuser
- public|qrtz_paused_trigger_grps|table|spaceuser
- public|qrtz_scheduler_state|table|spaceuser
- public|qrtz_simple_triggers|table|spaceuser
- public|qrtz_trigger_listeners|table|spaceuser
- public|qrtz_triggers|table|spaceuser
- public|rhn_check_probe|table|spaceuser
- public|rhn_check_suite_probe|table|spaceuser
- public|rhn_check_suites|table|spaceuser
- public|rhn_command|table|spaceuser
- public|rhn_command_class|table|spaceuser
- public|rhn_command_groups|table|spaceuser
- public|rhn_command_param_threshold|table|spaceuser
- public|rhn_command_parameter|table|spaceuser
- public|rhn_command_queue_commands|table|spaceuser
- public|rhn_command_queue_execs|table|spaceuser
- public|rhn_command_queue_instances|table|spaceuser
- public|rhn_command_queue_params|table|spaceuser
- public|rhn_command_queue_sessions|table|spaceuser
- public|rhn_command_requirements|table|spaceuser
- public|rhn_command_target|table|spaceuser
- public|rhn_config_group|table|spaceuser
- public|rhn_config_macro|table|spaceuser
- public|rhn_config_parameter|table|spaceuser
- public|rhn_config_security_type|table|spaceuser
- public|rhn_contact_group_members|table|spaceuser
- public|rhn_contact_groups|table|spaceuser
- public|rhn_contact_methods|table|spaceuser
- public|rhn_current_state_summaries|table|spaceuser
- public|rhn_deployed_probe|table|spaceuser
- public|rhn_host_probe|table|spaceuser
- public|rhn_ll_netsaint|table|spaceuser
- public|rhn_method_types|table|spaceuser
- public|rhn_metrics|table|spaceuser
- public|rhn_multi_scout_threshold|table|spaceuser
- public|rhn_notification_formats|table|spaceuser
- ............
- (383rows)
2.List views:
- spacewalk=#\dv
- Listofrelations
- Schema|Name|Type|Owner
- --------+--------------------------------+------+-----------
- public|all_primary_keys|view|spaceuser
- public|all_tab_columns|view|spaceuser
- public|rhn_contact_monitoring|view|spaceuser
- public|rhn_customer_monitoring|view|spaceuser
- public|rhn_host_monitoring|view|spaceuser
- public|rhnactionoverview|view|spaceuser
- public|rhnavailablechannels|view|spaceuser
- public|rhncddevice|view|spaceuser
- public|rhnchannelfamilyoverview|view|spaceuser
- public|rhnchannelfamilypermissions|view|spaceuser
- public|rhnchannelfamilyserverfve|view|spaceuser
- public|rhnchannelfamilyserverphysical|view|spaceuser
- public|rhnchannelfamilyservers|view|spaceuser
- public|rhnchannelfamilyservervirtual|view|spaceuser
- public|rhnchannelnewestpackageview|view|spaceuser
- public|rhnchannelpermissions|view|spaceuser
- public|rhnchanneltreeview|view|spaceuser
- public|rhnchecksumview|view|spaceuser
- public|rhnentitledservers|view|spaceuser
- public|rhnhwdevice|view|spaceuser
- public|rhnorgchannelfamilypermissions|view|spaceuser
- public|rhnorgchanneltreeview|view|spaceuser
- public|rhnorgerrata|view|spaceuser
- public|rhnpackagechangelog|view|spaceuser
- public|rhnserverentitlementphysical|view|spaceuser
- public|rhnserverentitlementview|view|spaceuser
- public|rhnserverentitlementvirtual|view|spaceuser
- public|rhnservererratatypeview|view|spaceuser
- public|rhnserverfeaturesview|view|spaceuser
- public|rhnserverfvecapable|view|spaceuser
- public|rhnservergroupmembership|view|spaceuser
- public|rhnservergroupoverview|view|spaceuser
- public|rhnservergroupovlitehelper|view|spaceuser
- public|rhnserverneedederratacache|view|spaceuser
- public|rhnserverneededpackagecache|view|spaceuser
- public|rhnserverneededview|view|spaceuser
- ..........
- (58rows)
3.List roles:
- spacewalk=#\dg
- Listofroles
- Rolename|Attributes|Memberof
- -----------+-------------+-----------
- postgres|Superuser|{}
- :Createrole
- :CreateDB
- spaceuser|Superuser|{}
- :Createrole
- :CreateDB
4.Display table info:
- spacewalk-#\drhnpackage
- Table"public.rhnpackage"
- Column|Type|Modifiers
- -----------------+-----------------------------+------------------------
- id|numeric|notnull
- org_id|numeric|
- name_id|numeric|notnull
- evr_id|numeric|notnull
- package_arch_id|numeric|notnull
- package_group|numeric|
- rpm_version|charactervarying(16)|
- description|charactervarying(4000)|
- summary|charactervarying(4000)|
- package_size|numeric|notnull
- payload_size|numeric|
- build_host|charactervarying(256)|
- build_time|timestampwithouttimezone|
- source_rpm_id|numeric|
- checksum_id|numeric|notnull
- vendor|charactervarying(64)|notnull
- payload_format|charactervarying(32)|
- compat|smallint|default0
- path|charactervarying(1000)|
- header_sig|charactervarying(64)|
- copyright|charactervarying(128)|
- cookie|charactervarying(128)|
- last_modified|timestampwithtimezone|notnulldefaultnow()
- created|timestampwithtimezone|notnulldefaultnow()
- modified|timestampwithtimezone|notnulldefaultnow()
- header_start|numeric|notnulldefault(-1)
- header_end|numeric|notnulldefault(-1)
- ................
- spacewalk-#
5.Query table:
- spacewalk=#selectcount(*)fromrhnpackage;
- count
- -------
- 4812
- (1row)
- spacewalk=#select*fromrhn_os;
- recid|os_name
- -------+--------------
- 4|LinuxSystem
- 14|Satellite
- (2rows)
For more infomation about postgresql from following links:
原文链接:https://www.f2er.com/postgresql/196666.html