微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Spacewalk 1.7 With PostgreSQL

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:

 
 
  1. [Satellite]
  2. name=SpacewalkSatellite
  3. baseurl=http://spacewalk.redhat.com/yum/1.7/RHEL/6/x86_64/
  4. enabled=1
  5. gpgcheck=1
  6. gpgkey=http://spacewalk.redhat.com/yum/RPM-GPG-KEY-spacewalk-2012
  7. [Satellite-Client]
  8. name=SpacewalkSatellite
  9. baseurl=http://spacewalk.redhat.com/yum/1.7-client/RHEL/6/x86_64/
  10. enabled=1
  11. gpgcheck=1
  12. gpgkey=http://spacewalk.redhat.com/yum/RPM-GPG-KEY-spacewalk-2012
  13. [epel]
  14. name=RedHatEnterpriseLinux$releasever-$basearch-Debug
  15. baseurl=http://dl.fedoraproject.org/pub/epel/6/x86_64/
  16. enabled=1
  17. gpgcheck=1
  18. gpgkey=http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6
  19. [Centos]
  20. name=Centos
  21. baseurl=http://mirrors.163.com/centos/6.2/os/x86_64/
  22. enabled=1
  23. gpgcheck=1
  24. gpgkey=http://mirrors.163.com/centos/6.2/os/x86_64/RPM-GPG-KEY-CentOS-6
  25. [Centos-Update]
  26. name=Centos
  27. baseurl=http://mirrors.163.com/centos/6.2/updates/x86_64/
  28. enabled=1
  29. gpgcheck=1
  30. gpgkey=http://mirrors.163.com/centos/6.2/os/x86_64/RPM-GPG-KEY-CentOS-6
  31. [Jpackes]
  32. name=jpackage
  33. baseurl=http://mirrors.dotsrc.org/jpackage/5.0/generic/free/
  34. enabled=1
  35. gpgcheck=1

After,use following command to install spacewalk:

 
 
  1. 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.

 
 
  1. [root@sate~]#id-apostgres
  2. 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.

 
 
  1. [root@sate~]#servicepostgresqlinitdb
  2. Initializingdatabase:[OK]
  3. [root@sate~]#servicepostgresqlstart
  4. Startingpostgresqlservice:[OK]
 
 
  1. [root@sate~]#su-postgres
  2. -bash-4.1$PGPASSWORD=redhat //Set the spaceuser's password
  3. -bash-4.1$createdbspacewalk //Create database
  4. -bash-4.1$createlangplpgsqlspacewalk
  5. -bash-4.1$createuser-P-sDRspaceuser //Create user
  6. Enterpasswordfornewrole:
  7. Enteritagain:

2.Append following contents to /var/lib/pgsql/data/pg_hba.conf:

 
 
  1. hostallall172.16.255.0/24trust

3.Append following lines to /var/lib/pgsql/data/psotgresql.conf:

 
 
  1. listen_addresses='*'

4.Restart postgresql service:

 
 
  1. [root@sate~]#servicepostgresqlrestart
  2. Stoppingpostgresqlservice:[OK]
  3. Startingpostgresqlservice:[OK]

5.Connect to spacewalk database:

 
 
  1. [root@sate~]#su-postgres
  2. postgres=#\cspacewalk
  3. psql(8.4.9)
  4. YouareNowconnectedtodatabase"spacewalk".
  5. spacewalk=#
  6. spacewalk=#\db
  7. listoftablespaces
  8. Name|Owner|Location
  9. ------------+----------+----------
  10. pg_default|postgres|
  11. pg_global|postgres|
  12. (2rows)

Configure Spacewalk by spacewalk-setup command

 
 
  1. [root@sate~]#spacewalk-setup--disconnected
  2. **Database:SettingupdatabaseconnectionforPostgresqlbackend.
  3. Hostname(leaveemptyforlocal)?sate.xzxj.edu.cn
  4. Port[5432]?
  5. Database?spacewalk
  6. Username?spaceuser
  7. Password?
  8. ***Progress:##################################
  9. *Settingupusersandgroups.
  10. **GPG:InitializingGPGandimportingkey.
  11. Youmustenteranemailaddress.
  12. AdminemailAddress?root@localhost
  13. *Performinginitialconfiguration.
  14. *ActivatingSpacewalk.
  15. **LoadingSpacewalkCertificate.
  16. **Verifyingcertificatelocally.
  17. **ActivatingSpacewalk.
  18. *EnablingMonitoring.
  19. *ConfiguringapacheSSLvirtualhost.
  20. Shouldsetupconfigureapache'sdefaultsslserverforyou(savesoriginalssl.conf)[Y]?
  21. *Configuringtomcat.
  22. **/etc/tomcat6/server.xmlhasbeenbackeduptoserver.xml-swsave
  23. Reversed(orprevIoUslyapplied)patchdetected!Skippingpatch.
  24. 1outof1hunkignored--savingrejectstofileweb.xml.rej
  25. *Configuringjabberd.
  26. *CreatingSSLcertificates.
  27. CAcertificatepassword?
  28. Re-enterCAcertificatepassword?
  29. Organization?xzxj
  30. OrganizationUnit[sate.xzxj.edu.cn]?
  31. EmailAddress[root@localhost]?
  32. City?ShangHai
  33. State?ShangHai
  34. Countrycode(Examples:"US","JP","IN",ortype"?"toseealist)?CN
  35. **SSL:GeneratingCAcertificate.
  36. **SSL:deployingCAcertificate.
  37. **SSL:Generatingservercertificate.
  38. **SSL:StoringSSLcertificates.
  39. *deployingconfigurationfiles.
  40. *Updateconfigurationindatabase.
  41. *SettingupCobbler..
  42. cobblerddoesnotappeartoberunning/accessible
  43. CobblerrequirestftpandxinetdservicesbeturnedonforPXEprovisioningfunctionality.Enabletheseservices[Y]?
  44. cobblerddoesnotappeartoberunning/accessible
  45. *Restartingservices.
  46. Installationcomplete.
  47. Visithttps://sate.xzxj.edu.cntocreatetheSpacewalkadministratoraccount.

