SSH Multiplexing

Create a new file in ~/.ssh called config and insert the following:

Host *
ControlMaster auto
ControlPath ~/.ssh/master-%r@%h:%p

Reuse an existing SSH connection when you connect to the same host multiple times. Be sure to chmod 600 the config file.

Update: This is also nice to add (not supported on all versions of ssh client), ControlPersist 4h

Advertisements

NFS server and client configuration

If you prefer to do minimal installs (me too) you may have noticed that nfs functions are no longer in the base. Here’s the quick steps to configure a server and clients.

1. On the “server” edit the file /etc/exports (alter to your needs)

/export/media 192.168.1.0/24(rw,async,no_root_squash)

2. Run /usr/sbin/exportfs -a
3. Run /usr/sbin/exportfs

/export/media 192.168.1.0/24

4. Run yum install nfs-utils
5. Run /etc/init.d/rpcbind start
6. Run /etc/init.d/nfs start

To set these to run at boot:
1. Navigate to /etc/init.d
2. Run /sbin/chkconfig rpcbind on
3. Run /sbin/chkconfig nfs on

Now that the server is up, let’s get the clients configured.
1. Run yum install nfs-utils
2. Modify /etc/fstab (alter to your needs)

192.168.1.254:/export/media /usr/local/media nfs defaults 0 0

3. Run /etc/init.d/rpcbind start
4. Run /etc/init.d/netfs start

To set these to run at boot:
1. Navigate to /etc/init.d
2. Run /sbin/chkconfig rpcbind on
3. Run /sbin/chkconfig netfs on

This should result in a mount on the client. Test this by creating files and making sure they appear in the mount point. Obviously this is just a quick and dirty guide and for further details, consult the appropriate documentation.

If you get the weird UID/GID issue (4294967294) then modify the /etc/nfsmount.conf on the client machines. This value is 4 by default and it’s commented, uncomment it, change it to 3 and save it.

Defaultvers=3

Restart the netfs on the client (which will remount as an NFSv3 client and the UID/GID should revert back to 0 (root).

VMWare and udev weirdness

If you’ve started using RHEL6-ish (Scientific in my case) releases with VMWare, you may run into this problem. Clone a VM from a template, boot it up and it’s network interface won’t light up. Well, we know that’s because of the hardware address mismatch in ifcfg-eth0. VMWare assigns the new VM a new hardware address automatically. What you may not have noticed, is udev renamed eth0 to eth1 and even after you fixed the problem in ifcfg-eth0, the interface still won’t light up. In order to fix this:

1. Edit /etc/udev/rules.d/70-persistent-net.rules
2. Change the end of the line, NAME=”eth1″ to NAME=”eth0″
3. Save and exit, then reboot.

Now the network interface should be up. Some people have suggested simply removing the file /etc/udev/rules.d/70-persistent-net.rules but that did not work, udev simply re-created it with the same values.

Reduce access_log noise

This is just a quick guide to eliminate certain activity from your access_log files.

Create a new file called filter.conf (where you put this depends on your apache deployment). Adapt the patterns as necessary. See apache docs for all the possible variables. You can pile up as many filters as you like.

SetEnvIFNoCase User-Agent "Googlebot" exclude_from_log
SetEnvIfNoCase Request_URI "\.(gif)|(jpg)|(png)|(css)|(ico)$" exclude_from_log
SetEnvIfNoCase Request_Method "(OPTIONS)|(PROPFIND)" exclude_from_log

This file should be included (probably at the global level) for easiest use. For OS provided apache, either put it in /etc/httpd/conf.d or explicitly include it into httpd.conf.

Anywhere you want the filter applied, simple alter you access_log definition to include the parameter after “combined”.

CustomLog "logs/access_log" combined env=!exclude_from_log

Restart apache to pick up the change and review your access_log to make sure it worked.

JBoss AS 7

Deploying JBoss AS 7 on Linux.

1. Download the JBoss AS tarball from http://www.jboss.org/jbossas/downloads/

wget http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.tar.gz

2. Extract the downloaded tarball

tar -zxvf jboss-as-7.1.1.Final.tar.gz

3. Move the folder to a filesystem with plenty of room:

mv jboss-as-7.1.1.Final /usr/local/

4. Rename the folder to jboss (or symlink the versioned folder to jboss)

mv jboss-as-7.1.1.Final jboss

or

ln -s jboss-as-7.1.1.Final jboss

This particular version comes with 2 modes of operation, standalone or domain. You’ll need to choose which one you need. Use the init script from my github repo: (coming soon)