Difference between revisions of "Freeside:1.7:Documentation:MirroringRPMRepoYaST:Setup"

From Freeside
Jump to: navigation, search
(Another attempt at simple instructions for Freeside 1.7 branch, testing, i386 on SLES 10.)
 
Line 21: Line 21:
 
===Initial Setup===
 
===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 and then make that folder available to your local client machines via a web server.
+
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 (<code>/srv/www/freeside-repo</code>) and then make that folder available to your local client machines via a web server.
  
 
Replace <code>server.domain.tld</code> in the following with your actual server name.
 
Replace <code>server.domain.tld</code> in the following with your actual server name.
Line 27: Line 27:
 
To set up the mirror initially:
 
To set up the mirror initially:
  
*Create a folder somewhere on the machine that will act as your repository server (under /srv/www, for example):
+
*Create a folder on the machine that will act as your repository server:
  
 
<pre>
 
<pre>
Line 42: Line 42:
 
(The trailing slash after the i386 prevents wget from downloading all repositories at the same level as the i386 folder.)
 
(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 if you want them:
+
*Copy down the corresponding self-service server files:
  
 
<pre>
 
<pre>
Line 127: Line 127:
 
cd /etc/apache2/vhosts.d
 
cd /etc/apache2/vhosts.d
 
cp -p vhost-ssl.template freeside-ssl.conf
 
cp -p vhost-ssl.template freeside-ssl.conf
perl -pi -e 's/#ServerName www.example.com/ServerName `hostname`/g;' freeside-ssl.conf # Uncomment and correct ServerName
+
vi freeside-ssl.conf # and then
perl -pi -e 's/#ServerAdmin root\@example.com/you\@domain.tld/g' freeside-ssl.conf # Uncomment and correct ServerAdmin, and any SSL file locations
+
# 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
 
cd
 
# Copy server cert (csr, crt, and key) to Apache SSL folders
 
# Copy server cert (csr, crt, and key) to Apache SSL folders
Line 165: Line 167:
 
cd
 
cd
 
# Copy server cert (csr, crt, and key) to Apache SSL folders
 
# 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
 
for ext in csr crt key; do cp -p server.${ext} /etc/apache2/ssl.${ext}; done
 
# Install zypper
 
# Install zypper
Line 197: Line 200:
 
*Add the self-service machine to /etc/sysconfig/freeside on the billing server.
 
*Add the self-service machine to /etc/sysconfig/freeside on the billing server.
  
*Start the freeside service on the billing server and check the logs to make sure it's working.  (For older RPMs you may need to install IPC::ShareLite, <code>zypper -n install perl-IPC-ShareLite</code>, and restart the freeside service.)
+
*Start the freeside service on the billing server and check the logs (<code>/var/log/freeside/selfservice.localhost.log</code>) to make sure it's working.  (For older RPMs you may need to install IPC::ShareLite, <code>zypper -n install perl-IPC-ShareLite</code>, and restart the freeside service.)
  
 
<pre>
 
<pre>
Line 203: Line 206:
 
</pre>
 
</pre>
  
*Check you can log in via the self-service interface.
+
*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 as the RPM did not do this:
 
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 as the RPM did not do this:

Revision as of 08:35, 16 April 2009

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.

The complete repository tree is currently about 3GB in size and growing. The following instructions will not mirror the whole repository, just the branch(es) for the SuSE version you use.

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.

Web Server Caching

The web server you use as a mirror must not be cached as that would result in a delay before the updated mirror contents became available to clients.

Instructions

With the exception of a couple of steps to create a folder and make it available via your web server, the steps for initial setup and refreshing the repository are identical.

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:
    • Try doing an installation or update

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 if it's not already there:

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
# And if you're running self-service on the same machine:
cd .ssh
cp -p id_dsa.pub authorized_keys2
ssh localhost
  • Add the self-service machine to /etc/sysconfig/freeside on the billing server.
  • Start the freeside service on the billing server and check the logs (/var/log/freeside/selfservice.localhost.log) to make sure it's working. (For older RPMs 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 as 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