Ruby Enterprise Edition 1.8.7 source RPM for CentOS5 / RHEL5

Ruby Enterprise Edition is a server-oriented friendly branch of Ruby which includes various enhancements:

* A copy-on-write friendly garbage collector. Phusion Passenger uses this, in combination with a technique called preforking, to reduce Ruby on Rails applications’ memory usage by 33% on average.
* An improved memory allocator called tcmalloc, which improves performance quite a bit.
* The ability to tweak garbage collector settings for maximum server performance, and the ability to inspect the garbage collector’s state. (RailsBench GC patch)
* The ability to dump stack traces for all running threads (caller_for_all_threads), making it easier for one to debug multithreaded Ruby web applications.

More on Ruby Enterprise Edition’s website:
http://www.rubyenterpriseedition.com/

Download source rpm:
ruby-enterprise-1.8.7-1.el5.src.rpm

Build rpm package using rpmbuild:

[vitalie@silver SRPMS]$ rpmbuild --rebuild --define 'dist el5' ruby-enterprise-1.8.7-1.el5.src.rpm 
Installing ruby-enterprise-1.8.7-1.el5.src.rpm
Executing(%prep): /bin/sh -e /home/vitalie/rpmbuild/tmp/rpm-tmp.89437
+ umask 022
+ cd /home/vitalie/rpmbuild/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/vitalie/rpmbuild/BUILD
+ rm -rf ruby-enterprise-1.8.7-20090928
+ /bin/gzip -dc /home/vitalie/rpmbuild/SOURCES/ruby-enterprise-1.8.7-20090928.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd ruby-enterprise-1.8.7-20090928
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
++ /usr/bin/id -u
+ '[' 500 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /home/vitalie/rpmbuild/tmp/rpm-tmp.89437
+ umask 022
+ cd /home/vitalie/rpmbuild/BUILD
+ cd ruby-enterprise-1.8.7-20090928
+ LANG=C
+ export LANG
+ unset DISPLAY
+ ./installer --auto /usr/local --dont-install-useful-gems --destdir /home/vitalie/rpmbuild/tmp/ruby-enterprise-1.8.7-20090928-root-vitalie
 
[...]
 
Provides: ruby-enterprise(rubygems) = 1.3.2
Requires(interp): /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(VersionedDependencies) <= 3.0.3-1
Requires(pre): /bin/sh
Requires: /usr/local/bin/ruby ruby-enterprise >= 1.8
Processing files: ruby-enterprise-debuginfo-1.8.7-1.el5
Provides: bigdecimal.so.debug()(64bit) bubblebabble.so.debug()(64bit) cparse.so.debug()(64bit) curses.so.debug()(64bit) dbm.so.debug()(64bit) digest.so.debug()(64bit) dl.so.debug()(64bit) etc.so.debug()(64bit) fcntl.so.debug()(64bit) gdbm.so.debug()(64bit) iconv.so.debug()(64bit) libtcmalloc_minimal.so.0.0.0.debug()(64bit) md5.so.debug()(64bit) nkf.so.debug()(64bit) openssl.so.debug()(64bit) pty.so.debug()(64bit) readline.so.debug()(64bit) rmd160.so.debug()(64bit) sdbm.so.debug()(64bit) sha1.so.debug()(64bit) sha2.so.debug()(64bit) socket.so.debug()(64bit) stringio.so.debug()(64bit) strscan.so.debug()(64bit) syck.so.debug()(64bit) syslog.so.debug()(64bit) thread.so.debug()(64bit) wait.so.debug()(64bit) zlib.so.debug()(64bit)
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/vitalie/rpmbuild/tmp/ruby-enterprise-1.8.7-20090928-root-vitalie
Wrote: /home/vitalie/rpmbuild/RPMS/x86_64/ruby-enterprise-1.8.7-1.el5.x86_64.rpm
Wrote: /home/vitalie/rpmbuild/RPMS/x86_64/ruby-enterprise-rubygems-1.3.2-1.el5.x86_64.rpm
Wrote: /home/vitalie/rpmbuild/RPMS/x86_64/ruby-enterprise-debuginfo-1.8.7-1.el5.x86_64.rpm
Executing(%clean): /bin/sh -e /home/vitalie/rpmbuild/tmp/rpm-tmp.76776
+ umask 022
+ cd /home/vitalie/rpmbuild/BUILD
+ cd ruby-enterprise-1.8.7-20090928
+ rm -rf /home/vitalie/rpmbuild/tmp/ruby-enterprise-1.8.7-20090928-root-vitalie
+ exit 0
Executing(--clean): /bin/sh -e /home/vitalie/rpmbuild/tmp/rpm-tmp.76776
+ umask 022
+ cd /home/vitalie/rpmbuild/BUILD
+ rm -rf ruby-enterprise-1.8.7-20090928
+ exit 0

Alternatively you can download just spec file and grab sources from the REE’s website:
ruby-enterprise.spec

ImportError: No module named PIL

