Line 37: |
Line 37: |
| | | |
| - [[User:unnilennium|unnilennium]] | | - [[User:unnilennium|unnilennium]] |
| + | --------------------- |
| + | --[[User:Stephdl|Stephdl]] ([[User talk:Stephdl|talk]]) 15:01, 11 September 2015 (CEST) Information removed |
| + | |
| + | === GeoIP plugin=== |
| + | We need the GeoIP package and the perl interface to the program but this isn't installed on SME Server. We'll have to grab the packages from yum. Yum has access to different public repositories where packages are available. GeoIP is in the '''[[epel]]''' repository. We'll enable the repository and install them. |
| + | |
| + | yum --enablerepo=epel install perl-Geo-IP |
| + | |
| + | Yum does the magic and knows to install both the program and the interface. |
| + | |
| + | === GeoIP database === |
| + | |
| + | For the plugin to work we need the GeoIP database. This database is maintained and updated a company called MaxMind. We'll have to download it every month for the Lite version we are using here or pay for their subscription service to be as accurate as possible and download once a week. |
| + | |
| + | The database needs to be in a specific location or it won't work. We'll change to that location. |
| + | |
| + | cd / |
| + | mkdir /var/lib/GeoIP |
| + | cd /var/lib/GeoIP |
| + | |
| + | Now we'll get the latest database. The database is also in the repositories but it's outdated. We'll grab the most recent directly from MaxMind. |
| + | |
| + | wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz |
| + | |
| + | The database is zipped. We'll have to unzip it. |
| + | |
| + | gunzip GeoIP.dat.gz |
| + | |
| + | ==== Creating a cron-job ==== |
| + | |
| + | We can add a cron-job to automate the monthly process of updating the GeoIP database: |
| + | mkdir -p /etc/e-smith/templates-custom/etc/crontab |
| + | |
| + | Now we will add a custom template fragment: |
| + | vim /etc/e-smith/templates-custom/etc/crontab/91_Update_GeoIP_db |
| + | |
| + | Add the following to this fragment, this will download and extract the new database every month: |
| + | # Updating the GeoIP database monthly on the 5th at 0:00h. |
| + | 0 0 5 * * root /usr/bin/wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz -O /var/lib/GeoIP/GeoIP.dat.gz; /bin/gunzip -f /var/lib/GeoIP/GeoIP.dat.gz |
| + | To activate the custom template fragment: |
| + | expand-template /etc/crontab |
| + | |
| + | === GeoIP qpstmpd plugin === |
| + | |
| + | The email receiving component of SME Server is called qpsmtpd. It's great because it allows us to turn plugins on or off or create our own when we need. The GeoIP plugin is already in SME Server but it's turned off. I've created a RPM but it's not in any of the repoitories, it's attached to a [[bugzilla: 1866]] ([http://bugs.contribs.org/attachment.cgi?id=3539 direct download]). |
| + | |
| + | '''NOTE''' As of September 5, 2015, the smeserver-geoip package is in the sme8contribs repository. Please refer to the forum issue [http://forums.contribs.org/index.php/topic,51375.msg261678.html#msg261678 Re:smeserver-geoip] for notes on enabling the repo and downloading the package. |
| + | |
| + | --------------------------- |