Prerequisites
# hostname rhn.sankar.com
# vim /etc/sysconfig/network
==========
HOSTNAME=rhn.sankar.com
install spacewalk-repo package with commands below:
# rpm -Uvh http://yum.spacewalkproject.org/1.8/RHEL/5/x86_64/spacewalk-repo-1.8-4.el5.noarch.rpm
# rpm -Uvh http://yum.pgrpms.org/reporpms/8.4/pgdg-redhat-8.4-2.noarch.rpm
If you want to use the nightly builds, install the spacewalk-repo package based on your operating system (see above) and then enable the nightly repository:
# sed -i 's/enabled=0/enabled=1/' /etc/yum.repos.d/spacewalk-nightly.repo
# sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/spacewalk.repo
NOTE: Nigthly repo contains developers snapshot and it is not suitable for production environment. Especially beware that you might not be able to upgrade from the nightly installation to the next release, especially with respect to the database schema.
Spacewalk requires a Java Virtual Machine with version 1.6.0 or greater. EPEL - Extra Packages for Enterprise Linux contains a version of the openjdk that works with Spacewalk. Other dependencies can get installed from EPEL as well. To get packages from EPEL just install this RPM:
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Setup of the PostgreSQL database
You should have PostgreSQL server running somewhere. Let's assume you will run the server on the same machine as Spacewalk itself:
# yum install -y 'postgresql-server > 8.4'
# chkconfig postgresql on
# /etc/init.d/postgresql initdb
# /etc/init.d/postgresql start
Create database, user, and plpgsql language there:
# su - postgres -c 'PGPASSWORD=spacepw; createdb spaceschema ; createlang plpgsql spaceschema ; yes $PGPASSWORD | createuser -P -sDR spaceuser'
Configure the user to use md5 password to connect to that database. Put the lines like following to /var/lib/pgsql/data/pg_hba.conf. Avoid the common pitfall: Make sure you put them *before* those existing lines that are for all..
# vim /var/lib/pgsql/data/pg_hba.conf
===================================
local spaceschema spaceuser md5
host spaceschema spaceuser 127.0.0.1/8 md5
host spaceschema spaceuser ::1/128 md5
local spaceschema postgres ident
Then reload PostgreSQL:
# service postgresql reload
and test the connection:
# PGPASSWORD=spacepw psql -a -U spaceuser spaceschema
# PGPASSWORD=spacepw psql -h localhost -a -U spaceuser spaceschema
Tune up PostgreSQL's performance by running pgtune:
# yum install pgtune
# pgtune --type=web -c 600 -i /var/lib/pgsql/data/postgresql.conf >/tmp/pgtune.conf
Review the changes by
# diff -u /var/lib/pgsql/data/postgresql.conf /tmp/pgtune.conf
# cp /var/lib/pgsql/data/postgresql.conf /var/lib/pgsql/data/postgresql.conf.bak
# cp /tmp/pgtune.conf /var/lib/pgsql/data/postgresql.conf
# service postgresql restart
or at least increase maximal number of connections to 600:# echo max_connections = 600 >>/var/lib/pgsql/data/postgresql.conf
Install the spacewalk-postgresql and configure it
When installing Spacewalk, you install spacewalk-postgresql which should give you correct backend and dependencies.
# wget http://pkgs.repoforge.org/python-simplejson/python-simplejson-2.0.5-1.el5.rf.i386.rpm
# rpm -ivh python-simplejson-2.0.5-1.el5.rf.i386.rpm
# yum install spacewalk-postgresql
Then, when you run spacewalk-setup, you'll be asked for connection information:
# spacewalk-setup --disconnected --external-db
** Database: Setting up database connection for PostgreSQL backend.
Hostname (leave empty for local)?
Database? spaceschema
Username? spaceuser
Password? spacepw
** Database: Populating database.
Managing Spacewalk
Spacewalk consists of several services. Each of them has its own init.d script to stop/start/restart. If you want manage all spacewalk services at once use
/usr/sbin/spacewalk-service [stop|start|restart].
Once Spacewalk installation is completed we can access spacewalk admin control panel using below URL
http://rhn.sankar.com
This is time to create admin user id and password.
Creating Channels
1. Create a base channel within Spacewalk.
Channels > Manage Software Channels > Create New Channel
2. Fill up all the required fields such as Channel Name, Channel Label, and Channel Summary
3. Select the Parent (its depends upon your channel)
4. Select the channel architecture from the drop down list
5. Select the Checksum type
6. Write a description about your channel
7. Fill the Contact support information, Channel access control and security GPG
8. Now click the “Create Channel” button.
The channel with the specified name has been created.
Adding packages to repository
There are two ways to add packages to the spacewalk server. We can either add using spacewalk-repo-sync or rhnpush command.
Spacewalk-repo-sync
The spacewalk-repo-sync tool is used to sync packages from external or local yum repositories. All the packages within the specified repository will be added to the channel.Any url supported by yum is supported by this utility, including mirror lists. If the url is not supplied, the tool will look to see what repositories are associated with the specified channel and use those.
Example:
spacewalk-repo-sync --channel=repo1 --url=http://example.com/yum-repo/
spacewalk-repo-sync --channel=repo2 --url=file:///var/share/localrepo/
spacewalk-repo-sync --channel=repom --url=http://example.com/mirrorlist.xml/
You can also use WebGUI and this is the easiest way to create repositories

