Archive for March, 2011

How to reduce blog and other SPAM on Elgg by adding meta name rel=”nofollow, akismet and robots.txt

Tuesday, March 15th, 2011

elgg-data-logo
As I'm playing with Elgg – free social network these days, I've been stuck with my newly established elgg based social network gets high amounts of spam via the elgg blog on http://mockateacher.com – my MockATeacher – Student Share Files network

I've researched on how I can reduce the amounts of spam the site gets and I've found few ways for that, let me elaborate on that:

First I've been reading for a while about izap,izap-ecommerce, izap-videos, however my experience with my tests with this ones were not good, thus i won't recommend this plugins to any elgg administrator.
Further on I've installed the elgg Akismet plugin which by the way is very easy to install (just place and unzip the plugin in elgg based website's mod/ directory ).

A quick elgg Akismet configuration is also necessary in order to config go to:

Administration -> Tool Administration -> Akismet [Settings]

All necessary to place in the Akismet [Settings] field is just an akismet, key. I personally have placed my old Akismet obtained key for my wordpress blog installation and therefore I skipped the long and time wasting process of issuing a new API key for Akismet.
Nevertheless if you don't have an Akismet API key already you will have to go Akismet.com and sign up for a new user and a key.
After installing the akismet.

Moving on with the available anti-spam plugins for elgg, I've the antispammer-for-elgg plugin. The installation went smoothly, however I needed a special API key for the plugin which I couldn't issue.
There were some instructions on how to obtain the antispammer-for-elgg API Key in order to start using the plugin by registering first to some forum called stopforumspam.com but even though I've registed in the forum and followed the instructions the forum seems not to allow me to login and therefore I couldn't issue myself an API Key 🙁
The problem is not described on Elgg's website and I do suppose many other elgg enthusiasts have been stucked into the same can't issue antispammer-for-elgg API key problem !

Next I've stubmled upon some very nice suggestions on how to decrease the amount of spam by equipping the elgg based website installation with the following robots.txt file:

User-agent: *
Disallow: /pg/admin/
Disallow: /account/forgotten_password.php
Disallow: /_css
Disallow: /_graphics
Disallow: /account
Disallow: /admin
Disallow: /engine
Disallow: /languages
Disallow: /service
Disallow: /settings
Disallow: /simplecache
Disallow: /vendors

The file needs to be placed in the main directory root of the elgg installation and will instruct:

Google, Yahoo, Bing, Ask Jeeves and Yandex crawlers not to crawl and index the above list of directories.

I've also red online some interesting suggestions to use the &ltmeta robots rel="nofollow> in order to instruct GoogleBot and the rest of the search engine crawlers not to follow the spam links which appear on spammer user blogs and video links.

To implement the rel="nofollow meta in my elgg installation I used the elgg plugin called Metatag_Manager
Metatag manager is ultra easy to install and is installed via the regular elgg installation procedure by placing and unarchiving in mod/ dir
The plugin is lacking a good documentation as with many of the Elgg plugins so it took me a while until I realize how can I Set it up
Thanksfully finally I found that the Metatag Manager plugin configuration is located in:

Administration -> Site Administration

On the Site Administration page you will notice the Robots and Author empty fields.

