Thursday, July 19, 2012

Git: Ignore All Contents of a Directory but the Directory Itself

You sometime want to ignore all contents of a directory but the directory itself in a commitment, such as cache/ directory for example. It can both reduce the amount of data and temporary files to be stored in the repository.

In case of Git, all you need is to create a .gitignore file inside the cache/ directory with  the content as follows.

*
!.gitignore

The first line tells Git to ignore all contents, but the second line tells Git to keep the file .gitignore, and therefore, keeps it to be a non-empty directory.

Monday, June 11, 2012

Activate OpenMPI on Fedora 17/18/19

On Fedora 17/18/19, and some previous version, there is no default link to OpenMPI binaries and libraries. On 64-bit system, they are located in /usr/lib64/openmpi/{bin,lib,share}. To activate them for everyone to use, we have to make some changes as follows.

For OpenMPI's libraries

$ sudo /bin/sh -c 'echo "/usr/lib64/openmpi/lib" >> /etc/ld.so.conf.d/openmpi-64.conf'
$ sudo ldconfig

For OpenMPI's binaries

$ sudo echo 'export PATH=/usr/lib64/openmpi/bin:${PATH}' >> /etc/profile.d/openmpi.sh
$ sudo echo 'set path = ( /usr/lib64/openmpi/bin ${path} )' >> /etc/profile.d/openmpi.csh

Exit your terminal screen and open it again to activate the new settings.

Done!

@10/Jul/2013: I have made a minor change in title and change the double quote to single quote of the echo command to keep ${PATH} from auto-expansion.

Thursday, April 26, 2012

How to Overcome "Nautilus cannot handle smb locations"

I recently meet a problem with Nautilus in accessing the Windows shares or Samba shares. Whenever I tried "smb://" in Nautilus, I received "Nautilus cannot handle "smb" locations". When I tried to use "Connect to Server" dialog, there was no option "Windows share" in Type field.

After looking at a series of posts on the Internet, I have found that it is the problem of GVFS without Samba support. Consequently, the solution on Fedora is very very simple, just install the gvfs-smb package.

# yum install gvfs-smb

Actually, the most time-consuming part is the problem caused by myself, perhaps. There is some conflict between samba4 and samba (3) on my Fedora 17. The _local repository contains libwbclient v4 which is conflict with gvfs-smb which uses libwbclient v3. It takes very long  time to recognize the reason and to solve it. If you meet the same problem on new Fedoras (16, 17) and cannot solve it, please leave a comment here.

Saturday, April 7, 2012

Setting up RSH on RHEL/CentOS

Although SSH dominates on remote control of Linux/Unix system because of its secure, RSH still has dedicated area to work such as in the internal network of a cluster, for example. However, setting up RSH server is not as trivial as SSH server. It takes some little effort for working properly.

At first step, install RSH server using yum as usual. Do it on every machines.

# yum install rsh-server rsh

RSH service is put under xinetd service, and it is disabled by default. To enable rsh service, open file /etc/xinetd.d/rsh and change "yes" to "no" at the line "disabled".

sed -i "s/^\(.*disable.*=.*\)yes\(.*\)$/\1no\2/g" /etc/xinetd.d/rsh

Next, you have to edit file /etc/securetty to append rsh at the end of it.

# ( grep rsh /etc/securetty ) || ( echo "rsh" >> /etc/securetty )

Now, you can restart xinetd to start rsh.

# service xinetd restart

For each user who wants to use rsh to run commands on remote machines, edit files ~/.rhosts on remote machines to include the hostname or IP address of the local machine. For example, a typical .rhosts file looks like follows.

master
compute-0-0
compute-0-1
compute-0-2

The user on a machine that has such .rhosts file in the home directory allows others from hosts master, compute-0-0, compute-0-1, compute-0-2 run a command on it. Check the man page of rhosts for advanced options.

If you meet some errors related to "back connection", please turn off the firewall of the local machine or at least open ports in range 1011 to 1023, which is normally used for back connection in rsh protocol. By the way, port 514 should be opened on the remote machine too.

Tuesday, April 3, 2012

Decode .HQX File on Linux

A very simple solution is to use UUDeview which is available in many Linux distros. You can also use macutils on Debian-based distros. Or even easier, an online tool is here.

On Fedora:
# yum install uudeview

On Debian/Ubuntu:
# apt-get install uudeview

To decode file fxppd1110bm922ien.hqx, for example, you can use the following command.

$ uudeview -i fxppd1110bm922ien.hqx

Have a good day!