What is spacewalk? Spacewalk is a free version of Red Hat Satellite, a system nanagement solution.
What you can do with spacewalk:
- Kickstart Distributions
- Deploy updates on your systems using a centralized management solution
- Execute remote commands using rhncfg-actions
- Create local repositories
So let's get started.
First we have to install the spacewalk repo. We can do that by using the following command
Also we will have to add the JPackage repository.
sudo rpm -Uvh http://yum.spacewalkproject.org/2.6/RHEL/7/x86_64/spacewalk-repo-2.6-0.el7.noarch.rpm
[archy@spacewalk ~]$
The last repo we will add is the EPEL-Repo.
sudo bash -c 'cat > /etc/yum.repos.d/jpackage-generic.repo << EOF [jpackage-generic] name=JPackage generic baseurl=http://mirrors.dotsrc.org/pub/jpackage/5.0/generic/free/ #mirrorlist=http://www.jpackage.org/mirrorlist.php?dist=generic&type=free&release=5.0 enabled=1 gpgcheck=1 gpgkey=http://www.jpackage.org/jpackage.asc EOF'
[archy@spacewalk ~]$
That's it for repositories.
yum -y install epel-release.noarch
[archy@spacewalk ~]$ sudo
Spacewalk uses a database to store its data. The databases that can be used are postgresql and oracle RDBMS. In this setup I'll be using postgresql which will run on the same server as the spacewalk service.
Install the spacewalk and the spacewalk-postgresql packages
I've found out that without downgrading c3p0 the tomcat service will have problems starting on the initial setup.
sudo yum -y install spacewalk-setup-postgresql spacewalk-postgresql
[archy@spacewalk ~]$
So we'll downgrade it
We can now setup the spacewalk service by using
sudo yum -y downgrade c3p0
[archy@spacewalk ~]$
Output:
sudo spacewalk-setup
[archy@spacewalk ~]$
* Setting up SELinux..
** Database: Setting up database connection for PostgreSQL backend.
** Database: Installing the database:
** Database: This is a long process that is logged in:
** Database: /var/log/rhn/install_db.log
*** Progress: ####
** Database: Installation complete.
** Database: Populating database.
*** Progress: ###########################
* Configuring tomcat.
* 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? archy@archyslife.lan
* Performing initial configuration.
* Configuring apache SSL virtual host.
Should setup configure apache's default ssl server for you (saves original ssl.conf) [Y]? Y
** /etc/httpd/conf.d/ssl.conf has been backed up to ssl.conf-swsave
* Configuring jabberd.
* Creating SSL certificates.
CA certificate password?
Re-enter CA certificate password?
Organization? archyslife.lan
Organization Unit [spacewalk.archyslife.lan]? Administration
Email Address [archy@archyslife.lan]? archy@archyslife.lan
City? Munich
State? Bavaria
Country code (Examples: "US", "JP", "IN", or type "?" to see a list)? DE
** 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]? Y
* Restarting services.
Installation complete.
Visit https://spacewalk.archyslife.lan to create the Spacewalk administrator account.
Spacewalk is now ready to be accessed, but our server is not yet. We will first have to setup the firewall by adding the ports 80/tcp, 443/tcp, 5222/tcp, 5222/udp, and 69/udp to the firewall.
sudo firewall-cmd --zone=internal --add-port={80/tcp,443/tcp,5222/tcp,5222/udp,69/udp} --permanent
[archy@spacewalk ~]$
firewall-cmd --reload
[archy@spacewalk ~]$ sudo
Next we have to access the Server using the Webinterface In my case, I'll point my browser to https://spacewalk.archyslife.lan
Before we continue to setup spacewalk, we will download a centos-7 ISO file and mount it to a folder. In order to do that, execute the following commands:
To automate the mounting, add the following line to a /etc/fstab
mkdir /iso && cd /iso
[archy@spacewalk ~]$ sudo
wget http://centos.mirror.iphh.net/CentOS/7/isos/x86_64/CentOS-7-x86_64-Everything-1611.iso
[archy@spacewalk ~]$ sudo
sudo mkdir --parents /tftpboot/CentOS
[archy@spacewalk ~]$
sudo mount -o loop /iso/CentOS-7-x86_64-Everything-1611.iso /tftpboot/CentOS
[archy@spacewalk ~]$
/iso/CentOS-7-x86_64-Everything-1611.iso /tftpboot/CentOS iso9660 defaults 0 0
We will have to create the organization for our spacewalk server.
If it was successfully created, you will be greeted by the welcome-screen
From there we navigate to 'Systems' --> 'Activation Keys'
And create a new key.
The activation key will be needed when adding clients for example.
Next we setup some software channels. Therefore navigate to 'Channels' --> 'Manage Software Channels' and click 'Create Channel' which is in the upper right hand corner.
Here is a example of the data used for a software channel.
Important: Add the GPG Key from the Repo you are using to download your files. Otherwise you will get gpgcheck errors from yum.
To obtain this key, type
gpg --with-fingerprint /tftpboot/CentOS/RPM-GPG-KEY-CentOS-7
[root@spacewalk ~]$
Output:
pub 4096R/F4A80EB5 2014-06-23 CentOS-7 Key (CentOS 7 Official Signing Key <security@centos.org>
Key fingerprint = 6341 AB27 53D7 8A78 A7C2 7BB1 24C6 A8A7 F4A8 0EB5
Now that we've got a software channel, we also want to link a repository to it. To create a repository, we click on 'Channels' --> 'Manage Software Channels' --> 'Manage Repositories' and on 'Create Repository' which is again in the upper right hand corner.Here is an example of the input
So far so good. Linking the repository to the channel can be done as follows.
Click on 'Channels' --> 'Manage Software Channels' and choose your software channel.
Click on your software channel and go to 'Repositories' and select your repository.
Finally click 'Update Repositories'.
That concludes the basic setup. You can now add clients using the following commands:
Populating the repository with data and packages can be done using the command:
Adding a client to the spacewalk-server:
Step 1: Get the spacewalk-repo
To use kickstart functionality, we will have to setup a kickstart-distribution and a kickstart-profile.
We'll start with the distribution. Click on 'Systems' --> 'Kickstart' --> 'Distributions' --> 'Create Distribution'
Finally click 'Update Repositories'.
That concludes the basic setup. You can now add clients using the following commands:
Populating the repository with data and packages can be done using the command:
spacewalk-repo-sync --channel centos-7-base --type yum
[root@spacewalk ~]$
Adding a client to the spacewalk-server:
Step 1: Get the spacewalk-repo
Step 2: Install the necessary packages
sudo rpm -Uvh http://yum.spacewalkproject.org/2.6-client/RHEL/7/x86_64/spacewalk-client-repo-2.6-0.el7.noarch.rpm
[archy@spacewalk ~]$
Step 3: Obtain the necessary certs package
sudo yum -y install rhn-client-tools rhn-check rhn-setup rhnsd m2crypto yum-rhn-plugin rhncfg-actions
[archy@spacewalk ~]$
Step 4: Register the client to your spacewalk-server
rpm -Uvh http://spacewalk.archyslife.lan/pub/rhn-org-trusted-ssl-cert-1.0-4.noarch.rpm
[archy@spacewalk ~]$ sudo
sudo rhnreg_ks --serverUrl=https://spacewalk.archyslife.lan/XMLRPC --sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT --activationkey=your_activation_key
[archy@spacewalk ~]$
To use kickstart functionality, we will have to setup a kickstart-distribution and a kickstart-profile.
We'll start with the distribution. Click on 'Systems' --> 'Kickstart' --> 'Distributions' --> 'Create Distribution'
and fill in the data. Here is my example.
Click on 'Create Kickstart Distribution'. Now we have to setup the kickstart-profile
This can be achieved by clicking on 'Systems' --> 'Kickstart' --> 'Profiles' --> 'Create Kickstart Profile'
Fill in the Data, again here are my examples.
If you have a dhcp-server that hands out the spacewalk-server as option 66, you will be able to use PXE Boot in your network.
Feel free to comment and / or suggest a topic.
Comments
Post a Comment