Now to instruct elgg to show <meta content="nofollow" rel="nofollow"> to all your elgg based website pages (including the user blogs simply fill in the Robots field:

Robots

nofollow

Press the save button and you're done the rel="nofollow" will appear on every elgg generated page and hopefully your social network search engines pagerank will hop up.

I have to say that by so far Elgg is missing a serious anti-spam protection support and the developers should work in that direction to make this awesome project a bit more usable.
I've also noticed there is also a commercial (paid) plugin for Elgg called PluginLotto which appears to be a promising one but since it costs money and I can't afford the fee I have no observations on it.
It would be nice if somebody could share if it's an usable one and it worths the money.

A quick and easy way to install Social Network on Linux/BSD System with Elgg

Monday, March 14th, 2011

elgg-blue-logo
I'm experimenting this days with Elgg – An Open Source Free Software GPLed Social Network which enables users to quickly create Communities.

Elgg is really easy to install and all it requires is a Linux/BSD or Windows system with PHP, MySQL and Apache installed.

Elgg is provided with dozens of nice plugins which for a short time enables individual to create fully operational Social Network like facebook.

Many people nowdays use facebook without realizing how bad facebook is how it breaks their privacy.
Facebook is actually a spy network, it stores data and pictures, likings and user behaviour of million of users around the world.
This needs to be stopped somehow, maybe if people start using the free software networks like elgg to build a mini-community which has profound interests in a certain spheres of work, life and amusement.
The evil empire of facebook will slowly start to loose it's position and the small projects networks based on Elgg and the other Free Software Social Networks which are currently available will start to rise up.
I'm currently really a novice into Elgg but I'm more convinced that the guys who develop it and contribute to it in terms of handy plugins have done really a great job.

It's ultra easy even for non professional middle level user to setup himself an Elgg install.
The installation procedure is not much harder than a simple wordpress blog or joomla based website install.
The installation of elgg takes no more than 10 to 20 minutes, the plugin installation and setup time further could take few days but in the end you have a full featured Social Network! This is really amazing.
The installation of new plugins in elgg is also fool proof / easy all you have to do to equip a newly installed elgg with plugins is to go to it's root directory and look for the mod directory. The new plugins which needs to be installed, could be directly downloaded and saved via links, elinks, lynx or even wget to the elgg installation directory.

Most of the elgg plugins comes in a form of zip files so after being installed simply executing:

server:/home/elgg/mysocialnetwork/mod# unzip walltowall.zip
....

The above cmd will for example unzip the WallToWall elgg plugin and the plugin will be further ready to be enabled via the administrator user set upped during your elgg installation.

The configurations of elgg are being accomplished via:

Administration -> Tool Administration

I should I'm still experimenting with Elgg social, until this very moment I've installed the following elgg plugins:

aaudio
akismet
artfolio
blog
bookmarks
buddytalk
captcha
categories
chat
crontrigger
custom_index
custom_profile_fields
default_widgets
diagnostics
elgg-ebuddy
embed
embedvideo
emoticons
externalpages
family
fbconnect
file
file_tree
flyers
forum
friend_request
friends
garbagecollector
groups
htmlawed
invitations
invitefriends
izap_videos
kaltura_video
lastfm
likes
logbrowser
logrotate
lucygames
members
messageboard
messages
milockergames_frameme
noscript_message
notifications
pages
polls
profile
reportedcontent
resume
river_comments
riverdashboard
riverfaces
search
siteaccess
tagcloud
theme_simpleneutral
thewire
tidypics
tidypicsExt
tinymce
twitter
twitterservice
user_contact_list
uservalidationbyemail
walltowall
weather
wp1
zaudio

One very handy feature I truly enjoy about Elgg is that it gives every user an own blog which or in other words when somebody registers in Elgg, he automatically gets a personal blog! How cool this is Yeash 😉
The Elgg photo upload plugin is also another interesting story. The photo plugin is a way better from my first impressions than facebook's buggy upload client.
Elgg also uses heavily jquery for it's various operations and the user experience feels very interactive.

Of course as with all free software things are not perfect some of the elgg plugins or (mods) as they are called are not working.
For example I couldn't make by so far the weather plugin which is supposed to report the weather.

Maybe some tweakening of the not working plugins will easily make them working. What is really important is that the Elgg basis system looks and seems to work really good and enpowers the user with a social network alternatives to the ugly facebook.

In order to experiment with Elgg and I've established a small social network targetting at University College and School Students called MockATeacher – mockateacher.com>/i>. The idea behind is to help students in their report writting by providing them with a place where they can meet other students and share files.

Some other aspects I've planned for MockATeacher is to build a small community of people who would like to share about idiot teachers, teacher stupid sayings as well as to mock the idiotic type of education that we and our children are up to in this age.
Just to close up, if you're looking for some time to spend in experimenting in an enjoyable way you definitely need to install elgg and play with it 😉

core dump after PHP5 and php5-extensions recompile (rebuild) from ports on FreeBSD – cause and solution

Monday, March 14th, 2011

On my FreeBSD 7.2 system where I host few of my small projects. I have been running Apache 2.0.63 with php 5.3.2 for about a year and a half.

I was pretty happy with this configuration just until today, when I decided to play a bit with the elgg social network building free software platform
The elgg’s CAPTCHA feature on my php 5.3.2 installation was not running properly, the picture of the elgg captcha wasn’t appearing.
First I suspected I might be missing the php-gd support in compiled PHP, however after checking up in both phpinfo(); and with pkg_info I’ve figured out I had the php-gd-5.3.2 bsd package properly install.

However after some investigation on the net I’ve figured out my gd package and php5-gd were both lacking a freetype support.
In that situation I took the option to rebuild my php5 and php5-extensions installed from the port tree.

Of course before I can build it properly I had to upgrade a number of bsd tooks like autoconf but anyways as this is not the target of this post I’ll skip that and proceed to the essence.

After being able to properly build the php5 and php5-extensions latest packages from my bsd port tree after a port three upgrade my Apache server and php cli was failing to start with a core dumped message.

That was pretty odd as no error was reported neither in php_error.log nor in my httpd-error.log

As I’ve been through a similar problem some long time ago during my php interpreter compilation I investigation the issue and found out that my /usr/ports/lang/php5 port after compiled with:

freebsd /usr/ports/lang/php5# make install clean

is running fine. The Apache server with a simple php without any extension prooved also to run without the the shitty core dumped fail message.
Therefore in order to find out the exact reason for the core dumped failures after compilation and installation of the /usr/ports/php-extensions I went through manually installing all my selected extensions from that port through the make config command:

After about 40 minutes of manual installation of the complete list of php5 modules which I need for my proper website operations I’ve figured out that after installing the php5-recode port the php and apache server started immediately crashing with the core dumped

As php5-recode wasn’t that necessary for my proper php operation I decided to remove this module and my PHP enpowered Webserver was back to normal.

The complete list of extensions which I’ve installed next to the php5 port on my FreeBSD are:

freebsd /root# pkg_info |grep php5-
php5-bz2-5.3.5 The bz2 shared extension for php
php5-ctype-5.3.5 The ctype shared extension for php
php5-dom-5.3.5 The dom shared extension for php
php5-fileinfo-5.3.5 The fileinfo shared extension for php
php5-ftp-5.3.5 The ftp shared extension for php
php5-gd-5.3.5 The gd shared extension for php
php5-gettext-5.3.5 The gettext shared extension for php
php5-gmp-5.3.5 The gmp shared extension for php
php5-hash-5.3.5 The hash shared extension for php
php5-iconv-5.3.5 The iconv shared extension for php
php5-imap-5.3.5 The imap shared extension for php
php5-json-5.3.5 The json shared extension for php
php5-mcrypt-5.3.5 The mcrypt shared extension for php
php5-mysql-5.3.5 The mysql shared extension for php
php5-pcntl-5.3.5 The pcntl shared extension for php
php5-posix-5.3.5 The posix shared extension for php
php5-pspell-5.3.5 The pspell shared extension for php
php5-readline-5.3.5 The readline shared extension for php
php5-session-5.3.5 The session shared extension for php
php5-shmop-5.3.5 The shmop shared extension for php
php5-soap-5.3.5 The soap shared extension for php
php5-sockets-5.3.5 The sockets shared extension for php
php5-sqlite-5.3.5 The sqlite shared extension for php
php5-sysvshm-5.3.5 The sysvshm shared extension for php
php5-tidy-5.3.5 The tidy shared extension for php
php5-tokenizer-5.3.5 The tokenizer shared extension for php
php5-wddx-5.3.5 The wddx shared extension for php
php5-xml-5.3.5 The xml shared extension for php
php5-xmlreader-5.3.5 The xmlreader shared extension for php
php5-xmlrpc-5.3.5 The xmlrpc shared extension for php
php5-xmlwriter-5.3.5 The xmlwriter shared extension for php
php5-xsl-5.3.5 The xsl shared extension for php
php5-zip-5.3.5 The zip shared extension for php
php5-zlib-5.3.5 The zlib shared extension for php

The above php5 extensions list will most likely work well right after installation just like in my case in other systems as well, so I would suggest you install the same php extensions directly selecting them from /usr/ports/lang/php-extensions via the make config ncurses interface to save yourself some time.

How to check if server swap is a Linux / FreeBSD server performance bottleneck with vmstat

Sunday, March 13th, 2011

If you’re responsible for heavily loaded bsd unix/linux based server, you will certainly be concerned about the memory consumption.
And in particular concerned that the server swap (hard disk space used as memory) is not used by the crucial system processes like: Apache, MySQL, Squid, Qmail. etc.

The Linux server swap issue is a real hot topic in system administration terms, however many Linux administrators are not aware of neither how SWAP memory operates on a Unix system nor how to check if system daemons/processes are using the allocated swap memory.

Just until recently I myself wasn’t much informed about the topic neither and my knowledge about the Linux bsd swap system way of operation was minimal.
As I’m now in a process of performance tweakening of a Debian Linux powered server it was necessary to re-educate myself to get a better glimpse on how the swap system works and how to get statistics related to the swap memory

Therefore I decided to write this little article to give a very brief information on a handy command which is very helpful in server system swap monitoring and analysis.The one I mean is vmstat

With vmstat, vmstat as you can check in the command manual Report virtual memory statistics

The command is one of the Unix admin swiss knife;s outfit. Vmstat reports a bunch of information which is not easy to be red by amateur Unix adminsitrator however the most important information presented by vmstat consists in two returned fields, the si and so columns:

A typical output from vmstat looks simlar to:

debian:~# vmstat 5
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
3 3 641308 90468 75180 3357452 1 1 14 31 0 0 3 1 95 1
1 1 641308 60828 74900 3383536 0 0 6 524 3729 2179 4 1 94 1
0 0 641308 64176 74804 3381824 0 0 6 253 3401 2047 3 1 95 1

You can see from the above presented vmstat output that the information it returns looks quite obscure but easy it’s actually very easy to read the major information the admin needs, the most crucial info as I’ve mentioned above is in the si and so columnsThe command 5 parameter instructs the vmstat program to refresh and show output from virtual memory (swap) on every 5 seconds.
The first returned output for si and so column fields is 1, 1 which is pretty much a default behaviour, what is more interesting is the output returned further for instance in the second returned column on the line:

r b swpd free buff cache si so bi bo in cs us sy id wa
1 641308 60828 74900 3383536 0 0 6 524 3729 2179 4 1 94 1
0 0 641308 64176 74804 3381824 0 0 6 253 3401 2047 3 1 95 1

In these output you can see the value of si and so is equal to 0, 0 which is a very perfect case and means the swap memory on this server system where I issue the vmstat command is not used by server system daemons/processes.
Nevertheless in some cases it’s possible that the returned values from vnstat for the si, so fields are non zero and quite a high number if that is the case with you, this is a sure indicator the physical system memory on the server is not enough for the system processes to operate (e.g. Apache, MySQL, PostgreSQL, Squid, Qmail or whatever daemons the server runs are heavily using the server swap or in other terms the server hard disk space based memory is used for normal system operations).

Therefore what is important to be tracked is the si, so returned values on the Unix, Linux server does not grow much above zero r in best case stays at zero.

Now let me explain what the si and so abbreviations stands for. SI stands for the so called page ins
Page ins are chunks of memories by system processes let’s say apache which are sometimes stored in swap, it’s a partial memory content and therefore the presence of si’s used on a system might not be a problem.
A typical example of where page ins or si‘s are used are an Apache server which does fork new proccesses to serve new clients.
in this case the si memory space is used just to store information about the forking of the process and after the process is once spawned the si is used no more.

However the page outs or so column values if present are a sure sign the SWAP is the bottleneck for bad server performance.

In that manner of thoughts if you have high value numbers for so is a sure sign of trouble, if you have numbers in so beware and start thinking about bying more memory for your server 😉

page-outs are used by the Linux system in case if the physical server memory is running low and an extra memory is needed for the server system processes. In that case the memory is freed by exporting data from physical memory to swap memory.
As you can imagine storage of processes operations is enormously slow and server system performance in case of page-outs / si usage is terrible!
vmstat is really handy and having a good understanding of it is very important for the Unix admin, for some further info and better depth on how useful on a unix based system it can be check the manual 😉

How to exclude files and directories from tar archive on Debian Linux / (Cannot open: No such file or directory) cause and solution

Saturday, March 12th, 2011

I’m using a custom script to create the backups of file data on the Linux servers which I administrate.

The script does backup a complete directory with it’s subdirectory structures, however sometimes on one of the servers there was a requirement that some of the directories which are used as cache directories and grow really high in Gigabytes to be excluded from the tar archive.
The server where I have already set up my data backup solution is running Debian Linux and therefore I needed to modify my site_backups.sh file data backup script to exclude a number of directories from my target backup directory /home/mydata/ .

I haven’t recently used the tar –exclude option, so I had to experiment a bit with the option, check some info online and check the tar manual.

After my little experiments finally I found out the proper way to exclude files from my tar archives and decided to put it on my blog in hope that it might be of use to some other Linux / Mac hobbyists out there.

Here is how I was able to properly exclude my directories from my tar archive:

debian:~# /bin/tar -czvf my_tar_archive_name.tar.gz /home/mydata
--exclude="{"/home/mydata/dirtoexclude1/*",
"/home/mydata/dirtoexclude2/*","/home/mydata/dirtoexcludeN/*"}

Note that it is possible to put each of the excluded directory under a separate –exclude like for instance:

debian:~# /bin/tar -czvf my_tar_archive_name.tar.gz /home/mydata
--exclude='/home/mydata/exampledirtoexclude1/*'
--exclude='/home/mydata/exampledirtoexclude2/*'

Note that I experienced problems with setting the directories to be exclude if I try to place the tar –exclude option before the specified target directory to be placed in the archive.
Just to give you an example if you try to set the tar exclude like:

debian:~# /bin/tar -czvf my_tar_archive_name.tar.gz
--exclude="{"/home/mydata/dirtoexclude1/*",
"/home/mydata/dirtoexclude2/*","/home/mydata/dirtoexcludeN/*"} /home/mydata

You will get errors indicating the excluded directories as missing, if you try to invoke the exclude as shown in the 3rd command example you will get errors like:

/bin/tar: --exclude=/home/mydata/dirtoexclude1/*: Cannot open: No such file or directory
/bin/tar: Error is not recoverable: exiting now

Just in case if you’re experiencing this tar error whether trying to exlude directory this is probably caused by the wrong placement of the –exclude tar command directive, just change the –exclude option placement as shown in the first two commands in my post and the exclude will be fine.

How to enable CAPTCHA (Visual Confirmation) on Debian PHPBB Forum ver 3.0.2-4

Saturday, March 12th, 2011

I have a phpbb forum for a while now and as it’s now indexed in seach engines Google, Yahoo, Bing, Yandex etc. the forum is already tortured by dozen of spam bots crawling with requests to register.
For a few months already I’ve configured the new registration requests in the forum to demand adminstrator confirmation.

However my administrator configured email address is receiving tons of spam (requests of spam bots for new users registration).
The whole purpose of the spam bots are to register on my phpbb board in order to post spam links and that way increase certain pages pagerank in search engines, pretty nasty …

My phpbb forum is happily installed on a Stable release of Debian Lenny and my exact installed phpbb3 package version is 3.0.2-4

Luckily this version of phpbb board includes already embedded support for Visual Confirmation (e.g. CAPTCHA support).

In order to enable this support these are the exact steps I had to follow:

1. Login to phpbb forum with admin user
2. Go to bottom of the forum and click over Administration Control Panel
3. Navigate to:

GENERAL -> BOARD CONFIGURATION (Visual confirmation settings)

On the screen which will appear in General options make sure the following options are set:

Enable visual confirmation for registrations: Enabled
Enable visual confirmation for guest postings
GD Captcha: Yes
GD Captcha foreground noise: Yes

Now simply press the Submit which is located in the bottom and the CAPTCHA in new user registration on your phpbb forum will appear.

How to track server disk activity on Linux with iostat

Friday, March 11th, 2011

If you need to check the read/write throughput on a Linux just like I needed recently you might want to checkout iostat

This little handy tool is part of the Linux performance tools bundled together in the package sysstat

There is plenty of information that iostat can provide you with concerning your hard drive activity however the most basic one which I need and use is:

debian:~# watch iostat -p -m

You will get output from the command similar to:

Every 2.0s: iostat -p -m Fri Mar 11 14:11:14 2011

Linux 2.6.26-2-amd64 (debian) 11/03/11 _x86_64_

avg-cpu: %user %nice %system %iowait %steal %idle
2.61 0.07 1.45 0.78 0.00 95.08

Device: tps MB_read/s MB_wrtn/s MB_read MB_wrtn
fd0 0.00 0.00 0.00 0 0
sda 20.54 0.66 0.24 15546337 5620965
sda1 20.06 0.65 0.23 15431880 5407656
sda2 0.48 0.00 0.01 114455 213309
sdb 20.04 0.59 0.29 14032121 6836186
sdb1 20.02 0.59 0.29 14026659 6830632
sdb2 0.02 0.00 0.00 5460 5553
md0 62.91 0.10 0.22 2421986 5306950

In the above command I also use the watch command in order to execute the iostat -p -m command continuously every 2 seconds to refresh the output results.
The -p option without an option will automatically show statistics for all hard drives and the -m option is passed in order to show the statistics in megabytes instead of blocks

A full-featured cool post editor like MS-Word for WordPress Blogs (FCKEditor)

Friday, March 11th, 2011

I have recently installed a new blog for my younger sister and thus am establishing a number of handy plugins to make her blog more convenient for writting posts etc.

The default text editor embedded with the default wordpress install is very unflexible and thus I looked around on the net for good substitutes which will enable my sis to feel a bit like using MS-Word.

The plugin that “made the day” was FCKEditor . The installation of the FCKEditor plugin is just like any other easy to install wordpress plugin and in newer wordpress installations for instance in ver. 3.1 it can be searched directly online and installed with 2 simple clicks.
After the plugin succesful installation I enabled it and voilla, that was all. The plugin automatically overwritted the default wordpress html editor and added up a dozen of edit buttons like you can see in the screenshot below:

wordpress fsckeditor screenshot

How to Add new links to PHPBB forum navigation bar on prosilver theme

Friday, March 11th, 2011

I own a phpbb forum which uses the prosilver phpbb theme and I wanted to add a link to external website in the navigation header of the forum.
Here is how I did it:

On phpbb forum installation on Debian Linux the file which needs to be changed is called overall_header.html
The overall_header file name is found on 4 times on my install, as follows:

/usr/share/phpbb3/styles/prosilver/template/overall_header.html
/usr/share/phpbb3/www/adm/style/overall_header.html
/var/cache/phpbb3/cache/ctpl_admin_overall_header.html.php
/var/cache/phpbb3/cache/tpl_prosilver_overall_header.html.php

The files which I had to modify to add my external link to the forum navigation bar were:

/usr/share/phpbb3/styles/prosilver/template/overall_header.html
/var/cache/phpbb3/cache/tpl_prosilver_overall_header.html.php
Therefore to add the external link to the forum edit the two files overall_header.html and tpl_prosilver_overall_header.html.php

In each of the files look up for the code:

<ul class="linklist navlinks">

After the end of this code section which ends up with >/ul< add the following html code:

<ul class="linklist navlinks2"><li><a href="http://newurladdr.com"> newurladdr </a> •</li>
<a href="http://newurl.com"> newurl </a>

</ul>

Now save the files and go to your forum, the newly added links will show up. Enjoy