Installing PySide 1.2.4 on Ubuntu 14.04 LTS

Installing PySide 1.2.4 is quite easy and also has phonon support. Simply copy and paste following lines (line by line) to your terminal:

# sudo apt-get install build-essential git cmake libqt4-dev libphonon-dev python2.7-dev libxml2-dev libxslt1-dev qtmobility-dev libqtwebkit-dev python-pip
# pip install --upgrade wheel
# wget https://pypi.python.org/packages/source/P/PySide/PySide-1.2.4.tar.gz
# tar -xvzf PySide-1.2.4.tar.gz
# cd PySide-1.2.4
# python setup.py bdist_wheel --qmake=/usr/bin/qmake-qt4 --standalone
# pip install dist/PySide-1.2.4-cp27-none-linux-x86_64.whl

 

Postfix: sending email copies of all incoming and outgoing mails to another domain or account

How to send an BCC copy of every incoming and outgoing email to another account? This is fairly simple to do with postfix. First open you main.cf and add or edit following lines:

# vim /etc/postfix/main.cf

now add these two lines:

sender_bcc_maps = regexp:/etc/postfix/archive_domain
recipient_bcc_maps = regexp:/etc/postfix/archive_domain

just a small explanation:

sender_bcc_maps is a regex based text file containing the mapping for outgoing mail
recipient_bcc_maps is a regex based text file containing the mappings for incoming mail

and here is an example line in the archive_domain file:

/^([^@]+)\@example\.com$/    $1@archive.example.com

the above line explained: every user @example.com will have a BCC copy send to that user @archive.example.com

 

Setting Apache2.2 prefork settings correctly

Apache's memory consumption is regulated by the spawned server processes and can easily consume all of your servers memory. If the prefork-module is used following paramters needs to be configured in your httpd.conf:

StartServers          18
MinSpareServers       3
MaxSpareServers       6
ServerLimit           60
MaxClients            60
MaxRequestsPerChild   4000

Now to get this parameters right use the following script to determine the actual memory consumption of one apache child process:

​pgrep httpd | xargs -n1 -I{} cat /proc/{}/smaps | awk '{if ($0 ~ /stack/) {pids+=1} else if ($0 ~/^Shared_/) {shared+=$2} else if ($0 ~ /^Pss:/) {priv+=$2}} END {printf "%.2f MB\n",(priv+shared/(pids*pids))/1024}'

Now to get MaxClients simply take the amount you want to give to apache and divide it with the consumption of one process, depending on the actual load the results may vary. Typically one process took between 30MB and 50MB. The above mentioned configuration is set for 3GB RAM (3*1024MB). Here a thumbrule:

StartServers          = 30% of MaxClients
MinSpareServers       = 5% of MaxClients
MaxSpareServers       = 10% of MaxClients
ServerLimit           = MaxClients
MaxClients            = total memory / one process memory (round down to be safe)
MaxRequestsPerChild   4000