in s talar samba 4 no debian

6
Como instalar samba4 no debian wheezy 1. instalar o debian 7. Para baixar: http://napoleon.acc.umu.se/debiancd/7.1.0/amd64/isodvd/debian7.1.0amd64DVD1.iso 2.Fixar o ip. Obs: no debian como root não é necessário o sudo como no ubuntu. su (para se transformar em root) nano /etc/network/interfaces (nano editor de texto no terminal) auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.10 netmask 255.255.255.0 gateway 192.168.1.1 3. Editar o /etc/resolv.conf nano /etc/resolv.conf domain policiamilitar.govrn nameserver 127.0.0.1 nameserver x.x.x.x (dns de sua rede) 4. editar o hosts. nano /etc/hosts 127.0.0.1 localhost 192.168.0.5 srvsamba4 srvsamba4.policiamilitar.govrn 5. Editar o arquivo /etc/fstab.

Upload: tadeusaboia

Post on 08-Apr-2016

94 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: In s Talar Samba 4 No Debian

Como instalar samba4 no debian wheezy

1. instalar o debian 7. Para baixar:http://napoleon.acc.umu.se/debian­cd/7.1.0/amd64/iso­dvd/debian­7.1.0­amd64­DVD­1.iso

2.Fixar o ip.Obs: no debian como root não é necessário o sudo como no ubuntu.

su (para se transformar em root)nano /etc/network/interfaces (nano editor de texto no terminal)

auto loiface lo inet loopback

auto eth0iface eth0 inet staticaddress 192.168.1.10netmask 255.255.255.0gateway 192.168.1.1

3. Editar o /etc/resolv.conf

nano /etc/resolv.conf

domain policiamilitar.govrnnameserver 127.0.0.1nameserver x.x.x.x (dns de sua rede)

4. editar o hosts.

nano /etc/hosts

127.0.0.1 localhost192.168.0.5 srvsamba4 srvsamba4.policiamilitar.govrn

5. Editar o arquivo /etc/fstab.

Page 2: In s Talar Samba 4 No Debian

nano /etc/fstab

/dev/hda / ext3 user_xattr,acl,barrier=1,errors=remount­ro 0 1

6. instalar ntp. Para sincronização do hora com o horario do observatorio nacional.

apt­get install ntp ­ynano /etc/ntp.conf

Substituir os servidores ntp por:

server a.ntp.brserver b.ntp.brserver c.ntp.br

reiniciar serviço ntp

/etc/init.d/ntp stopntpdate ­B server a.ntp.br/etc/init.d/ntp startntpq ­preboot

7. Instalar samba4.

dependencias:

apt­get install build­essential libacl1­dev libattr1­dev libblkid­dev libgnutls­dev libreadline­devpython­dev python­dnspython gdb pkg­config libpopt­dev libldap2­dev dnsutils libbsd­dev attrkrb5­user docbook­xsl libcups2­dev acl

Download, configuração e instalação do Samba4

# wget ­c http://www.samba.org/samba/ftp/stable/samba­4.0.6.tar.gz

# tar ­xvf samba­4.0.6.tar.gz

# cd samba­4.0.6/

# ./configure ­­enable­debug ­­enable­selftest

Page 3: In s Talar Samba 4 No Debian

# make

# make install

Criar Dominio

/usr/local/samba/bin/samba­tool domain provision

policiamilitar.govrn (minusculo)POLICIAMILITARdcINTERNALSENHASENHA

Testar funcionamento do samba4

/usr/local/samba/sbin/samba/usr/local/samba/bin/smbclient //localhost/netlogon ­UAdministrator%'senha' ­c 'ls'

8. Testar DNS

host ­t SRV _ldap._tcp.policiamilitar.govrnhost ­t SRV _kerberos._udp.policiamilitar.govrnhost ­t A srvsamba.policiamilitar.govrn

9. Copiar o krb5.conf da pasta /usr/local/samba/share/setup/krb5.conf para a pasta /etc

cp /usr/local/samba/private/krb5.conf /etc/

testar o kerberos:

kinit [email protected]

10. Teste Final

/usr/local/samba/sbin/samba_dnsupdate ­­verbose ­­all­names

Page 4: In s Talar Samba 4 No Debian

11. Criar Script de Inicialização.

nano /etc/init.d/samba4

copiar o seguinte conteudo:

#! /bin/sh

### BEGIN INIT INFO# Provides: samba4# Required­Start: $network $local_fs $remote_fs# Required­Stop: $network $local_fs $remote_fs# Default­Start: 2 3 4 5# Default­Stop: 0 1 6# Short­Description: start Samba daemons### END INIT INFO

## Start/stops the Samba daemon (samba).# Adapted from the Samba 3 packages.#

PIDDIR=/usr/local/samba/var/runSAMBAPID=$PIDDIR/samba.pid

# clear conflicting settings from the environmentunset TMPDIR

# See if the daemon and the config file are theretest ­x /usr/local/samba/sbin/samba ­a ­r /usr/local/samba/etc/smb.conf || exit 0

. /lib/lsb/init­functions

case "$1" in start) log_daemon_msg "Starting Samba 4 daemon" "samba"

Page 5: In s Talar Samba 4 No Debian

# Make sure we have our PIDDIR, even if it's on a tmpfs install ­o root ­g root ­m 755 ­d $PIDDIR

if ! start­stop­daemon ­­start ­­quiet ­­oknodo ­­exec /usr/local/samba/sbin/samba ­­ ­D;then log_end_msg 1 exit 1

fi

log_end_msg 0 ;; stop) log_daemon_msg "Stopping Samba 4 daemon" "samba"

start­stop­daemon ­­stop ­­quiet ­­name samba $SAMBAPID # Wait a little and remove stale PID file sleep 1 if [ ­f $SAMBAPID ] && ! ps h `cat $SAMBAPID` > /dev/null then # Stale PID file (samba was succesfully stopped), # remove it (should be removed by samba itself IMHO.) rm ­f $SAMBAPID fi

log_end_msg 0

;; restart|force­reload) $0 stop sleep 1 $0 start ;; *) echo "Usage: /etc/init.d/samba4 start|stop|restart|force­reload" exit 1 ;;

Page 6: In s Talar Samba 4 No Debian

esac

exit 0

Salvar e sair.

Ajustar permissões:

chmod 755 /etc/init.d/samba4

Colocar no boot:

update­rc.d samba4 defaults

12. Depois é só configurar uma maquina windows 7 para configurar usuario e gpos. o programaque gerencia o active directory pelo windows 7 é: Windows6.1­KB958830­x64­RefreshPkg.msu(64 bits) ou Windows6.1­KB958830­x86­RefreshPkg.msu (32 bits)

13. Como criar os compartilhamentos?

http://fpibrasil.forumeiros.com/t424­gerenciamento­de­compartilhamentos­no­samba4

14. como usar samba­tool?

https://wiki.samba.org/index.php/Samba­tool­external