Freeside:1.7:Documentation:MirroringRPMRepoYaST:Setup

From Freeside
Revision as of 12:39, 16 April 2009 by Rsiddall (talk | contribs) (Initial Installation of the Self-Service Interface)

Jump to: navigation, search

Mirroring the Freeside 1.7 Testing RPM Repository with YaST2

Introduction

This page explains how to mirror the i386 version of the Freeside 1.7 branch "testing" RPM repository for SuSE Linux Enterprise Server (SLES) 10, using wget; and how to use your mirror using YaST2 and zypper. There's more discussion on the main page on mirroring the RPM repository.

Proxy Servers

The following assumes you are not accessing the internet through a proxy server, or that you are using a transparent proxy server that requires no special configuration for client programs. If this is not the case, you may need to add command line switches to route internet accesses through your proxy server and to authenticate yourself to the server.

Other Assumptions

  • You are also using the Freeside self-service interface.
  • You are installing the self-service interface on the same computer as the billing server.
  • You are using PostgreSQL as the database server for Freeside.
  • The PostgreSQL database server will be on the same computer as the billing server.

Instructions

Initial Setup

The Freeside RPM repository is just a web server containing the RPMs and some metadata files. To mirror this, you download the files into a folder (/srv/www/freeside-repo) and then make that folder available to your local client machines via a web server.

Replace server.domain.tld in the following with your actual server name.

To set up the mirror initially:

  • Create a folder on the machine that will act as your repository server:
mkdir /srv/www/freeside-repo
  • Copy down the repository from the Freeside web server:
cd /srv/www/freeside-repo
wget --mirror --no-parent --no-host-directories --cut-dirs=1 http://freeside.biz/~rsiddall/repo/sles/10/freeside-1.7/testing/i386/

(The trailing slash after the i386 prevents wget from downloading all repositories at the same level as the i386 folder.)

  • Copy down the corresponding self-service server files:
wget --mirror --no-parent --no-host-directories --cut-dirs=1 http://freeside.biz/~rsiddall/repo/sles/10/freeside-1.7/testing/self-service/i386/
  • The Freeside web server auto-generated index.html files. Remove them from the mirror:
find /srv/www/freeside-repo -name 'index.html*' -print -exec /bin/rm {} \;
  • Make the folder available via the web server. Put an Apache configuration snippet in a file (freeside-repo.conf) in /etc/apache2/conf.d:
Alias /freeside-repo /srv/www/freeside-repo
<Directory /srv/www/freeside-repo>
Options +Indexes
Allow From All
Order Deny,Allow
</Directory>
  • Reload your web server:
service apache2 reload
  • Test the repository:

Refreshing Your Mirror

To refresh the mirror, just repeat the steps to copy down the files:

cd /srv/www/freeside-repo
wget --mirror --no-parent --no-host-directories --cut-dirs=1 http://freeside.biz/~rsiddall/repo/sles/10/freeside-1.7/testing/i386/
wget --mirror --no-parent --no-host-directories --cut-dirs=1 http://freeside.biz/~rsiddall/repo/sles/10/freeside-1.7/testing/self-service/i386/

And remove the index.html files generated by the web server from the mirror:

find /srv/www/freeside-repo -name 'index.html*' -print -exec /bin/rm {} \;

The above commands can be put in a shell script and executed periodically via cron.

Switching Existing Clients to Your Repository

If you've previously installed Freeside (billing server and/or self-service) on a client machine and want to switch it to use your local repository, change the installation sources via zypper or YaST2:

zypper service-list # Get number of the source using freeside.biz (or wavetail.420.am), say '2'
zypper service-delete 2
zypper service-add http://server.domain.tld/freeside-repo/repo/sles/10/freeside-1.7/testing/i386
zypper service-list # Make sure it's correct

There's no harm to adding the repository for the self-service files as another installation source:

zypper service-add http://server.domain.tld/freeside-repo/repo/sles/10/freeside-1.7/testing/self-service/i386

Using Your Mirror

Follow the instructions for using the Freeside Internet Services RPM repository (SuSE), but substitute the URL of your repository. These instructions are summarized below.

