installation.rst (mod_asn-1.6) | : | installation.rst (mod_asn-1.7) | ||
---|---|---|---|---|
skipping to change at line 22 | skipping to change at line 22 | |||
Installing the ip4r data type into PostgreSQL | Installing the ip4r data type into PostgreSQL | |||
---------------------------------------------- | ---------------------------------------------- | |||
You need to install the contributed `ip4r` data type into PostgreSQL. This | You need to install the contributed `ip4r` data type into PostgreSQL. This | |||
project is found at http://ip4r.projects.postgresql.org/. To install it, | project is found at http://ip4r.projects.postgresql.org/. To install it, | |||
a shared library needs to be built to be loaded into PostgreSQL, and an SQL | a shared library needs to be built to be loaded into PostgreSQL, and an SQL | |||
script needs to be run to make the data type known to PostgreSQL and install | script needs to be run to make the data type known to PostgreSQL and install | |||
functions that use it. | functions that use it. | |||
It would preferable to use a binary package if one exists for your operating | It would be preferable to use a binary package if one exists for your operating | |||
system: | system: | |||
openSUSE/SLE rpm package: | openSUSE/SLE rpm package: | |||
http://download.opensuse.org/repositories/server:/database:/postgresql/ | http://download.opensuse.org/repositories/server:/database:/postgresql/ | |||
The Debian package is called postgresql-8.4-ip4r or postgresql-8.3-ip4r. The | The Debian or Ubuntu package is called postgresql-`VERSION`-ip4r. For Ubuntu 14. | |||
install command would look like this:: | 04 | |||
it's postgresql-9.3-ip4r, for Debian Jessie it's postgresql-9.4-ip4r. | ||||
The install command would look like this:: | ||||
apt-get install postgresql-8.4-ip4r libapache2-mod-asn | apt-get install postgresql-9.4-ip4r libapache2-mod-asn | |||
Gentoo portage overlay: | Gentoo portage overlay: | |||
http://github.com/ramereth/ramereth-overlay/tree | http://github.com/ramereth/ramereth-overlay/tree | |||
If a manual install is required, you need the PostgresSQL devel package of your | If a manual install is required, you need the PostgreSQL devel package of your | |||
operating system and compile a shared library, following the procedure | operating system and compile a shared library, following the procedure | |||
described in the installation instructions provided with the software. | described in the installation instructions provided with the software. | |||
After installing the shared object by package or manual install, you will need | After installing the shared object by package or manual install, you will need | |||
to run the SQL script provided with the ip4r sources:: | to register that extension in your database(s). In old PostgreSQL-versions (up t | |||
o 9.1) | ||||
you run a SQL script provided with the ip4r sources, in later versions you inste | ||||
ad | ||||
register an extension:: | ||||
su - postgres | su - postgres | |||
psql -f /usr/share/postgresql/8.4/contrib/ip4r.sql template1 # on Ubuntu | psql -c "CREATE EXTENSION ip4r" template1 # on Debian/Ub | |||
untu >= postgre 9.1 | ||||
psql -f /usr/share/postgresql/8.4/contrib/ip4r.sql template1 # on Debian/Ub | ||||
untu < postgre 9.1 | ||||
psql -f /usr/share/postgresql-ip4r/ip4r.sql template1 # on openSUSE | psql -f /usr/share/postgresql-ip4r/ip4r.sql template1 # on openSUSE | |||
``template1`` means that all databases that are created later will have the | ``template1`` means that all databases that are created later will have the | |||
datatype available. To install it onto an existing database, use your database | datatype available. To install it onto an existing database, use your database | |||
name instead of "template1". | name instead of "template1". | |||
For instance, if you are on Debian, and you have an existing ``mirrorbrain`` | For instance, if you have an existing ``mirrorbrain`` | |||
database, you would install the data type on it like this:: | database, you would install the data type on it like this:: | |||
su - postgres | su - postgres | |||
psql -f /usr/share/postgresql/8.4/contrib/ip4r.sql mirrorbrain # on Ubuntu | psql -c "CREATE EXTENSION ip4r" mirrorbrain # on Debian/ | |||
Ubuntu >= postgre 9.1 | ||||
psql -f /usr/share/postgresql/8.4/contrib/ip4r.sql mirrorbrain # on Debian/ | ||||
Ubuntu < postgre 9.1 | ||||
psql -f /usr/share/postgresql-ip4r/ip4r.sql mirrorbrain # on openSUS E | psql -f /usr/share/postgresql-ip4r/ip4r.sql mirrorbrain # on openSUS E | |||
It is normal to see a a good screenful of output printed out by the above | It is normal to see a a good screenful of output printed out by the above | |||
:command:`psql` command. | :command:`psql` command. | |||
Creating the database table | Creating the database table | |||
------------------------------------ | ------------------------------------ | |||
Assuming that a database exists already, execute the following command to | Assuming that a database exists already, execute the following command to | |||
install the pfx2asn table into it. The :file:`asn.sql` file ships with | install the pfx2asn table into it. The :file:`asn.sql` file ships with | |||
skipping to change at line 87 | skipping to change at line 92 | |||
su - mirrorbrain | su - mirrorbrain | |||
psql -f /usr/share/doc/libapache2-mod-asn/asn.sql | psql -f /usr/share/doc/libapache2-mod-asn/asn.sql | |||
If you see some ``NOTICE`` printed out by the command, that's normal; it's due t o | If you see some ``NOTICE`` printed out by the command, that's normal; it's due t o | |||
the default logging setup of PostgreSQL which is verbose. | the default logging setup of PostgreSQL which is verbose. | |||
Config file for the import script | Config file for the import script | |||
------------------------------------ | ------------------------------------ | |||
.. versionadded:: 1.1 | ||||
If you happen to have a `MirrorBrain <http://mirrorbrain.org/>`_ setup, you'll | If you happen to have a `MirrorBrain <http://mirrorbrain.org/>`_ setup, you'll | |||
have a configuration file named :file:`/etc/mirrorbrain.conf`, which is | have a configuration file named :file:`/etc/mirrorbrain.conf`, which is | |||
automatically used by the :program:`asn_import` script. No further | automatically used by the :program:`asn_import` script. No further | |||
configuration is needed then. If you have several MirrorBrain instances, the | configuration is needed then. If you have several MirrorBrain instances, the | |||
instance into which to import the data can be selected with the ``-b`` | instance into which to import the data can be selected with the ``-b`` | |||
commandline option. | commandline option. | |||
Alternatively, you need to create config file with the database connection | Alternatively, you need to create config file with the database connection | |||
info, named :file:`/etc/asn_import.conf`, looking like this:: | info, named :file:`/etc/asn_import.conf`, looking like this:: | |||
End of changes. 9 change blocks. | ||||
11 lines changed or deleted | 21 lines changed or added |