Category Archives: Linux

Postfix with gmail as relay on Debian Squeeze

My Situation

A server running Debian Squeeze.
A valid Gmail account.

Procedure

Make sure you have the right packages installed
# aptitude install postfix libsasl2 ca-certificates libsasl2-modules

Make a backup of your original files
# tar cfz /var/backups/etc-postfix_20121105.tgz /etc/postfix/

Modify /etc/postfix/main.cf
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl/passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

Create /etc/postfix/sasl/passwd with your “user” and “password” values
[smtp.gmail.com]:587 theuser@gmail.com:thesecretpassword

Secure your new file and make it usable for Postfix
# chmod 400 /etc/postfix/sasl/passwd
# postmap /etc/postfix/sasl/passwd
# ls -l /etc/postfix/sasl/
total 12
-r-------- 1 root root 57 Nov 5 00:39 passwd
-rw------- 1 root root 12288 Nov 5 00:40 passwd.db

Make sure you have the right certification authorities available to Postfix
# cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem >> /etc/postfix/cacert.pem
# cat /etc/ssl/certs/Equifax_Secure_Global_eBusiness_CA.pem >> /etc/postfix/cacert.pem

Restart Postfix
/etc/init.d/postfix restart

done

Android on Ubuntu: IOException on aapt

As I told in a previous post, I’m setting up a new Ubuntu installation and I want to compile something for Android on it.

After installing Android SDK I got this error on my first iteration of “ant debug”

BUILD FAILED
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:621: The following error occurred while executing this line:
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:657: Execute failed: java.io.IOException: Cannot run program "/home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt": error=2, No such file or directory

The error is in some way misleading because the binary is there, but the problem is that it’s a 32-bit executable

max@praxi:~$ ls -l /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt
-rwxr-xr-x 1 max max 929400 Jul 27 14:33 /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt

max@praxi:~$ file /home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt
/home/max/AndroidSDK/android-sdk-linux/platform-tools/aapt: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped

The solution is near: we need 32-bit libraries

root@praxi:~# aptitude install ia32-libs

As always it’s a good idea to RTFM:

The Android Ant-based build system requires Ant 1.8.0

I’m setting up a new Ubuntu installation (Quantal Quetzal) and I’m going to play with some Android code on it.

The first test I did after installing the Android SDK gave me this result:

BUILD FAILED
/home/max/AndroidSDK/android-sdk-linux/tools/ant/build.xml:377: The Android Ant-based build system requires Ant 1.8.0 or later. Current version is 1.7.1

This is not what I needed, but fortunately the solution is easy enough.
Doing something like this solved my issue:

root@praxi:~# aptitude install ant=1.8.2-4build2

Done