Monday, April 30, 2012

Easy 'mail by smarthost' SMTP server in Ubuntu 12.04 GNU/Linux

After being tasked with setting up some servers that need to use a local MTA (Mail Transfer Agent) (via SMTP) on our internal network, I found the setup for the Ubuntu 12.04 GNU/Linux exim4 MTA to be pleasingly simple. Easy Peasy, works for me!

Assuming you already have a main mail server in your organization that you can use as a "smarthost" relay, run through these simple steps and you will be up and running with a local SMTP server on your Ubuntu GNU/Linux box in no time.


1.) Install the MTA package on your Ubuntu 12.04 GNU/Linux box:

sudo apt-get install exim4-daemon-light

2.) Configure the MTA with this command and steps, replacing somedomain.com with your mail domain name:

sudo dpkg-reconfigure exim4-config

  • Set postmaster email: postmaster@somedomain.com
  • Select 'mail sent by smarthost; no local mail'
  • Set somedomain.com at the "System mail name" screen
  • Set defaults(hit enter) until you get to the step below
  • Enter mail.somedomain.com for the "IP address or host name of the outgoing smarthost:"
  • Set defaults all the way to the finish

That's it! exim4 should restart and you'll be ready to test. Now wasn't that easy?

Now check if the smtp server is listening on port 25 (smtp) with these terminal commands:

netstat -ano |grep :25

Should see something like:
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN off (0.00/0/0)

Test the setup by sending an email to yourself from the Terminal:

echo "Yay - SMTP works" | mail -s "Test email" youremail@somedomain.com

That's it! Now you're free to go and get the beverage of your choice and drink to the awesomeness of the makers of FOSS/GNU/Linux/Ubuntu.

Cheers!

Shannon VanWagner
04-30-2012



Thursday, April 26, 2012

How to install NX Free Edition on Ubuntu 12.04 Precise Pangolin

Screenshot of NX client connection to Ubuntu 12.04 with NX Free
Ubuntu GNU/Linux comes pre-loaded with the capability to remotely connect to the graphical desktop of your machine by means of a "Desktop Sharing" utility based on the VNC protocol. Clients can connect with a VNC viewer, i.e., tightvnc, vncviewer, etc.

While this may be a viable option for others, VNC has a few drawbacks that sent me looking for something a little more suited for my situation. Namely, I needed a speedy connection, and security.

One problem with VNC is that it's a non-encrypted and therefore non-secure protocol. The workaround for this is to configure the server to tunnel VNC client connections through SSH sessions. Unfortunately, doing this requires extra configuration on both the server and the client.

Another problem with VNC (at least one that I've experienced) is the laggy connections, which can make the user experience less than optimal. So in my search for a better alternative, I found "NX Free Edition" by www.nomachine.com.
 
NX Free Server delivers the X Window session to clients via the encrypted SSH (Secure Shell) protocol, and it does it much faster and snappier than my experience with VNC. The only drawback of NX Free Edition is the license, as it is proprietary..

Although "NX Free" edition is said to be "free forever". Looking at the license file in the .deb package, it appears there are a number of GPL-covered items there, and then some items with the proprietary license. Checkout the license for NX Free for yourself here.

On the subject of NX servers, there is a FreeNX server PPA for Ubuntu 12.04(and other LTS versions), it's named ppa:freenx-team . Unfortunately, at the time of this writing, the packages from the ppa:freenx-team didn't seem to work properly for me. There was some error message concerning the esound dependency package not being available for install.

So, instead of FreeNX, we'll install NX Free Edition with the provided .deb installers instead. I used the 64-bit versions in my tests. Apparently, the big difference between 'FreeNX' and 'NX Free Edition' is that FreeNX is wholly FOSS and has no connection limits whereas the NX Free Edition is only partially FOSS and is limited to 2 client connections (according to the license page at the link above).

Before installing the NX Free Edition pacakages from: www.nomachine.com, first install the openssh-server package from the Ubuntu repositories.

sudo apt-get install openssh-server

After the pre-requisite has been installed, download and install the 3 NX Free Edition components from the "NX Free Edition for Linux" section at www.nomachine.com ( packages are installed in this order: client / node / server). Example:
sudo dpkg -i nxclient_3.5.0-7_amd64.deb
sudo dpkg -i nxnode_3.5.0-7_amd64.deb
sudo dpkg -i nxserver_3.5.0-9_amd64.deb

As for the connection to the NX Free Edition server, simply download the client from www.nomachine.com that works with your platform. There are versions for all 3 of the Major operating systems available.

As of this writing, the regular Ubuntu session provided by NX Free server doesn't quite work as expected . Not to worry, the 'ubuntu-2d' session does work well. I'm working on getting the appropriate server-side configuration for this so the setting won't be required at the client, but in the mean time, the workaround is to configure the NX Free client Session setting as follows:
Application > "Run the following command": gnome-session --session=ubuntu-2d

Options > Enable 'New virtual desktop'


That's it. NX Free Edition works great and it's one solution to the problem of needing more security and speed over the default VNC client in Ubuntu GNU/Linux. Here's a screenshot of the client connection.



Feel free to leave your comments below. If you are using Ubuntu 11.10 and are having problems with Unity at the client, see this link for the workaround. For more information concerning FreeNX on Ubuntu, see this link.



Looking for the FreeNX Server installation instructions? See my post "How to install FreeNX on Ubuntu 12.04 Precise Pangolin" instead. Cheers!

Shannon VanWagner
04-25-2012




Thursday, April 5, 2012

On Helping Others Get their GNU/Linux & Consider Doing So

So one day I'm looking at my Google + page and I get this notification of a message:

"Can you help me to configure chip ralink rt2870 on Ubuntu(GNU/Linux), please?"

I really can't imagine at all, I mean I am absolutely dumbfounded as to why this person would contact me.. Really, it's not like I post (on average) 5 stories about GNU/Linux a day or anything... haha..

Turns out the driver this person needed was one of the types where it hadn't made it into the Linux kernel just yet, but the source code was out there. And so a module had to be built from source and installed on the machine to make the wireless adapter work.

Usually these types of problems are relatively easy to get fixed, because: a.) GNU/Linux is open source and so bugs can get fixed (or worked around) by anyone with the technical know-how, and b.) there are kind people out there that take their own time to post the specific step-by-step instructions to repair the problems. However, sometimes finding the correct "fix" to match your specific hardware configuration can be tricky. GNU/Linux has a great many tools to detect what type of hardware is in the machine, but(luckily) there are many different types of hardware out there.

