Spacewalk - How To
8:20 PMSpacewalk
Below is an example of spacewalk installation. In this scenario we have used RHEL5 and for database its a oracle 11G database in RAC. I have used installation procedures listed here(https://fedorahosted.org/spacewalk/wiki/HowToInstall?) and will also add steps which are not listed in the url. In our case we have stopped iptables. For spacewalk to work along with iptables check the documentation URL.Setting up Spacewalk repo for Red Hat Enterprise Linux 5:
rpm -Uvh http: //spacewalk.redhat.com/yum/1.5/RHEL/5/x86_64/spacewalk-repo-1.5-1.el5.noarch.rpm? |
rpm -Uvh http: //download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm |
There is an open bug 593402 that identifies the package cobbler-web as conflicting with Spacewalk's Taskomatic process. Until the issue is addressed, it is recommended that the cobbler-web package be removed from the Spacewalk server.
yum remove cobbler-web |
vi /etc/yum.conf [main] .... exclude=cobbler-web |
rpm -ivh oracle-instantclient11. 2 -basic- 11.2 . 0.2 . 0 .x86_64.rpm rpm -ivh oracle-instantclient11. 2 -sqlplus- 11.2 . 0.2 . 0 .x86_64.rpm or yum -y localinstall --nogpgcheck oracle-instantclient11. 2 -basic- 11.2 . 0.2 . 0 .x86_64.rpm yum -y localinstall --nogpgcheck oracle-instantclient11. 2 -sqlplus- 11.2 . 0.2 . 0 .x86_64.rpm |
Just ask yum to install the necessary packages. This will pull down and install the set of RPMs required to get Spacewalk to run.
If you tend to use the Oracle backend:
yum install spacewalk-oracle |
Navigate to /etc/sysconfig/rhn/oracle/ and take a copy of main.sql and from the redhat URL copy the patch in to a file, called for example patch_file.sql. The patch is given below
# diff -u main.sql.orig main.sql --- main.sql.orig 2011 - 04 - 08 21 : 40 : 53.000000000 + 0200 +++ main.sql 2011 - 05 - 31 09 : 47 : 44.000000000 + 0200 @@ - 12171 , 9 + 12171 , 29 @@ end; / +-- HERE FIX + +insert into rhnChecksum select * from rhnChecksum where 0 = 1 ; +insert into rhnClientCapabilityName select * from rhnClientCapabilityName where 0 = 1 ; +insert into rhnConfigFileName select * from rhnConfigFileName where 0 = 1 ; +insert into rhnConfigInfo select * from rhnConfigInfo where 0 = 1 ; +insert into rhnCve select * from rhnCve where 0 = 1 ; +insert into rhnPackageEvr select * from rhnPackageEvr where 0 = 1 ; +insert into rhnPackageCapability select * from rhnPackageCapability where 0 = 1 ; +insert into rhnPackageDelta select * from rhnPackageDelta where 0 = 1 ; +insert into rhnPackageName select * from rhnPackageName where 0 = 1 ; +insert into rhnPackageNEVRA select * from rhnPackageNEVRA where 0 = 1 ; +insert into rhnSourceRPM select * from rhnSourceRPM where 0 = 1 ; +insert into rhnTag select * from rhnTag where 0 = 1 ; +insert into rhnTagName select * from rhnTagName where 0 = 1 ; +insert into rhnTransactionPackage select * from rhnTransactionPackage where 0 = 1 ; + +commit; + -- Source: data/common/rhnArchType.sql - insert into rhnArchType (id, label, name) values + +insert into rhnArchType (id, label, name) values (sequence_nextval( 'rhn_archtype_id_seq' ), 'rpm' , 'RPM' ); insert into rhnArchType (id, label, name) values (sequence_nextval( 'rhn_archtype_id_seq' ), 'deb' , 'DEB' ); |
patch -p1 < patch_file.sql |
Configuring Spacewalk:
Your Spacewalk server should have a resolvable FQDN such as 'hostname.domain.com'. If the installer complains that the hostname is not the FQDN, do not use the --skip-fqdn-test flag to skip !
The setup requires that the database account has a password.
Note: Please don't use '#' (number sign/pound/hash) and '@' in your database password otherwise installation will fail.
Once the Spacewalk RPM is installed you need to configure the application, you can run:
spacewalk-setup --disconnected |
# spacewalk-setup --disconnected * Setting up Oracle environment. * Setting up database. ** Database: Setting up database connection for Oracle backend. Database service name (SID)? itestrac Username? spacewalk Password? ** Database: Testing database connection. ** Database: Populating database. *** Progress: #### * Setting up users and groups. ** GPG: Initializing GPG and importing key. ** GPG: Creating /root/.gnupg directory 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]? ** /etc/httpd/conf.d/ssl.conf has been backed up to ssl.conf-swsave * Configuring tomcat. ** /etc/tomcat5/tomcat5.conf has been backed up to tomcat5.conf-swsave ** /etc/tomcat5/server.xml has been backed up to server.xml-swsave ** /etc/tomcat5/web.xml has been backed up to web.xml-swsave * Configuring jabberd. * Creating SSL certificates. CA certificate password? Re-enter CA certificate password? Organization? Fedora Organization Unit [spacewalk.server.com]? Spacewalk Unit Email Address [root @localhost ]? City? Brno State? CZ Country code (Examples: "US" , "JP" , "IN" , or type "?" to see a list)? CZ ** 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.. Cobbler requires tftp and xinetd services be turned on for PXE provisioning functionality. Enable these services [Y/n]? cobblerd does not appear to be running/accessible * Restarting services. Installation complete. Visit https: //spacewalk.server.com to create the Spacewalk administrator account. |
Creating channels in spacewalk
- After logging in click on "channels".
- In the left pane click on "Manage software channels".
- On the right side click on "Create new channel". In our case the channel name is "calypso-rhel-server-5-x86_64".
- Once the channel is created, on the left panel click on "Manage Repositories".
- On the right side of the page click on "Create repository".
- Give a label which will match with the channel name. Now we need a url for the repository. We cannot use rhn url for spacewalk.
- Install mrepo
yum install mrepo
- Configure mrepo. Open /etc/mrepo.conf in vi editor and edit file to look as below.
[main]
srcdir = /repo/
wwwdir = /var/www/mrepo
confdir = /etc/mrepo.conf.d
arch = x86_64
mailto =
"A valid email id without quotes"
### Any other section is considered a definition
for
a distribution
### You can put distribution sections in /etc/mrepo.conf.d/
### Examples can be found in the documentation at:
### /usr/share/doc/mrepo-
0.8
.
7
/dists/.
[rhel-server-
5
-x86_64]
name = Red Hat Enterprise Server $release ($arch)
release =
5
arch = x86_64
metadata = repomd
iso = rhel-server-
5.7
-$arch-dvd.iso
updates = rhns:
///rhel-$arch-server-5
- Create a directory /repo which will hold all the packages. You can
also mount /repo to a different SAN/NAS/LOCAL Disk if your / is low on
disk space.
Create the following directories
mkdir /repo/rhel-server-
5
-x86_64
mkdir /var/www/mrepo
- Download a rhel iso image to the server for all the base packages and store it in /repo/rhel-server-5-x86_64.
- mrepo requires certain up2date configuration files to be present
You need to create the file /etc/sysconfig/rhn/up2date-uuid with the following contents:
uuid[comment]=Universally Unique ID
for
this
server
rhnuuid=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
The rhnuuid can be generated with the following command
uuidgen
- A second file you need to create is /etc/sysconfig/rhn/sources with the following content:
up2date
default
gensystemid -r 5Server -a x86_64 /repo/var/mrepo/rhel-x86_64-server- 5 |
- When this is setup you can fetch the updates from RHN using following command:
mrepo -uvvv (This will take quite some time to download all the packages from rhn. Run it in screen as it takes time to finish)
- Generate repository metadata:
mrepo -gvvv
- When these steps are finished, your RHN repositories will be available in http://10.102.91.201/mrepo.
in spacewalk. - You can initiate a repo sync with the channel you created in
spacewalk using the following commands. Run them in screen as it takes
time to finish.
screen spacewalk-repo-sync --channel calypso-rhel-
5.7
-x86_64 --url http:
//10.102.91.201/mrepo/rhel-server-5-x86_64/RPMS.os --type yum
screen spacewalk-repo-sync --channel calypso-rhel-server-
5
-x86_64 --url http:
//10.102.91.201/mrepo/rhel-server-5-x86_64/RPMS.updates/ --type yum
- The parent url http://10.102.91.201/mrepo/ when accessed will contain
[DIR] rhel-server-
5
-x86_64/
23
-Sep-
2011
15
:
36
-
- The sub url http://10.102.91.201/mrepo/rhel-server-5-x86_64/ will more or less look like below
[DIR] Parent Directory -
[DIR] RPMS.all/
23
-Sep-
2011
15
:
36
- All RPM packages merged
[DIR] RPMS.os/
23
-Sep-
2011
15
:
28
- OS RPM packages
[DIR] RPMS.updates/
23
-Sep-
2011
15
:
36
- OS update RPM packages
[DIR] disc1/
18
-May-
2011
14
:
26
- Mounted CDROM ISO
[DIR] iso/
23
-Sep-
2011
07
:
30
-
- Now you can use the url http://10.102.91.201/mrepo/rhel-server-5-x86_64/RPMS.updates/ in the repository in spacewalk.
Adding clients to spacewalk - Login to the client box and remove or rename the systemid file as
show below. This will also prevent the client box from accessing the rhn
network.
sudo mv /etc/sysconfig/rhn/systemid /etc/sysconfig/rhn/systemid.orig
- Register the client to the spacewalk server. This action will
generate a new systemid in the client box pointing to spacewalk server
only.
sudo /usr/sbin/rhnreg_ks --serverUrl=http:
//10.102.91.201/XMLRPC --activationkey=1-5ba293c06ca5545251919099469d4a03
Where activation key is what you generate in spacewalk during initial setup of spacewalk.
Configuring client to pull packages from spacewalk repository.
Edit the /etc/yum.conf file in client box to look similar to as shown below# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
[base]
name=Red Hat Linux $releasever - $basearch - Base
#baseurl=http:
//mirror.dulug.duke.edu/pub/yum-repository/redhat/$releasever/$basearch/
baseurl=http:
//10.102.91.201/mrepo/rhel-server-5-x86_64/RPMS.os/
[updates]
name=Red Hat Linux $releasever - Updates
#baseurl=http:
//mirror.dulug.duke.edu/pub/yum-repository/redhat/updates/$releasever/
baseurl=http:
//10.102.91.201/mrepo/rhel-server-5-x86_64/RPMS.updates/
Check using yum check-update command from the client box.
0 comments