Check Spacewalk service

 
 
  1. [root@sate~]#spacewalk-servicestatus
  2. router(pid16795)isrunning...
  3. sm(pid16802)isrunning...
  4. c2s(pid16809)isrunning...
  5. s2s(pid16816)isrunning...
  6. osa-dispatcher(pid16832)isrunning...
  7. tomcat6(pid16901)isrunning...[OK]
  8. httpd(pid17126)isrunning...
  9. 2012-03-0918:41:43Monitoring:-----------InstallSoftwareConfigSTATUS---------------
  10. 2012-03-0918:41:44Monitoring:-----------NotifEscalatorSTATUS---------------
  11. 2012-03-0918:41:46Monitoring:-----------GenerateNotifConfigSTATUS---------------
  12. 2012-03-0918:41:47Monitoring:-----------NotifLauncherSTATUS---------------
  13. 2012-03-0918:41:49Monitoring:-----------NotifierSTATUS---------------
  14. 2012-03-0918:41:54Monitoring:-----------AckProcessorSTATUS---------------
  15. 2012-03-0918:41:55Monitoring:-----------TSDBLocalQueueSTATUS---------------
  16. 2012-03-0918:42:02MonitoringScout:-----------InstallSoftwareConfigSTATUS---------------
  17. rhn-searchisrunning(17338).
  18. cobblerd(pid17393)isrunning...
  19. RHNTaskomaticisrunning(17451).

Create the Spacewalk administrator account

image

After created,use administrator account to access:

image

image

View Database @R_414_4045@ion

1.List tables:

 
 
  1. [root@sate~]#su-postgres
  2. -bash-4.1$psqlspacewalk
  3. psql(8.4.9)
  4. Type"help"forhelp.
  5. spacewalk=#\dt
  6. Listofrelations
  7. Schema|Name|Type|Owner
  8. --------+--------------------------------+-------+-----------
  9. public|dual|table|spaceuser
  10. public|pxtsessions|table|spaceuser
  11. public|qrtz_blob_triggers|table|spaceuser
  12. public|qrtz_calendars|table|spaceuser
  13. public|qrtz_cron_triggers|table|spaceuser
  14. public|qrtz_fired_triggers|table|spaceuser
  15. public|qrtz_job_details|table|spaceuser
  16. public|qrtz_job_listeners|table|spaceuser
  17. public|qrtz_locks|table|spaceuser
  18. public|qrtz_paused_trigger_grps|table|spaceuser
  19. public|qrtz_scheduler_state|table|spaceuser
  20. public|qrtz_simple_triggers|table|spaceuser
  21. public|qrtz_trigger_listeners|table|spaceuser
  22. public|qrtz_triggers|table|spaceuser
  23. public|rhn_check_probe|table|spaceuser
  24. public|rhn_check_suite_probe|table|spaceuser
  25. public|rhn_check_suites|table|spaceuser
  26. public|rhn_command|table|spaceuser
  27. public|rhn_command_class|table|spaceuser
  28. public|rhn_command_groups|table|spaceuser
  29. public|rhn_command_param_threshold|table|spaceuser
  30. public|rhn_command_parameter|table|spaceuser
  31. public|rhn_command_queue_commands|table|spaceuser
  32. public|rhn_command_queue_execs|table|spaceuser
  33. public|rhn_command_queue_instances|table|spaceuser
  34. public|rhn_command_queue_params|table|spaceuser
  35. public|rhn_command_queue_sessions|table|spaceuser
  36. public|rhn_command_requirements|table|spaceuser
  37. public|rhn_command_target|table|spaceuser
  38. public|rhn_config_group|table|spaceuser
  39. public|rhn_config_macro|table|spaceuser
  40. public|rhn_config_parameter|table|spaceuser
  41. public|rhn_config_security_type|table|spaceuser
  42. public|rhn_contact_group_members|table|spaceuser
  43. public|rhn_contact_groups|table|spaceuser
  44. public|rhn_contact_methods|table|spaceuser
  45. public|rhn_current_state_summaries|table|spaceuser
  46. public|rhn_deployed_probe|table|spaceuser
  47. public|rhn_host_probe|table|spaceuser
  48. public|rhn_ll_netsaint|table|spaceuser
  49. public|rhn_method_types|table|spaceuser
  50. public|rhn_metrics|table|spaceuser
  51. public|rhn_multi_scout_threshold|table|spaceuser
  52. public|rhn_notification_formats|table|spaceuser
  53. ............
  54. (383rows)