Aside from finding a fix that applies to your specific hardware, another problem (and this can apply to any OS), is that  you can get into these situations where, if you don't cleanly de-install previous attempts at a fix that you have made, the residual clutter can mess things up for anything new that you're trying to install. When this happens, a crucial ingredient to success can sometimes be lost. That is, the "faith" in a person that they actually can fix the problem in the first place.

So, as it turns out, this person needed to remove the older (and incorrect version) driver that he had installed ( sudo make uninstall from within the source folder ), then start fresh, rebuilding the driver from the correct source, installing the driver, and configuring things correctly for use. I'm fairly certain this person could have knocked this out, had they de-installed the incorrect version they had on their machine and taken a few more steps.


So I respond:

"Which rt2870? Is it the USB stick? Also, which Ubuntu, is it 10.04? If both true then according to this article, you need to blacklist a module, along with a few other seemingly ugly things: http://linuxforums.org.uk/index.php?topic=852.0 (Thanks to: Mark Greaves for posting there ) and http://ubuntuforums.org/showthread.php?t=960642 (Thanks to: Nilsa5 for posting there). But, we'd want to see exactly what you have in terms of wireless adapter and version of Ubuntu before we jump in. You can see the version of Ubuntu with the terminal command 'cat /etc/issue', and the kernel with 'uname -r' or 'uname -a' to show whether you have 32bit or 64bit, and if you have a built-in wireless adapter 'sudo lspci |grep -i network' or USB adapter 'sudo lsusb |grep -i network'. Also, you could see which module is loaded with 'sudo lsmod | grep rt2870sta' or 'sudo lsmod | grep rt2800usb'."

And after some back and forth, I figured we could save time if I were just to connect to this person's machine and help him fix the problem directly. This is another place where the free stuff comes in, this time it's teamviewer.com (Teamviewer is one of those cross-platform-compatible applications where I could control the remote computer and they could see what I am doing at the same time). There are definitely FOSS alternatives to this, like VNC server/client (some setup required), or we could have used Google Chrome Remote Desktop instead of course. But to me, the main thing is that I only use tools that are cross-platform-compatible(this is a must), and in this case, free of charge.


How awesome is it that there are FOSS/GNU/Linux supporting individuals and and companies out there that continue to help to make GNU/Linux better for all of us? Very awesome indeed I say. And also how great is it that some other FOSS-supporting companies (and a few Freeware ones too ) are outright handing us all the tools we need to provide one another support for Technical issues for Free?! Fabulous! How cool is that? So by helping this person get their wireless up and running, that's how I contribute to GNU/Linux/FOSS myself. This brings me great satisfaction, not only as a technologist, but it's also a great feeling to be able to help someone else free themselves from the dungeons of the coercive monopolists and their restrictive software.

So anyway, when I get connected to this person's computer, I am a bit surprised that my left click on the mouse was reversed to the right click! And the person apparently had the language setup for something totally different than mine. Talk about adding a layer of difficulty! What a nice delicious challenge! So then I bring up the gedit on his machine and type to him a message, and it's in this foreign language.. So I'm thinking, that's not going to work.. so then I open his web browser and navigate to google.com/translate (another awesome FREE tool), and we proceeded to use that to communicate, right there on his computer, for the rest of the time.

So, working at the command line, I'm already knowing what commands to use, and so I'm cranking away, de-installing the older driver, checking to ensure dependencies are installed, compiling the new driver, installing the new driver. Then, after some rmmod, insmod, and reboot between.. voila! The driver is finally working! The person, having watched how easy it was, and now seeing that his wireless was working perfectly, was elated and Thanked me profusely. This is a very delightful aspect of FOSS in my eyes, to be helping others and not having to call into some paid-for "support case" because the proprietary OSes come with no warranty.

Recapping it all, the point I wanted to make is how very proud that I was to be able to help a fellow human being with their GNU/Linux. If you have tried GNU/Linux, and have figured out something worth sharing, I suggest you do as well. But you don't have to be a technical person to do good things for FOSS/GNU/Linux. Nope. You can help by simply telling others your stories. Post them on your blog, mention them in comments, correct those nay-sayers, yell it from rooftops! Also, I want to say that I am grateful for FOSS/GNU/Linux, all the people that make those possible, and also for the free tools like Google+, Google Translate, Teamviewer, etc. (the list is exhaustive). Helping others (and ourselves) is the spirit of Technology! Don't let some profiteering, coercive monopolist change your mode of thinking.



Cheers!
Shannon VanWagner
04/05/2012

FREE YOURSELF, Use GNU+LINUX+FOSS! gnu.org | fsf.org | linux.com | getgnulinux.org | ubuntuguide.org | whylinuxisbetter.net | documentfoundation.org | humans-enabled.com | ubuntu.com | distrowatch.com | makethemove.net | livecdlist.com | code.google.com/opensource | sourceforge.net