Dustin Larmeir's tech blog.
Posts tagged redhat
Setting up a simple NFS share
Mar 27th
I migrated to Citrix Xenserver yesterday and needed an ISO storage point for my custom OS installs – the easiest solution for this? NFS ( Network File System ) This awesome tool is way to mount other machines across the network as if it was a local file system. In this case I am using an internal backend network that is non-internet facing to share these files with my Xenserver host from a vm. In a nutshell here is a quickway to get a simple share up and running.
This information assumes that 10.8.126.83 is the NFS server and that 10.8.126.82 is the NFS client.
With CentOS/RedHat – NFS and everything needed comes pre-installed by default. You may need to install the nfs-utils packages as shown below:
[root@dev ~]# rpm -qa | grep nfs nfs-utils-1.0.9-42.el5 system-config-nfs-1.3.23-1.el5 nfs-utils-lib-1.0.8-7.6.el5
and you will need to make sure it is configured to start at boot time:
[root@dev ~]# chkconfig --list | grep nfs nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
Server configuration:
In my example here I created a directory called /export/iso for my xenserver iso repository. In order to get this properly shared you will need to create an /etc/exports entry like what shown below:
[root@dev ~]# cat /etc/exports /export/iso (insecure,no_root_squash,rw)
Now we will use exportfs to get the NFS server to start serving this directory:
[root@dev ~]# exportfs -ra exportfs: No host name given with /export/iso (insecure,no_root_squash,rw), suggest *(insecure,no_root_squash,rw) to avoid warning
This gives us a warning based on my config but does not affect the operation. You can set this to serve off a specific hostname if you wish.
Now you will need to add the NFS client ip/hostname to the /etc/hosts.allow config of the NFS server:
[root@dev ~]# cat /etc/hosts.allow # # hosts.allow This file describes the names of the hosts which are # allowed to use the local INET services, as decided # by the '/usr/sbin/tcpd' server. # portmap: 10.8.126.82/255.255.255.0
From here it is now just a matter of mounting the share from the other system. In xenserver there is a storage addition gui for this but we will run through how to mount it from another Linux system as this is what most people will do with it anwyay:
[root@www ~]# mount 10.8.126.83:/export/iso /mnt/
and the end result is:
[root@www ~]# mount | grep mnt 10.8.126.83:/export/iso on /mnt type nfs (rw,addr=10.8.126.83)
and everything now works great!:
[root@www ~]# ls /mnt/ 8.0-RELEASE-i386-disc1.iso ubuntu-9.10-server-i386.iso Fedora-12-i386-netinst.iso
There are tons of options for setting up NFS – my configuration is just for a very basic share.To learn more advanced usage I would check this site out http://nfs.sourceforge.net/ . I hope someone out there finds this useful.
Switched to good ole’ Debian Lenny
Mar 13th
Last night in my zombified state I migrated from RHEL 5 to Debian Lenny as I need to brush up on my Debian skillz. This was alot easier than expected thanks to my good friend rsync. Since we are on this topic lets touch on how to rsync over ssh. The easiest way to do this is shown below:
# rsync -avz -e ssh /localdirectory username@yourdomain.com:/remotedirectory/
This command will connect to the other server via ssh, and copy the directory of /localdirectory to the root of /remotedirectory leaving all permissions and file attributes intact. The optimal way to use this in a backup scheme would be to implement ssh keys on the servers to allow for passwordless logins. This way you can execute a simple backup script via cron during any interval of your choosing. It is important to note that you should never use root on the backup server side when using keys as if this box gets compromised, you would not want the backup server to get rooted as well.
Bittorrent for RedHat Enterprise 5 – Packaged with installer
Nov 7th
Anyone who uses RedHat enterprise will find that plugging into third party repositories to get non standard software is risky. Today I needed to install bittorrent and noticed that the redhat enterprise 5 repository does not have what I need. Well, I got the packages needed and built a installer so that anyone using RedHat Enterprise 5 can install bittorrent easily.
————-
Instructions:
login as root or su
wget http://larmeir.com/downloads/rhel5-bitorrent.tar.gz
tar xvzf rhel5-bitorrent.tar.gz
cd bittorrent-rhel5
sh bt-install.sh
————
And that is it! You will have a fully working bittorrent installation. You can find the commands in /usr/bin
# ls /usr/bin/ | grep bit
bittorrent-console*
bittorrent-curses*
bittorrent-tracker*
To start downloading a torrent us bittorrent-curses
/usr/bin/bittorrent-curses (url or path to torrent with no brackets)
Enjoy! – Dustin
