Home News Forums SF Project Help Develop
Samba X SSP Xamba Other projects Need Help?

Compiling Samba

Download:
First download the latest samba source from the Samba site.

Unpack:
Open a Terminal window and use cd to go to the directory where you dowloaded the source to.
Unpack the source with the following command
tar -xvzf samba-2.2.2.tar.gz
Compile and install:
These three commands may take more than an hour. For the last command you need to have root access. Therefore it is proceded by the sudo command. After executing this command it is probably necesarry to enter your own password. You also need to be an admin user.
./configure
make
sudo make install
Samba is now installed.

Starting Samba at boottime:
Now we need to make sure it gets started at boot time. Type the following commands into the Terminal.
mkdir /Library/StartupItems
mkdir /Library/StartupItems/SAMBA
If these directories already exist, the commands will generate an error. Just ignore this.
Now open up TextEdit and copy the following lines to a new file.
#!/bin/sh
. /etc/rc.common

PATH=/usr/local/samba/bin:$PATH;export PATH
MANPATH=/usr/local/samba/man:$MANPATH;export MANPATH

##
# Start up samba deamon
##

if [ "${SAMBA:=-NO-}" = "-YES-" ]; then
{
ConsoleMessage "Starting Samba Server"
/usr/local/samba/bin/smbd -D
/usr/local/samba/bin/nmbd -D
}
fi
Save this under the name "SAMBA" in the directory "/Library/StartupItems/SAMBA". Open a new file and copy the following lines to this new file
{
Description = "Samba Server";
Provides = ("SAMBA");
Requires = ("Resolver","Network");
OrderPreference = "Last";
Messages =
{
start = "Starting Samba Server";
stop = "Stopping Samba Server";
};
}
Save this under the name "StartupParameters.plist" in the directory "/Library/StartupItems/SAMBA".

Now edit the hostconfig file so Samba will indeed start at boot time.
Sudo pico /etc/hostconfig
Now give your password and add the following line to the end of the file
SAMBA=-YES-
Use Ctrl-X to exit. Answer the questions about saving and so on with y and n.

You can also change your hostname in this file. If you are using DHCP or are in a LAN where you have your own hostname, you should change your hostname from -AUTOMATIC- to "yourhostname" without the quotes.

Starting Samba at boottime:
Next you need to create an smb.conf file. Check the man files on how to do this:
man smb.conf
Samba should now be working and be started at boottime. Type the following in the terminal to start it right away, without rebooting.
sudo /Library/StartupItems/SAMBA/SAMBA
To use SWAT you need to do a whole lot more, since you need to add some stuff to the netinfo database. I might post directions on how to do so later.
SourceForge Logo