After server reinstall Plone website failed to start:

2009-10-11T13:45:56 ERROR Application Could not import Products.ATContentTypes
Traceback (most recent call last):
  File "/data/user/site/parts/zope2/lib/python/OFS/Application.py", line 709, in import_product
    product=__import__(pname, global_dict, global_dict, silly)
  File "/home/apc/ecc/parts/plone/ATContentTypes/__init__.py", line 64, in ?
    import Products.ATContentTypes.content
  File "/home/apc/ecc/parts/plone/ATContentTypes/content/__init__.py", line 26, in ?
    import Products.ATContentTypes.content.link
  File "/home/apc/ecc/parts/plone/ATContentTypes/content/link.py", line 39, in ?
    from Products.ATContentTypes.content.base import registerATCT
  File "/home/apc/ecc/parts/plone/ATContentTypes/content/base.py", line 63, in ?
    from Products.CMFPlone.PloneFolder import ReplaceableWrapper
  File "/home/apc/ecc/parts/plone/CMFPlone/__init__.py", line 215, in ?
    from browser import ploneview
  File "/home/apc/ecc/parts/plone/CMFPlone/browser/ploneview.py", line 12, in ?
    from Products.CMFPlone import utils
  File "/home/apc/ecc/parts/plone/CMFPlone/utils.py", line 5, in ?
    from PIL import Image
ImportError: No module named PIL

Oops, we need to install PIL library, thanks to Dag this is extremely easy on CentOS/RHEL/Fedora:

yum install python-imaging

Munpack – File size limit exceeded

We alreay know how to extract files from Plesk backup with mpack, but if you do receive “File size limit exceeded” error, it can be from the following reasons:

  • Your file system doesn’t have LFS (large file support) support
  • OS limits (limits on the system resources imposed by your administrator)
  • mpack is not compiled with LFS

Check that your filesystem supports files bigger than 2GB (create a test file with “dd” command).

[vitalie@silver ~]$ dd if=/dev/zero of=test.bin bs=1G count=3 # create 3GB file

Then check your file size limits with ulimit command:

[vitalie@silver ~]$ ulimit -a | grep '^file size'
file size               (blocks, -f) unlimited

You can adjust limits from /etc/security/limits.conf, read file comments on how to do it, or read this article:
http://www.cyberciti.biz/faq/file-size-limit-exceeded-error-under-linux-and-solution/

If none above limits you, then the problems comes from mpack, it doesn’t have suport for large files (>2GB).

The guys from the Plesk recommends to grep the backup file, to find begin and end of the file in archive:
http://kb.parallels.com/en/1757

This solutions is not appropriate for large backup files, we’ll just recompile mpack to support large files.

Grab mpack’s RPM source from the Dag’s repository
http://dag.wieers.com/rpm/packages/mpack/mpack-1.6-2.rf.src.rpm

install it:

[vitalie@silver ~]$ rpm -ivh mpack-1.6-2.rf.src.rpm
[...]

Then modify mpack.spec and add the following code after “%build”:

export CFLAGS="-D_FILE_OFFSET_BITS=64"

Then rebuild the package and install it:

[vitalie@silver ~] rpm -ba mpack.spec
[...]
[vitalie@silver ~] rpm -Uvh --force mpack-1.6-3.rf.i386.rpm
[...]

References:

Plesk alternative port for relaying

SMTP stands for Simple Mail Transfer Protocol, it was designed a long time ago when the Internet was a peaceful place. Today we are facing new challenges, so there should be new solutions.

One of the problem is SPAM messages, spammers are keeping to bombard us everyday with junk mails. We did invented black/white list to protect us from them.

If your clients are connecting from an ip address that’s listed in RBL lists (it’s not uncommon for ISPs that are using dynamic ip addresses) they can’t send messages through your server if you are using RBLs.

Disabling RBLs checks it’s not an option, we’ll configure an alternative port for relaying on port 1025 for the clients listed in RBLs.

You can just copy your smtp_psa file and customize it:

cd /etc/xinetd.d/
cp smtp_psa smtp_alt_psa
vim smtp_alt_psa

You need to change service name from smtp to smtp-alt and remove rblsmptd command and it’s -r parameters, finally it should something like this:

# /etc/xinetd.d/smtp_alt_psa
service smtp-alt
{
        socket_type     = stream
        protocol        = tcp
        wait            = no
        disable         = no
        user            = root
        instances       = UNLIMITED
        server          = /var/qmail/bin/tcp-env
        server_args     = -Rt0 /var/qmail/bin/relaylock /var/qmail/bin/qmail-smtpd /var/qmail/bin/smtp_auth /var/qmail/bin/true /var/qmail/bin/cmd5checkpw /var/qmail/bin/true
}

Append the new service to /etc/services:

smtp-alt        1025/tcp        
smtp-alt        1025/udp

And restart the xinetd service:

[root@sirius xinetd.d]# /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]

Verify your configuration with telnet command:

[root@sirius xinetd.d]# telnet localhost 1025
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 sirius.example.net ESMTP
 