2.List views:

 
 
  1. spacewalk=#\dv
  2. Listofrelations
  3. Schema|Name|Type|Owner
  4. --------+--------------------------------+------+-----------
  5. public|all_primary_keys|view|spaceuser
  6. public|all_tab_columns|view|spaceuser
  7. public|rhn_contact_monitoring|view|spaceuser
  8. public|rhn_customer_monitoring|view|spaceuser
  9. public|rhn_host_monitoring|view|spaceuser
  10. public|rhnactionoverview|view|spaceuser
  11. public|rhnavailablechannels|view|spaceuser
  12. public|rhncddevice|view|spaceuser
  13. public|rhnchannelfamilyoverview|view|spaceuser
  14. public|rhnchannelfamilypermissions|view|spaceuser
  15. public|rhnchannelfamilyserverfve|view|spaceuser
  16. public|rhnchannelfamilyserverphysical|view|spaceuser
  17. public|rhnchannelfamilyservers|view|spaceuser
  18. public|rhnchannelfamilyservervirtual|view|spaceuser
  19. public|rhnchannelnewestpackageview|view|spaceuser
  20. public|rhnchannelpermissions|view|spaceuser
  21. public|rhnchanneltreeview|view|spaceuser
  22. public|rhnchecksumview|view|spaceuser
  23. public|rhnentitledservers|view|spaceuser
  24. public|rhnhwdevice|view|spaceuser
  25. public|rhnorgchannelfamilypermissions|view|spaceuser
  26. public|rhnorgchanneltreeview|view|spaceuser
  27. public|rhnorgerrata|view|spaceuser
  28. public|rhnpackagechangelog|view|spaceuser
  29. public|rhnserverentitlementphysical|view|spaceuser
  30. public|rhnserverentitlementview|view|spaceuser
  31. public|rhnserverentitlementvirtual|view|spaceuser
  32. public|rhnservererratatypeview|view|spaceuser
  33. public|rhnserverfeaturesview|view|spaceuser
  34. public|rhnserverfvecapable|view|spaceuser
  35. public|rhnservergroupmembership|view|spaceuser
  36. public|rhnservergroupoverview|view|spaceuser
  37. public|rhnservergroupovlitehelper|view|spaceuser
  38. public|rhnserverneedederratacache|view|spaceuser
  39. public|rhnserverneededpackagecache|view|spaceuser
  40. public|rhnserverneededview|view|spaceuser
  41. ..........
  42. (58rows)

3.List roles:

 
 
  1. spacewalk=#\dg
  2. Listofroles
  3. Rolename|Attributes|Memberof
  4. -----------+-------------+-----------
  5. postgres|Superuser|{}
  6. :Createrole
  7. :CreateDB
  8. spaceuser|Superuser|{}
  9. :Createrole
  10. :CreateDB

4.display table info:

 
 
  1. spacewalk-#\drhnpackage
  2. Table"public.rhnpackage"
  3. Column|Type|Modifiers
  4. -----------------+-----------------------------+------------------------
  5. id|numeric|notnull
  6. org_id|numeric|
  7. name_id|numeric|notnull
  8. evr_id|numeric|notnull
  9. package_arch_id|numeric|notnull
  10. package_group|numeric|
  11. rpm_version|charactervarying(16)|
  12. description|charactervarying(4000)|
  13. summary|charactervarying(4000)|
  14. package_size|numeric|notnull
  15. payload_size|numeric|
  16. build_host|charactervarying(256)|
  17. build_time|timestampwithouttimezone|
  18. source_rpm_id|numeric|
  19. checksum_id|numeric|notnull
  20. vendor|charactervarying(64)|notnull
  21. payload_format|charactervarying(32)|
  22. compat|smallint|default0
  23. path|charactervarying(1000)|
  24. header_sig|charactervarying(64)|
  25. copyright|charactervarying(128)|
  26. cookie|charactervarying(128)|
  27. last_modified|timestampwithtimezone|notnulldefaultNow()
  28. created|timestampwithtimezone|notnulldefaultNow()
  29. modified|timestampwithtimezone|notnulldefaultNow()
  30. header_start|numeric|notnulldefault(-1)
  31. header_end|numeric|notnulldefault(-1)
  32. ................
  33. spacewalk-#

5.Query table:

 
 
  1. spacewalk=#selectcount(*)fromrhnpackage;
  2. count
  3. -------
  4. 4812
  5. (1row)
  6. spacewalk=#select*fromrhn_os;
  7. recid|os_name
  8. -------+--------------
  9. 4|LinuxSystem
  10. 14|Satellite
  11. (2rows)

For more infomation about postgresql from following links:

1.PostgreSQL 8.4.11 Documentation

2.PostgreSQL examples

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