Difference between revisions of "Freeside:1.7:Documentation:InstallingUsingRPM"
(Expanded information on building the RPMs and creating your own repository) |
|||
Line 4: | Line 4: | ||
==Introduction== | ==Introduction== | ||
− | RPM is a build-once, install-many package manager for system management. Originally for RedHat, it is now used on a wide range of Linux distros including Fedora, SUSE, etc. | + | RPM is a build-once, install-many package manager for system management. Originally for RedHat, it is now used on a wide range of Linux distros including Fedora, SUSE, etc. Well-structured RPMs include dependency information that RPM can use to warn you that additional components are required. Tools such as yum and apt-get (RPM version) can use this dependency information to download additional components from a repository and include them in the installation. This has the potential to make installing Freeside almost as easy as installing a Windows program. (Check the /install and /debian directories in Freeside CVS for scripts and notes on installing on various distros.) |
− | Well-structured RPMs include dependency information that RPM can use to warn you that additional components are required. Tools such as yum and apt-get (RPM version) can use this dependency information to download additional components from a repository and include them in the installation. This has the potential to make installing Freeside almost as easy as installing a Windows program. | + | Installing the RPM version of Freeside may not be a good idea if you plan to do development on Freeside as the RPMs may not include all the files supplied in the tarball. |
− | (Check the /install and /debian directories in | ||
− | Installing the RPM version of Freeside may not be a good idea if you plan to do development on Freeside | ||
==Installation using RPM== | ==Installation using RPM== | ||
Installation is much easier if you have a repository that works with a tool such as [[#yum|yum]] or [[#apt|apt-get]]. If you only have rpm and wish to use that, enter: | Installation is much easier if you have a repository that works with a tool such as [[#yum|yum]] or [[#apt|apt-get]]. If you only have rpm and wish to use that, enter: | ||
− | <pre> | + | <pre> |
+ | rpm -Uvh --test freeside-1.7.3-1.noarch.rpm \ | ||
+ | freeside-mason-1.7.3-1.noarch.rpm \ | ||
+ | freeside-postgresql-1.7.3-1.noarch.rpm \ | ||
+ | perl-Business-OnlinePayment-AuthorizeNet-3.17-1.i386.rpm | ||
+ | </pre> | ||
Where: | Where: | ||
− | * | + | * 1.7.3-1 is the version of Freeside and the release of the RPM. Change this if necessary. |
− | * | + | * postgresql is the database you wish to use as the Freeside back-end. Replace freeside-postgresql with freeside-mysql if you wish to use MySQL. See the main installation document for which databases are supported. |
− | + | * Replace AuthorizeNet with the name of the credit card processor you wish to use for real-time transactions. Also replace 3.17-1.i386 with the current version, release, and architecture of the corresponding Business::OnlinePayment RPM. | |
The command should result in some warnings about unsatisfied dependencies. Find the corresponding RPMs and add them to the list on the command line. Keep doing this until the command results in no warnings, then issue the command one last time without the --test to actually install all the RPMs. | The command should result in some warnings about unsatisfied dependencies. Find the corresponding RPMs and add them to the list on the command line. Keep doing this until the command results in no warnings, then issue the command one last time without the --test to actually install all the RPMs. | ||
Installing the freeside RPM will install the '''[[#freeside-install|freeside-install]]''' command line utility that you can use to finish the installation. | Installing the freeside RPM will install the '''[[#freeside-install|freeside-install]]''' command line utility that you can use to finish the installation. | ||
Line 21: | Line 24: | ||
* Next, add the repository to your /etc/yum.repo.d directory or /etc/yum.conf file. | * Next, add the repository to your /etc/yum.repo.d directory or /etc/yum.conf file. | ||
* Finally, install the required components by issuing the command: | * Finally, install the required components by issuing the command: | ||
− | <pre>yum install freeside freeside- | + | <pre>yum install freeside freeside-mason freeside-postgresql perl-Business-OnlinePayment-AuthorizeNet</pre> |
+ | with these changes: | ||
+ | * Replace posgresql with mysql if you wish to use MySQL instead of PostgreSQL for the main Freeside database. | ||
+ | * Replace AuthorizeNet with the name of the Business::OnlinePaymet module for the credit card gateway you wish to use. | ||
+ | * Add the RPM name of any additional Business::OnlinePayment gateways you wish to install. | ||
At this point all the required components should be installed and the freeside user account created. You can now complete the installation with [[#freeside-install|freeside-install]]. | At this point all the required components should be installed and the freeside user account created. You can now complete the installation with [[#freeside-install|freeside-install]]. | ||
==Installing using APT== | ==Installing using APT== | ||
Line 27: | Line 34: | ||
* Next, add the repository to your /etc/apt.conf file. | * Next, add the repository to your /etc/apt.conf file. | ||
* Finally, install the required components by issuing the command: | * Finally, install the required components by issuing the command: | ||
− | <pre>apt-get install freeside freeside- | + | <pre>apt-get install freeside freeside-mason freeside-postgresql perl-Business-OnlinePayment-AuthorizeNet</pre> |
At this point all the required components should be installed and the freeside user account created. You can now complete the installation with [[#freeside-install|freeside-install]]. | At this point all the required components should be installed and the freeside user account created. You can now complete the installation with [[#freeside-install|freeside-install]]. | ||
==Finishing the installation with freeside-install== | ==Finishing the installation with freeside-install== | ||
RPM does little more than installing files and creating users. To allow automated installation and upgrading, well-structured RPMs may not interact with the user. Since part of the Freeside installation is interactive, at some future date a command line utility called '''freeside-install''' will be included in the RPM to help you complete the installation. | RPM does little more than installing files and creating users. To allow automated installation and upgrading, well-structured RPMs may not interact with the user. Since part of the Freeside installation is interactive, at some future date a command line utility called '''freeside-install''' will be included in the RPM to help you complete the installation. | ||
− | + | For the moment, just work through the standard install, ignoring the steps which are done by the RPM, i.e. installing files and creating the freeside user. The RPM does not do any steps that require entry of a password, or which have to be done after a password is specified. | |
* You can skip straight to "Allow the freeside user full access to the freeside database," but be aware that if there are errors in the RPM dependencies, then some of the prerequisites may not be installed. | * You can skip straight to "Allow the freeside user full access to the freeside database," but be aware that if there are errors in the RPM dependencies, then some of the prerequisites may not be installed. | ||
* Then "Add the freeside database to your database engine:" | * Then "Add the freeside database to your database engine:" | ||
Line 38: | Line 45: | ||
==Creating your own repository== | ==Creating your own repository== | ||
If you can't find an APT/yum repository for your operating system, you can create your own. | If you can't find an APT/yum repository for your operating system, you can create your own. | ||
− | + | ===Set up your development environment for building RPMs as non-root=== | |
− | * Create the Freeside RPMs: | + | You should always build RPMs as a non-root user. |
− | <pre> | + | * First, create an account to build RPMs: |
− | tar zxvf freeside.tar.gz | + | <pre>useradd bob</pre> |
− | cd freeside/ | + | * Next, create a .rpmmacros file in that user's home directory: |
+ | <pre>su bob | ||
+ | vi ~/.rpmmacros | ||
+ | %_topdir /home/bob/redhat | ||
+ | %_signature gpg | ||
+ | %_gpg_path /home/bob/.gnupg | ||
+ | %_gpg_name Yourname Here | ||
+ | </pre> | ||
+ | * Next, create or import a GPG with which to sign the RPMs. (Signing is optional but recommended.) | ||
+ | * Finally, create a set of directories for RPM to use: | ||
+ | <pre> | ||
+ | su bob | ||
+ | mkdir ~/redhat/{BUILD,RPMS,SOURCES,SPECS,SRPMS} | ||
+ | </pre> | ||
+ | To build Freeside RPMs as a non-root user, your build system must have a freeside user: | ||
+ | <pre> | ||
+ | useradd freeside | ||
+ | </pre> | ||
+ | ===Create the Freeside RPMs=== | ||
+ | * First, get the Freeside source code as a tarball | ||
+ | <pre> | ||
+ | cd ~/redhat/SOURCES | ||
+ | wget http://www.sisd.com/freeside/freeside-1.7.3.tar.gz | ||
+ | </pre> | ||
+ | (Ideally you could build the RPMs at this point using a tarbuild: rpmbuild -ta freeside.tar.gz. This doesn't work yet.) | ||
+ | You can also get tarballs from CVS using ViewVC. | ||
+ | * Next, untar the tarball and change directory to the folder containing the RPM specfile: | ||
+ | <pre> | ||
+ | mkdir ~/work | ||
+ | cd ~/work | ||
+ | tar zxvf ~/redhat/SOURCES/freeside-1.7.3.tar.gz | ||
+ | cd freeside-1.7.3/install/rpm | ||
+ | </pre> | ||
+ | * If you are building modified RPMs, copy your patches and supplemental files to ~/redhat/SOURCES and edit the specfile to make use of them. | ||
+ | * Next, build the RPMs: | ||
+ | <pre> | ||
rpmbuild -ba freeside.spec | rpmbuild -ba freeside.spec | ||
</pre> | </pre> | ||
− | * | + | ===Build the RPMs for required Perl modules=== |
− | <pre>cpan | + | Freeside uses many Perl modules, not all of which are available as RPMs. The simplest way of generating all the required RPMs is to use Ovid, which is available from CPAN, as Ovid works recursively to build RPMs of modules that the current module depends on. Ovid also can build RPM sets from Perl bundle files. |
− | + | * If you have not used CPAN as the build user yet, configure CPAN: | |
+ | <pre> | ||
+ | su bob | ||
+ | cpan # And answer all the prompts | ||
</pre> | </pre> | ||
* Install Ovid: | * Install Ovid: | ||
Line 53: | Line 98: | ||
install Ovid | install Ovid | ||
quit | quit | ||
− | rpm -Uvh ovid.rpm | + | rpm -Uvh ~/redhat/RPMs/i386/ovid-0.12-1.i386.rpm |
+ | </pre> | ||
+ | or | ||
+ | <pre> | ||
+ | wget http://search.cpan.org/CPAN/authors/id/G/GY/GYEPI/Ovid-0.12.tar.gz | ||
+ | rpmbuild -ta Ovid-0.12.tar.gz | ||
+ | rpm -Uvh ~/redhat/RPMs/i386/ovid-0.12-1.i386.rpm | ||
+ | </pre> | ||
+ | * Create bundle files for each of the Freeside RPMs: | ||
+ | <pre> | ||
+ | mkdir ~/.cpan/Bundle | ||
+ | install/rpm/rpm2Bundle ~/redhat/RPMS/noarch/freeside-1.7.3-1.noarch.rpm > ~/.cpan/Bundle/freeside.pm | ||
+ | install/rpm/rpm2Bundle ~/redhat/RPMS/noarch/freeside-mason-1.7.3-1.noarch.rpm > ~/.cpan/Bundle/freeside-mason.pm | ||
+ | install/rpm/rpm2Bundle ~/redhat/RPMS/noarch/freeside-postgresql-1.7.3-1.noarch.rpm > ~/.cpan/Bundle/freeside-postgresql.pm | ||
</pre> | </pre> | ||
− | |||
− | |||
* Use Ovid to create RPMs for the main Freeside dependencies: | * Use Ovid to create RPMs for the main Freeside dependencies: | ||
− | <pre> | + | <pre> |
− | + | ovid --skip-perl-rpm-modules --packager='Yourname Here <youraddy@example.com>' \ | |
+ | Bundle::freeside Bundle::freeside-mason Bundle::freeside-postgresql | ||
</pre> | </pre> | ||
− | * Fix up RPMs that did not build. | + | * Fix up RPMs that did not build. cpan2rpm and cpanflute2 are useful when Ovid doesn't work. |
+ | * Use Ovid to create RPMs for all the Freeside dependencies you require: | ||
+ | <pre>ovid Business::OnlinePayment::AuthorizeNet</pre> | ||
* Fix up RPMs that have inadequate dependency information: perl-HTML-Mason-*.rpm | * Fix up RPMs that have inadequate dependency information: perl-HTML-Mason-*.rpm | ||
+ | <pre> | ||
+ | ovid Bundle::HTML::Mason | ||
+ | </pre> | ||
+ | ===Create the repository=== | ||
* Copy all generated RPMs into your web server space: | * Copy all generated RPMs into your web server space: | ||
− | <pre> | + | <pre> |
mkdir /var/www/html/fedora/7/ | mkdir /var/www/html/fedora/7/ | ||
− | cp *.rpm /var/www/html/fedora/7</pre> | + | cp ~/redhat/RPMS/*/*.rpm /var/www/html/fedora/7</pre> |
* Sign all the RPMs with your GPG key: | * Sign all the RPMs with your GPG key: | ||
<pre>rpm --addsign *.rpm</pre> | <pre>rpm --addsign *.rpm</pre> | ||
− | * Download any programs needed to build the repository. For newer, XML-based versions of yum, you'll need createrepo. If it's in a yum repository, this can be as simple as:<pre>yum install createrepo</pre> | + | * Download any programs needed to build the repository. For newer, XML-based versions of yum, you'll need createrepo. If it's in a yum repository, this can be as simple as:<pre>yum install createrepo</pre>. On distros using older versions of yum (e.g. FC2 and earlier), you'll need to use yum-arch instead of createrepo to generate the repository metadata. yum-arch should be installed as part of the yum RPM, so there's no need to install another RPM. |
* Create the repository: | * Create the repository: | ||
<pre>createrepo /var/www/html/fedora/7 | <pre>createrepo /var/www/html/fedora/7 | ||
</pre> | </pre> | ||
* Make sure the web server is started | * Make sure the web server is started | ||
+ | * Create a file defining the repository. | ||
At this point your web server is acting as a yum repository with a URL of http://localhost/fedora/7/ and you can proceed to [[#yum|install Freeside from the repository]]. | At this point your web server is acting as a yum repository with a URL of http://localhost/fedora/7/ and you can proceed to [[#yum|install Freeside from the repository]]. | ||
− | + | ||
==Upgrading== | ==Upgrading== | ||
===Introduction=== | ===Introduction=== | ||
If you have an existing Freeside installation that was installed from the tarball, following the instructions for installing or upgrading from RPM '''''may''''' result in an operational system where the RPMs have overwritten most or all of the files installed from the tarball or CPAN. | If you have an existing Freeside installation that was installed from the tarball, following the instructions for installing or upgrading from RPM '''''may''''' result in an operational system where the RPMs have overwritten most or all of the files installed from the tarball or CPAN. | ||
===Upgrading using RPM=== | ===Upgrading using RPM=== | ||
− | When there's a new version of Freeside available as RPM, just download the new RPMs and upgrade them:<pre> | + | When there's a new version of Freeside available as RPM, just download the new RPMs and upgrade them:<pre> |
+ | rpm -Uvh --test freeside-1.7.3-1.noarch.rpm freeside-''interface''-1.7.3-1.noarch.rpm freeside-''backend''-1.7.3-1.noarch.rpm | ||
</pre> | </pre> | ||
===Upgrading using a repository=== | ===Upgrading using a repository=== |
Revision as of 09:00, 31 October 2007
Contents
Installing Freeside from RPMs
Warning!
The RPM installation of Freeside is experimental! The instructions below may be incomplete or incorrect and are subject to change. You should only attempt to use the RPM installation if you are prepared to work around omissions and inaccuracies, and can recover data in the event of a loss.
Introduction
RPM is a build-once, install-many package manager for system management. Originally for RedHat, it is now used on a wide range of Linux distros including Fedora, SUSE, etc. Well-structured RPMs include dependency information that RPM can use to warn you that additional components are required. Tools such as yum and apt-get (RPM version) can use this dependency information to download additional components from a repository and include them in the installation. This has the potential to make installing Freeside almost as easy as installing a Windows program. (Check the /install and /debian directories in Freeside CVS for scripts and notes on installing on various distros.) Installing the RPM version of Freeside may not be a good idea if you plan to do development on Freeside as the RPMs may not include all the files supplied in the tarball.
Installation using RPM
Installation is much easier if you have a repository that works with a tool such as yum or apt-get. If you only have rpm and wish to use that, enter:
rpm -Uvh --test freeside-1.7.3-1.noarch.rpm \ freeside-mason-1.7.3-1.noarch.rpm \ freeside-postgresql-1.7.3-1.noarch.rpm \ perl-Business-OnlinePayment-AuthorizeNet-3.17-1.i386.rpm
Where:
- 1.7.3-1 is the version of Freeside and the release of the RPM. Change this if necessary.
- postgresql is the database you wish to use as the Freeside back-end. Replace freeside-postgresql with freeside-mysql if you wish to use MySQL. See the main installation document for which databases are supported.
- Replace AuthorizeNet with the name of the credit card processor you wish to use for real-time transactions. Also replace 3.17-1.i386 with the current version, release, and architecture of the corresponding Business::OnlinePayment RPM.
The command should result in some warnings about unsatisfied dependencies. Find the corresponding RPMs and add them to the list on the command line. Keep doing this until the command results in no warnings, then issue the command one last time without the --test to actually install all the RPMs. Installing the freeside RPM will install the freeside-install command line utility that you can use to finish the installation.
Installing using yum
- First, find a repository containing all the required RPMs. If no such repository exists, you can create your own.
- Next, add the repository to your /etc/yum.repo.d directory or /etc/yum.conf file.
- Finally, install the required components by issuing the command:
yum install freeside freeside-mason freeside-postgresql perl-Business-OnlinePayment-AuthorizeNet
with these changes:
- Replace posgresql with mysql if you wish to use MySQL instead of PostgreSQL for the main Freeside database.
- Replace AuthorizeNet with the name of the Business::OnlinePaymet module for the credit card gateway you wish to use.
- Add the RPM name of any additional Business::OnlinePayment gateways you wish to install.
At this point all the required components should be installed and the freeside user account created. You can now complete the installation with freeside-install.
Installing using APT
- First, find a repository containing all the required RPMs. If no such repository exists, you can create your own.
- Next, add the repository to your /etc/apt.conf file.
- Finally, install the required components by issuing the command:
apt-get install freeside freeside-mason freeside-postgresql perl-Business-OnlinePayment-AuthorizeNet
At this point all the required components should be installed and the freeside user account created. You can now complete the installation with freeside-install.
Finishing the installation with freeside-install
RPM does little more than installing files and creating users. To allow automated installation and upgrading, well-structured RPMs may not interact with the user. Since part of the Freeside installation is interactive, at some future date a command line utility called freeside-install will be included in the RPM to help you complete the installation. For the moment, just work through the standard install, ignoring the steps which are done by the RPM, i.e. installing files and creating the freeside user. The RPM does not do any steps that require entry of a password, or which have to be done after a password is specified.
- You can skip straight to "Allow the freeside user full access to the freeside database," but be aware that if there are errors in the RPM dependencies, then some of the prerequisites may not be installed.
- Then "Add the freeside database to your database engine:"
- Apache configuration is reduced to editing your httpd.conf file as specified in the last bullet point. (This will be automated in a later Freeside RPM.) You'll also have to modify httpd.conf to implement web interface security.* All the final steps to create the first Freeside user, setup the database, populate the message catalog, and start freeside-queued must be done by hand.
- As with the usual install, you need to do initial administration after completing the install.
Creating your own repository
If you can't find an APT/yum repository for your operating system, you can create your own.
Set up your development environment for building RPMs as non-root
You should always build RPMs as a non-root user.
- First, create an account to build RPMs:
useradd bob
- Next, create a .rpmmacros file in that user's home directory:
su bob vi ~/.rpmmacros %_topdir /home/bob/redhat %_signature gpg %_gpg_path /home/bob/.gnupg %_gpg_name Yourname Here
- Next, create or import a GPG with which to sign the RPMs. (Signing is optional but recommended.)
- Finally, create a set of directories for RPM to use:
su bob mkdir ~/redhat/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
To build Freeside RPMs as a non-root user, your build system must have a freeside user:
useradd freeside
Create the Freeside RPMs
- First, get the Freeside source code as a tarball
cd ~/redhat/SOURCES wget http://www.sisd.com/freeside/freeside-1.7.3.tar.gz
(Ideally you could build the RPMs at this point using a tarbuild: rpmbuild -ta freeside.tar.gz. This doesn't work yet.) You can also get tarballs from CVS using ViewVC.
- Next, untar the tarball and change directory to the folder containing the RPM specfile:
mkdir ~/work cd ~/work tar zxvf ~/redhat/SOURCES/freeside-1.7.3.tar.gz cd freeside-1.7.3/install/rpm
- If you are building modified RPMs, copy your patches and supplemental files to ~/redhat/SOURCES and edit the specfile to make use of them.
- Next, build the RPMs:
rpmbuild -ba freeside.spec
Build the RPMs for required Perl modules
Freeside uses many Perl modules, not all of which are available as RPMs. The simplest way of generating all the required RPMs is to use Ovid, which is available from CPAN, as Ovid works recursively to build RPMs of modules that the current module depends on. Ovid also can build RPM sets from Perl bundle files.
- If you have not used CPAN as the build user yet, configure CPAN:
su bob cpan # And answer all the prompts
- Install Ovid:
cpan install Ovid quit rpm -Uvh ~/redhat/RPMs/i386/ovid-0.12-1.i386.rpm
or
wget http://search.cpan.org/CPAN/authors/id/G/GY/GYEPI/Ovid-0.12.tar.gz rpmbuild -ta Ovid-0.12.tar.gz rpm -Uvh ~/redhat/RPMs/i386/ovid-0.12-1.i386.rpm
- Create bundle files for each of the Freeside RPMs:
mkdir ~/.cpan/Bundle install/rpm/rpm2Bundle ~/redhat/RPMS/noarch/freeside-1.7.3-1.noarch.rpm > ~/.cpan/Bundle/freeside.pm install/rpm/rpm2Bundle ~/redhat/RPMS/noarch/freeside-mason-1.7.3-1.noarch.rpm > ~/.cpan/Bundle/freeside-mason.pm install/rpm/rpm2Bundle ~/redhat/RPMS/noarch/freeside-postgresql-1.7.3-1.noarch.rpm > ~/.cpan/Bundle/freeside-postgresql.pm
- Use Ovid to create RPMs for the main Freeside dependencies:
ovid --skip-perl-rpm-modules --packager='Yourname Here <youraddy@example.com>' \ Bundle::freeside Bundle::freeside-mason Bundle::freeside-postgresql
- Fix up RPMs that did not build. cpan2rpm and cpanflute2 are useful when Ovid doesn't work.
- Use Ovid to create RPMs for all the Freeside dependencies you require:
ovid Business::OnlinePayment::AuthorizeNet
- Fix up RPMs that have inadequate dependency information: perl-HTML-Mason-*.rpm
ovid Bundle::HTML::Mason
Create the repository
- Copy all generated RPMs into your web server space:
mkdir /var/www/html/fedora/7/ cp ~/redhat/RPMS/*/*.rpm /var/www/html/fedora/7
- Sign all the RPMs with your GPG key:
rpm --addsign *.rpm
- Download any programs needed to build the repository. For newer, XML-based versions of yum, you'll need createrepo. If it's in a yum repository, this can be as simple as:
yum install createrepo
. On distros using older versions of yum (e.g. FC2 and earlier), you'll need to use yum-arch instead of createrepo to generate the repository metadata. yum-arch should be installed as part of the yum RPM, so there's no need to install another RPM. - Create the repository:
createrepo /var/www/html/fedora/7
- Make sure the web server is started
- Create a file defining the repository.
At this point your web server is acting as a yum repository with a URL of http://localhost/fedora/7/ and you can proceed to install Freeside from the repository.
Upgrading
Introduction
If you have an existing Freeside installation that was installed from the tarball, following the instructions for installing or upgrading from RPM may result in an operational system where the RPMs have overwritten most or all of the files installed from the tarball or CPAN.
Upgrading using RPM
When there's a new version of Freeside available as RPM, just download the new RPMs and upgrade them:rpm -Uvh --test freeside-1.7.3-1.noarch.rpm freeside-''interface''-1.7.3-1.noarch.rpm freeside-''backend''-1.7.3-1.noarch.rpm
Upgrading using a repository
If you installed the RPM version of Freeside from a repository, and a new version is available on the repository, then you can install the new files on your system using the package manager:
yum update
or:
apt-get update
To avoid unplanned upgrades, you may wish to mark the repository containing Freeside as disabled, or remove it from your yum or apt configuration files.
Finalizing the upgrade using freeside-install
This will not perform any database upgrades, so you should refer to the tarball upgrade documentation and do any database changes by hand. (A future version of freeside-install may be able to perform the database changes needed in an upgrade.)