# Ctr+] and quit to exit telnet

Now, instruct your clients to change port in SMTP settings from 25 to 1025, they will be able to send mails through your server even you are using RBL lists.

How to disable IPv6 in RHEL, Fedora, CentOS

Open your /etc/modprobe.conf file and append:

# Turn off IPv6
alias net-pf-10 off
alias ipv6 off

Then restart your server.

Using squirrelmail in Plesk

Configuring apache for squirrelmail following this tutorial is not enough. You’ll need to configure squirrelmail too. Edit your /etc/squirrelmail/config_local.php file and paste the following configuration:

// courier-imap settings
$imap_server_type       = 'courier';
$default_folder_prefix  = 'INBOX.';
$trash_folder           = 'Trash';
$sent_folder            = 'Sent';
$draft_folder           = 'Drafts';
$show_prefix_option     = false;
$default_sub_of_inbox   = false;
$show_contain_subfolders_option = false;
$optional_delimiter     = '.';
$delete_folder          = true;
$force_username_lowercase = false;
 
// other settings
$default_charset        = 'iso-8859-1';
$lossy_encoding         = false;
$sendmail_args          = '-i -t';
$encode_header_key      = '';
$hide_auth_header       = false;
$plugins[3] = 'filters';
$abook_global_file = '';
$abook_global_file_writeable = false;
 
$addrbook_global_dsn = '';
$addrbook_global_table = 'global_abook';
$addrbook_global_writeable = false;
$addrbook_global_listing = false;

Flash player for Firefox on linux x86_64

If you are working on a x86_64 system don’t even try to go with 64bit of FireFox, just install 32bit version and enjoy all FireFox’s plugins: flash, java, … don’t waste your time.

Adobe didn’t released yet a 64bit flash plugin for linux, although there exists different workarounds to make 32bit plugins to work on the x86_64 platform they are still buggy.

If you’ll try to use nspluginwrapper you’ll end up with FireFox eating 1GB of ram after you’ll open a few flash sites because it’s leaking memory.

Let’s go to install firefox with flash-plugin, firstly remove firefox x86_64 version and then install i386 version:

[root@silver ~]# yum remove firefox.x86_64
[...]
[root@silver ~]# yum install firefox.i386
[...]

Then we’ll download rpm for linux from Adobe :
http://www.adobe.com/shockwave/download/alternates/

[root@silver ~]# rpm -ivh flash-plugin-9.0.124.0-release.i386.rpm
[...]

Now, you are ready to use your favorite browser on linux x86_64 with flash player.


Update:

An alpha refresh of 64-bit Adobe Flash Player 10 for Linux operating systems was released on 12/16/2008.

Download it from here:
http://labs.adobe.com/downloads/flashplayer10.html

TCP: drop open request from …

If are seeing a lots of “TCP: drop open request from A.B.C.D” messages and you don’t expect a real load the server, you’ll need to enable syncookies. Edit your /etc/sysctl.conf and append the following lines:

# enable syncookies
net.ipv4.tcp_syncookies = 1

Then restart network service.

[root@centurion ~]# /etc/init.d/network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Setting network parameters:                                [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]

Plesk 8.3.0 extract files from backup

Extracting files from a Plesk 8.3 backup it’s not an easy task and it’s time consuming.

Let’s examine backup file:

[root@monster ~]# file plesk_bigserver_2008-07-10.backup 
plesk_bigserver_2008-07-10.backup: ASCII English text, with very long lines

Plesk backup is a multi-part mime-encoded file, you can easy restore one domain or whole server using plesk backup utilities, but when you need a few files from backup you’ll need an external tool like ripemime or mpack.

Requirements:

  • Free disk space minimum 2*backup_file_size
  • mpack tool

Check your free space using df(disk free) command.

[root@monster ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda3             9.2G  2.5G  6.3G  29% /
/dev/hda1             190M   15M  166M   8% /boot
none                 1010M     0 1010M   0% /dev/shm
/dev/hda7              53G   17G   34G  34% /home
/dev/hda6             950M   17M  886M   2% /tmp
/dev/hda5              46G  7.2G   37G  17% /var

Let’s install mpack. On a Redhat/Fedora/CentOS system it’s easy, just subscribe to Dag Wieers’s repository. You’ll need to download rpmforge-release rpm that’s matching your server OS and architecture:

For CentOS 5 and x86_64 architecture we’ll use rpmforge-release-0.3.6-1.el5.rf.i386.rpm:

[root@monster tmp]# wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
[...]
[root@monster tmp]# rpm -ivh rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
[...]
[root@monster tmp]# yum install mpack
[...]

Let’s make a directory where we’ll extract backup files and then extract files there:

[root@monster ~]# mkdir recover
[root@monster ~]# cd recover
[root@monster ~]#  munpack < ../plesk_bigserver_2008-07-15.backup
[...]

Mpack will extract files into separate tar archives where you can locate the domain by archive name and extract files using tar command.