Posts tagged with: ubuntu

Setup server to send email directly in Ubuntu without using SMTP gateway

There are a lot of usage for servers such as web hosting, filesharing, application hosting and so on. Most of these servers does no need to have a full fledged email service running in them. However, very often these servers still need to send out emails for example, in the form of alerts such as diskspace full and so on. There are basically 2 ways of doing this,

1) setup server or applications to send email using SMTP login to a proper email server

2) setup server to allow it send out email directly without going through SMTP

The proper way of doing this is using method 1. However it entails a lot of work and I personally prefer method 2. It is much easier to setup and does not rely on SMTP server to send out email. Here, I will show how to setup server to send out email using method 2 on Ubuntu using postfix MTA. It should work for most version of Ubuntu and Debian based system.

apt-get update

apt-get install postfix mailx

During postfix installation, you will be brought to postfix setup screen. If you don’t get that screen, manually type dpkg-reconfigure postfix.

General type of mail configuration: Internet

Just press enter for the rest of the options.

Once this is done, a basic config file will be generated for postfix. You don’t really need to config file. You can just empty it and restart postfix.

cat /dev/null > /etc/postfix/main.cf

/etc/init.d/postfix restart

Test sending out email:

echo testing | mail -s subjecttesting email@youremail.com

Done


Linux 64bit or 32bit?

Linux 64bit has been around for a very long time. It came out long before Microsoft released 64bit version of their Windows. During that time, AMD was the leader in 64 bit processor, thus it was called AMD64 during that time. The name has stuck on until now that some linux packages are using it in their package for 64bit packages. So don’t be puzzled that you will be installing package_AMD64.deb for your debian or ubuntu.

It was a no brainier for me by now that Linux 64bit platform has been established to be very stable and almost all packages comes with it. Being 64bit means your software will have double the bandwidth for memory usage and even processing power. However, in real work, performance is not that much faster. But the main thing about 64bit platform is to break the memory limitation of 32bit which is 4GB RAM.

I would go for 64bit for almost all my OS installation nowadays be it Linux or Windows. However, something happened the other day that made me re-think my perception on 64bit.

Recently, there was a server that I manage that needed to be upgraded. We bought a new server with better hardware specs but it remained 4GB RAM. At that time, we do not think there is a need to add more RAM and server RAMs are not cheap either. As usual, I went for Ubuntu 10.04 LTS 64bit as this is currently our choice of Linux for our servers. After taking few days to painstakingly install, configure and migrated the data from old server, the new server went online. However, the following day we encountered some problems. The server were slow and at one time it even crashed. We had to reboot it and as usual, we check the logs for any signs of problems. Eventually, we found that the APC (Alternative PHP cache) that is running in the server keep churning out error that it does not have enough memory. So we knew this has something to do with memory. We tinkered with APC and the server became more stable and load is now running pretty low at less than 2.0.

However, there are still some problem which we are still not sure whether it is APC or other components like Apache2 or PHP. Eventhough the configurations are all same from old server, the software version is running at newer version. Another few days are spend checking and tinkering until we found the “blank page” problem is due to APC. However, disabling APC does not solve the problem permanently as it will cause the server to run higher load and more memory.

After even more checking, we found that each PHP session is using double the amount of memory from previous server. This eventually lead to the culprit…..64bit. Apparently when you go to 64bit, the amount of memory used will almost become double. That is for certain applications only. In our case, PHP is using double the memory to run the usual stuff but to give 64bit some credit, it does run a bit faster than before. Maybe it is due to the wider 64bit memory bandwidth or maybe it is due to the better processor.

In any case, this taught me a lesson on 32bit vs 64bit.

  1. Use 32bit – if you do not plan to upgrade your system RAM to more than 4GB.**
  2. Use 64bit – if you will definitely be using more than 4GB memory now or later in upgrade. To take advantage of 64bit processor and hardware.

**Bear in mind that it is possible to have 32bit Linux with more than 4GB RAM. Linux 32bit kernel will still be able to make use of all the memory using something called PAE (Physical Address Extension). However, this method does have some limitations. **