Initial Installation of Freeside

# Add the folder or web server containing SuSE to your installation sources if not already there
yast2 inst_source
# Enable SSL and Perl scripting for the HTTP server
yast2 --install apache2-mod_perl
yast2 http-server modules enable=ssl,perl
# Configure apache for SSL
cd /etc/apache2/vhosts.d
cp -p vhost-ssl.template freeside-ssl.conf
vi freeside-ssl.conf # and then
# Find '#ServerName www.example.com' and uncomment and correct ServerName
# Find '/#ServerAdmin root@example.com' and uncomment and correct ServerAdmin
# Fix up any SSL file locations if you put your server certificate somewhere other than the default
cd
# Copy server cert (csr, crt, and key) to Apache SSL folders
# Assumes you have server.{csr,crt,key} in /root...
for ext in csr crt key; do cp -p server.${ext} /etc/apache2/ssl.${ext}; done
# Install zypper
yast2 --install zypper
# Update the system
zypper -n update
# Install PostgreSQL (use client instead if database server is not on same box)
zypper -n install postgresql-server
# Add the Freeside repository as an installation source
zypper service-add http://server.domain.tld/freeside-repo/repo/sles/10/freeside-1.7/testing/i386
# Install Freeside itself (specify the Business::OnlinePayment module you use)
zypper -n install freeside-postgresql freeside freeside-mason perl-Business-OnlinePayment-AuthorizeNet

and then finish the installation as normal, starting PostgreSQL and creating a Freeside user and database; then running freeside-setup, freeside-adduser, and restarting the web server.

Initial Installation of the Self-Service Interface

The first steps are almost the same as for the Freeside billing server, except that you don't have to enable mod_perl. If you're installing the self-service server on the same machine as the billing server for testing, then you don't need to repeat these steps:

# Add the folder or web server containing SuSE to your installation sources
yast2 inst_source
# Enable SSL for the HTTP server
yast2 http-server modules enable=ssl
# Configure apache for SSL
cd /etc/apache2/vhosts.d
cp -p vhost-ssl.template freeside-ssl.conf
vi freeside-ssl.conf # and then
# Find '#ServerName www.example.com' and uncomment and correct ServerName
# Find '/#ServerAdmin root@example.com' and uncomment and correct ServerAdmin
# Fix up any SSL file locations if you put your server certificate somewhere other than the default
cd
# Copy server cert (csr, crt, and key) to Apache SSL folders
# Assumes you have server.{csr,crt,key} in /root...
for ext in csr crt key; do cp -p server.${ext} /etc/apache2/ssl.${ext}; done
# Install zypper
yast2 --install zypper
# Update the system
zypper -n update

To install the self-service interface you use a different repository on your mirror and install the appropriate set of RPMs:

# Add the self-service repository to zypper's installation sources
zypper service-add http://server.domain.tld/freeside-repo/repo/sles/10/freeside-1.7/testing/self-service i386
# Install Freeside Self-Service
zypper -n install freeside-selfservice

and then finish the self-service installation as normal:

  • Set up key-based SSH access and check the freeside user on the billing server can SSH into the self-service machine (even if it's localhost).
/bin/su freeside
cd
ssh-keygen -t dsa
cd .ssh
cp -p id_dsa.pub authorized_keys2
ssh localhost
  • Add the self-service machine to /etc/sysconfig/freeside on the billing server.
SELFSERVICE_MACHINES=localhost
  • Start the freeside service on the billing server and check the logs (/var/log/freeside/selfservice.localhost.log) to make sure it's working. (You may need to install IPC::ShareLite, zypper -n install perl-IPC-ShareLite, and restart the freeside service.)
service freeside start
  • Check you can log in via the self-service interface using the credentials for an account already in the billing server.

On SLES systems with a billing server installed using older Freeside RPMs, you may need to create a home directory for the freeside user and also create a freeside group if the RPM did not do this:

mkdir /home/freeside
chown freeside.users /home/freeside
groupadd freeside

Updating Your Freeside Installation

Just run zypper and tell it to update packages:

zypper -t package update