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=Spacewalk Satellite
- 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=Spacewalk Satellite
- 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=Red Hat Enterprise Linux $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 -y install spacewalk-postgresql
Configure postgreSQL database
You will need to become the operating system user under which PostgreSQL was installed (usually postgres) to create the first user account. It could also be that you were assigned a PostgreSQL user name that is different from your operating system user name.By default,postgreSQL has already created a user postgres.
- [root@sate ~]# id -a postgres
- uid=26(postgres) gid=26(postgres) groups=26(postgres)
1.Create database and user:
Before you do,you must initialize postgrsql and start it by following command.
- [root@sate ~]# service postgresql initdb
- Initializing database: [ OK ]
- [root@sate ~]# service postgresql start
- Starting postgresql service: [ OK ]
- [root@sate ~]# su - postgres
- -bash-4.1$ PGPASSWORD=redhat //Set the spaceuser's password
- -bash-4.1$ createdb spacewalk //Create database
- -bash-4.1$ createlang plpgsql spacewalk
- -bash-4.1$ createuser -P -sDR spaceuser //Create user
- Enter password for new role:
- Enter it again:
2.Append following contents to /var/lib/pgsql/data/pg_hba.conf:
- host all all 172.16.255.0/24 trust
3.Append following lines to /var/lib/pgsql/data/psotgresql.conf:
- listen_addresses = '*'
4.Restart postgresql service:
- [root@sate ~]# service postgresql restart
- Stopping postgresql service: [ OK ]
- Starting postgresql service: [ OK ]
5.Connect to spacewalk database:
- [root@sate ~]# su - postgres
- postgres=# \c spacewalk
- psql (8.4.9)
- You are now connected to database "spacewalk".
- spacewalk=#
- spacewalk=# \db
- List of tablespaces
- Name | Owner | Location
- ------------+----------+----------
- pg_default | postgres |
- pg_global | postgres |
- (2 rows)
Configure Spacewalk by spacewalk-setup command
- [root@sate ~]# spacewalk-setup --disconnected
- ** Database: Setting up database connection for PostgreSQL backend.
- Hostname (leave empty for local)? sate.xzxj.edu.cn
- Port [5432]?
- Database? spacewalk
- Username? spaceuser
- Password?
- *** Progress: ##################################
- * Setting up users and groups.
- ** GPG: Initializing GPG and importing key.
- You must enter an email address.
- Admin Email Address? root@localhost
- * Performing initial configuration.
- * Activating Spacewalk.
- ** Loading Spacewalk Certificate.
- ** Verifying certificate locally.
- ** Activating Spacewalk.
- * Enabling Monitoring.
- * Configuring apache SSL virtual host.
- Should setup configure apache's default ssl server for you (saves original ssl.conf) [Y]?
- * Configuring tomcat.
- ** /etc/tomcat6/server.xml has been backed up to server.xml-swsave
- Reversed (or previously applied) patch detected! Skipping patch.
- 1 out of 1 hunk ignored -- saving rejects to file web.xml.rej
- * Configuring jabberd.
- * Creating SSL certificates.
- CA certificate password?
- Re-enter CA certificate password?
- Organization? xzxj
- Organization Unit [sate.xzxj.edu.cn]?
- Email Address [root@localhost]?
- City? ShangHai
- State? ShangHai
- Country code (Examples: "US", "JP", "IN", or type "?" to see a list)? CN
- ** SSL: Generating CA certificate.
- ** SSL: Deploying CA certificate.
- ** SSL: Generating server certificate.
- ** SSL: Storing SSL certificates.
- * Deploying configuration files.
- * Update configuration in database.
- * Setting up Cobbler..
- cobblerd does not appear to be running/accessible
- Cobbler requires tftp and xinetd services be turned on for PXE provisioning functionality. Enable these services [Y]?
- cobblerd does not appear to be running/accessible
- * Restarting services.
- Installation complete.
- Visit https://sate.xzxj.edu.cn to create the Spacewalk administrator account.
Check Spacewalk service
- [root@sate ~]# spacewalk-service status
- router (pid 16795) is running...
- sm (pid 16802) is running...
- c2s (pid 16809) is running...
- s2s (pid 16816) is running...
- osa-dispatcher (pid 16832) is running...
- tomcat6 (pid 16901) is running...[ OK ]
- httpd (pid 17126) is running...
- 2012-03-09 18:41:43 Monitoring: ----------- InstallSoftwareConfig STATUS ---------------
- 2012-03-09 18:41:44 Monitoring: ----------- NotifEscalator STATUS ---------------
- 2012-03-09 18:41:46 Monitoring: ----------- GenerateNotifConfig STATUS ---------------
- 2012-03-09 18:41:47 Monitoring: ----------- NotifLauncher STATUS ---------------
- 2012-03-09 18:41:49 Monitoring: ----------- Notifier STATUS ---------------
- 2012-03-09 18:41:54 Monitoring: ----------- AckProcessor STATUS ---------------
- 2012-03-09 18:41:55 Monitoring: ----------- TSDBLocalQueue STATUS ---------------
- 2012-03-09 18:42:02 MonitoringScout: ----------- InstallSoftwareConfig STATUS ---------------
- rhn-search is running (17338).
- cobblerd (pid 17393) is running...
- RHN Taskomatic is running (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$ psql spacewalk
- psql (8.4.9)
- Type "help" for help.
- spacewalk=# \dt
- List of relations
- 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
- ............
- (383 rows)
2.List views:
- spacewalk=# \dv
- List of relations
- 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
- ..........
- (58 rows)
3.List roles:
- spacewalk=# \dg
- List of roles
- Role name | Attributes | Member of
- -----------+-------------+-----------
- postgres | Superuser | {}
- : Create role
- : Create DB
- spaceuser | Superuser | {}
- : Create role
- : Create DB
4.Display table info:
- spacewalk-# \d rhnpackage
- Table "public.rhnpackage"
- Column | Type | Modifiers
- -----------------+-----------------------------+------------------------
- id | numeric | not null
- org_id | numeric |
- name_id | numeric | not null
- evr_id | numeric | not null
- package_arch_id | numeric | not null
- package_group | numeric |
- rpm_version | character varying(16) |
- description | character varying(4000) |
- summary | character varying(4000) |
- package_size | numeric | not null
- payload_size | numeric |
- build_host | character varying(256) |
- build_time | timestamp without time zone |
- source_rpm_id | numeric |
- checksum_id | numeric | not null
- vendor | character varying(64) | not null
- payload_format | character varying(32) |
- compat | smallint | default 0
- path | character varying(1000) |
- header_sig | character varying(64) |
- copyright | character varying(128) |
- cookie | character varying(128) |
- last_modified | timestamp with time zone | not null default now()
- created | timestamp with time zone | not null default now()
- modified | timestamp with time zone | not null default now()
- header_start | numeric | not null default (-1)
- header_end | numeric | not null default (-1)
- ................
- spacewalk-#
5.Query table:
- spacewalk=# select count(*) from rhnpackage;
- count
- -------
- 4812
- (1 row)
- spacewalk=# select *from rhn_os;
- recid | os_name
- -------+--------------
- 4 | Linux System
- 14 | Satellite
- (2 rows)
For more infomation about postgreSQL from following links:
1.PostgreSQL 8.4.11 Documentation
2.PostgreSQL examples