Difference between revisions of "Samba4/OSX"

From SambaWiki
m
m (Updated link)
 
(15 intermediate revisions by one other user not shown)
Line 1: Line 1:
A brief howto on installing Samba 4 alpha14 on OS X. **Incomplete**
+
A brief howto on installing Samba 4 alpha18 on OS X Lion (non-server). **Incomplete**
 
==Dependencies==
 
==Dependencies==
Install MacPorts using the instructions on [http://www.macports.org/ macports.org]. Once your MacPorts system is set up how you like it, type in the following command to install the dependencies.
+
Install MacPorts using the instructions on [http://www.macports.org/ macports.org].
  +
===Bind 9 with Dynamic Updates===
# port install python27 python_select gnutls readline talloc && python_select python27
 
  +
Edit the Portfile in MacPorts to build Bind 9.9.0 for Samba 4 dynamic updates. The file is located at /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/net/bind9/Portfile
  +
<pre>
  +
configure.args --mandir=${prefix}/share/man \
  +
--with-openssl=${prefix} \
  +
--with-libxml2=${prefix} \
  +
--enable-threads \
  +
--enable-ipv6 \
  +
--with-dlopen=yes
  +
</pre>
  +
Then install bind9 and other dependencies
 
# port install bind9 gnutls readline talloc popt
   
 
==Compiling, Installing and Provisioning==
 
==Compiling, Installing and Provisioning==
You can use Git as in [[Samba4/HOWTO|general guide]], or you may prefer to use releases:
+
You can use Git as in [[Setting_up_Samba_as_an_Active_Directory_Domain_Controller|general guide]], or you may prefer to use releases:
$ curl <nowiki>http://download.samba.org/samba/ftp/samba4/samba-4.0.0alpha14.tar.gz</nowiki> -o samba-4.0.0alpha14.tar.gz
+
$ curl <nowiki>http://ftp.samba.org/pub/samba/samba4/samba-4.0.0alpha18.tar.gz</nowiki> -o samba-4.0.0alpha18.tar.gz
$ tar -xvjf samba-4.0.0alpha14.tar.gz
+
$ tar -xvjf samba-4.0.0alpha18.tar.gz && cd samba-4.0.0alpha18
  +
$ cd samba-4.0.0alpha14/source4
 
  +
Since MacPorts installs Bind 9.9.0, we have to make a small change in source4/dns_server/dlz_minimal.h
$ export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig<sup>1</sup>
 
  +
$ ./configure<sup>2</sup>
 
  +
#define DLZ_DLOPEN_VERSION 2
  +
  +
And we can go ahead with compiling Samba 4.
  +
  +
$ ./configure.developer --prefix=/opt/local/samba
 
$ make
 
$ make
 
# make install
 
# make install
 
# ./setup/provision --realm=samdom.example.com --domain=SAMDOM --adminpass=SOMEPASSWORD --server-role='domain controller'
 
# ./setup/provision --realm=samdom.example.com --domain=SAMDOM --adminpass=SOMEPASSWORD --server-role='domain controller'
  +
==Setting up Samba 4==
  +
export PATH="/opt/local/samba/sbin:/opt/local/samba/bin:$PATH"
  +
===Kerberos===
  +
In order to use Samba 4's included Kerberos and NetBios servers we need to first disable the ones that ships with Lion. Execute the following commands
 
# launchctl unload /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist
 
# launchctl unload /System/Library/LaunchDaemons/com.apple.netbiosd.plist
  +
# ln -s /opt/local/samba/private/krb5.conf /etc/krb5.conf
  +
  +
=== Configure DNS===
  +
For some reason bind looks for a so extension instead of a dylib. We can patch this up with a quick link.
  +
# ln -s /opt/local/samba/lib/bind9/dlz_bind9.dylib /opt/local/samba/lib/bind9/dlz_bind9.so
  +
There are some other things to tweak before bind9 will start properly.
  +
# cp /opt/local/var/named/db.cache.dist /opt/local/var/named/db.cache
  +
# cp /opt/local/var/named/db.127.0.0.dist /opt/local/var/named/db.127.0.0
  +
# cp /opt/local/var/named/db.localhost.dist /opt/local/var/named/db.localhost
  +
# cp /opt/local/etc/named.conf.dist /opt/local/etc/named.conf
  +
Now you can add the following lines to include Samba's dynamic updates (in file /opt/local/etc/named.conf)
  +
include "/opt/local/samba/private/named.conf";
  +
and add these two lines in the "options" section
  +
allow-query {any;};
  +
tkey-gssapi-keytab "/opt/local/samba/private/dns.keytab";
   
 
==Management with Launchd==
 
==Management with Launchd==
First, we need to disable the built-in Samba 3 services using LaunchCtl. You might want to disable Kerberos.
 
# launchctl
 
launchd% unload -w /System/Library/LaunchDaemons/smbd.plist
 
launchd% unload -w /System/Library/LaunchDaemons/nmbd.plist
 
launchd% unload -w /System/Library/LaunchDaemons/edu.mit.Kerberos.krb5kdc.plist
 
launchd% quit
 
   
==Configuration with Server Admin==
 
 
==Building a PortFile==
 
==Building a PortFile==
 
==Notes==
 
==Notes==
# This was a hack to help autotools find talloc in MacPorts. TODO: Gather more info and build a bug report, if it is still required on alpha15.
 
# Configure.developer build fails when compiling pam_winbind.c. TODO: Investigate and file a bug report.
 

Latest revision as of 22:49, 22 October 2016

A brief howto on installing Samba 4 alpha18 on OS X Lion (non-server). **Incomplete**

Dependencies

Install MacPorts using the instructions on macports.org.

Bind 9 with Dynamic Updates

Edit the Portfile in MacPorts to build Bind 9.9.0 for Samba 4 dynamic updates. The file is located at /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/net/bind9/Portfile

configure.args          --mandir=${prefix}/share/man \
                                --with-openssl=${prefix} \
                                --with-libxml2=${prefix} \
                                --enable-threads \
                                --enable-ipv6 \
                                --with-dlopen=yes

Then install bind9 and other dependencies

# port install bind9 gnutls readline talloc popt

Compiling, Installing and Provisioning

You can use Git as in general guide, or you may prefer to use releases:

$ curl http://ftp.samba.org/pub/samba/samba4/samba-4.0.0alpha18.tar.gz -o samba-4.0.0alpha18.tar.gz
$ tar -xvjf samba-4.0.0alpha18.tar.gz && cd samba-4.0.0alpha18

Since MacPorts installs Bind 9.9.0, we have to make a small change in source4/dns_server/dlz_minimal.h

#define DLZ_DLOPEN_VERSION 2

And we can go ahead with compiling Samba 4.

$ ./configure.developer --prefix=/opt/local/samba
$ make
# make install
# ./setup/provision --realm=samdom.example.com --domain=SAMDOM --adminpass=SOMEPASSWORD --server-role='domain controller'

Setting up Samba 4

export PATH="/opt/local/samba/sbin:/opt/local/samba/bin:$PATH"

Kerberos

In order to use Samba 4's included Kerberos and NetBios servers we need to first disable the ones that ships with Lion. Execute the following commands

# launchctl unload /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist
# launchctl unload /System/Library/LaunchDaemons/com.apple.netbiosd.plist
# ln -s /opt/local/samba/private/krb5.conf /etc/krb5.conf

Configure DNS

For some reason bind looks for a so extension instead of a dylib. We can patch this up with a quick link.

# ln -s /opt/local/samba/lib/bind9/dlz_bind9.dylib /opt/local/samba/lib/bind9/dlz_bind9.so

There are some other things to tweak before bind9 will start properly.

# cp /opt/local/var/named/db.cache.dist /opt/local/var/named/db.cache
# cp /opt/local/var/named/db.127.0.0.dist /opt/local/var/named/db.127.0.0
# cp /opt/local/var/named/db.localhost.dist /opt/local/var/named/db.localhost
# cp /opt/local/etc/named.conf.dist /opt/local/etc/named.conf

Now you can add the following lines to include Samba's dynamic updates (in file /opt/local/etc/named.conf)

include "/opt/local/samba/private/named.conf";

and add these two lines in the "options" section

allow-query {any;};
tkey-gssapi-keytab "/opt/local/samba/private/dns.keytab";

Management with Launchd

Building a PortFile

Notes