Compiling Samba Source for the Red Hat Target

Copyright (C) 1999-2000 by Steve Litt, all rights reserved. No warrantee, use only at your own risk.
NOTE: Although this document uses version 2.0.5a as an example, the principles hold true for subsequent versions. Just plug in the version number in place of 2.0.5a.
  1. Log in as root
  2. Back up /etc/smb.conf
  3. Back up /etc/rc.d/init.d/smb
  4. Remove existing Samba with rpm command ( I think it's rpm -x samba, please verify)
  5. Copy samba-2.0.5a.tar.gz to an empty directory. We'll call this empty directory install for the rest of this document.
  6. cd to the install directory
  7. tar -xvzf samba-2.0.5a.tar.gz
  8. Install Samba
    1. Switch to the install/samba-2.0.5a/source directory, make sure you're root
    2. Decide on the desired switches. You can view them with cat configure | grep '\-\-with' | less. In the next step, place the proper --with switches as arguments to ./configure.
    3. ./configure
    4. make
    5. make install
    6. Note that your executables and most other needed Samba files are now in the /usr/local/samba tree.
  9. Edit or create /etc/profile.local. Add the following after any statements changing $PATH or $MANPATH, and before any export statement in profile.local. If you just created it, these will be the only two statements:
  10. In /etc/profile, add source /etc/profile.local, or . /etc/profile.local, as appropriate for the shell, below path in /etc/profile. If the statement already exists you can probably leave it where it is.
  11. Change /etc/rc.d/init.d/smb
    1. Restore /etc/rc.d/init.d/smb from the backup copy (step 3)
    2. Immediately below the line . /etc/rc.d/init.d/functions, add the following new line so this script has Samba's binaries on its path:
    3. Comment out the line [ -f /etc/smb.conf ] || exit 0, and below it add the line [ -f /usr/local/samba/lib/smb.conf ] || exit 0. This line terminates the script if it cannot find smb.conf in the place it expects, so it's necessary to change where it looks.
  12. Create smb.conf
    1. Run testparm. It will issue the following error:
    2. Put a 1 line [homes] only smb.conf in that directory.
  13. Create locks directory
    1. Run testparm. It will issue the following error:
    2. Create directory /usr/local/samba/var/locks. (I don't know the correct permissions to give locks. I can tell you that mine is chmod 751 and appears to work just fine.)
  14. Find any other errors by running testparm until it loads [homes] with no error messages.
  15. Start Samba with /etc/rc.d/init.d/smb restart. This is the command to restart Samba.
  16. smbclient -NL servername
  17. smbclient '//servername/username' -Uusername
  18. Directory install/samba-2.0.5a/docs contains the distribution documentation tree. Place a link to it or copy it elsewhere as appropriate.
  19. Reenable SWAT
    1. Verify this line in /etc/services, and that the line isn't commented:
    2. Edit file /etc/xinetd.d/swat to enable swat with minimal security issues. If necessary for troubleshooting, temporarily remove restrictions, but do so only while not connected to the Internet.
    3. Verify this or a similar line in /etc/inetd.conf, and that the line isn't commented.
    4. In the preceding inetd.conf line, change SWAT's path to its new location,  /usr/local/samba/bin.
    5. Restart inetd:
      1. Use ps ax | grep inetd to find inetd's pid.
      2. kill -1 pid