Goto Channels -> Manage Software Channels -> Manage Repositories -> create new repository
After creating the repository, you need to link it to one or more Software Channels.
Goto: Channels -> Manage Software Channels -> Choose the channel to be linked -> Repositories -> Select the repositories to be linked to the channel -> Update Repositories.
Now you can sync the repository by clicking on the sync tab.
Click on sync now or schedule a sync.
Alternatively you can start a sync of a yum repository defined in the web ui by command line:
spacewalk-repo-sync --channel CHANNEL_LABEL
If, when doing a spacewalk-repo-sync, you get a "yum.Errors.NoMoreMirrorsRepoError?" error then you need to install python-hashlib.
The logs are stored in /var/log/rhn/reposync/
RHNpush :
The RHN Satellite Package Pusher (rhnpush) pushes RPMs into locally managed channels on an RHN Satellite Server. Rhnpush has three configuration files called /etc/sysconfig/rhn/rhnpushrc, ~/.rhnpushrc, and ./.rhnpushrc.
/etc/sysconfig/rhn/rhnpushrc is the system-wide default settings for rhnpush.
~/.rhnpushrc is the user-specific settings that override the system-wide settings.
./.rhnpushrc controls the directory specific settings that override the user-specific and system-specific settings.
/etc/sysconfig/rhn/rhnpushrc must be present for rhnpush to function correctly. If it is missing, rhnpush will attempt to use a series of default settings stored internally as a replacement. ~/.rhnpushrc and ./.rhnpushrc are not required to be present, but will be used if they are present. They are not created automatically by rhnpush.
Rhnpush uses a cache, stored at ~/.rhnpushcache, to temporarily hold the username and password for a user. If the cache is missing, it will be created by rhnpush.
If the cache is present and not too old, the usename-password combo will be used as a convenience for the user. The amount of time a cache lasts is configurable in any of the three configuration files. If your username/password combination gets messed up you have two options. One, you can wait until the cache expires, which takes minutes by default. Two, you can use the –new_cache option to force rhnpush to let you reenter your username/password.
Using the –stdin and –dir options at the same time works as follows: rhnpush will let you type in rpm names, each rpm name on a separate line. When you have finished entering in rpm names, hit Ctrl-D. Rhnpush will then grab the files from directory you specified with –dir, put them in a list with the rpms you listed through standard input, and send them to the channel that was listed on the command-line or in the configuration files.
Note : Make sure /var/satellite exists on the Spacewalk server and has owner:group apache before pushing.
[root@sathishhost ~]# chgrp apache /var/satellite/ -R
[root@sathishhost ~]# ls -l /var | grep satellite
drwxr-xr-x. 3 apache apache 4096 Mar 20 10:06 satellite
Example
rhnpush --server localhost -u <username> -p <password> --channel <channel-name> /usr/local/src/additional/*.rpm
rhnpush --server localhost -u sathish -p redhat --channel spacewalk-nightly-rhel-6-x86_64 /usr/local/src/additional/*.rpm
rhnpush -v --channel=<channel-name> --server=http://localhost/APP --dir=<package-dir>
rhnpush -v --channel=spacewalk-nightly-rhel-6-x86_64 --server=http://localhost/APP --dir=/usr/local/src/additional
Creating activation key
Activation keys are used to register a system to spacewalk server. System registered with an activation key will inherit the characteristics defined by that key.
1. To create an activation key
Systems > Activation keys > Create new key
2. Enter the description of the activation key
3. If you have a specific key value, type it in the key textbox else leave it as blank. Spacewalk will generate a key after clicking create key button.
4. Enter a numeric value for the limited usage of the key. In case if you want to use the key unlimited times leave the usage textbox as blank.
5. Select the base channel from the drop down list box or choose “Spacewalk Default” to allow systems to register to the default Red Hat provided channel that corresponds to their installed version of Red Hat Enterprise Linux.
6. Enable the universal default check box and click “Create Activation Key”
Registering Clients
Install the client-tools in the client
For RHEL 5
# rpm -Uvh http://spacewalk.redhat.com/yum/1.7/RHEL/5/i386/spacewalk-client-repo-1.7-5.el5.noarch.rpm
Now install the client packages
# yum install rhn-client-tools rhn-check rhn-setup rhnsd m2crypto yum-rhn-plugin
Register your CentOS or Red Hat Enterprise Linux system to Spacewalk using the activation key you created earlier
# rhnreg_ks --serverUrl=http://YourSpacewalk.example.org/XMLRPC --activationkey=<key-with-rhel-custom-channel>
rhnreg_ks is used for registration of clients to Spacewalk. If you need to re-register a client to your Spacewalk server or change registration from one environment or server to another Spacewalk server then use the “–force” flag with rhnreg_ks, otherwise there is no need to use “–force”.
No comments:
Post a Comment