Monday, September 3, 2012

MIGRATE Centos Linux Server from 5.8 to 6.3 with Samba 3.5

all user data need to be backup before doing this procedur

Things to do

Migrate all this component
  1. /etc/passwd
  2. /etc/group
  3. /etc/shadow
  4. home directories and shared directories
  5. /etc/samba
  6. /var/lib/samba
Backup INFO LOGIN & PASSWORD
[root@previous-server ~]# mkdir /root/move
[root@previous-server ~]# export UGIDLIMIT=500

[root@previous-server ~]# awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd > /root/move/passwd.mig

[root@previous-server ~]# awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/group > /root/move/group.mig

[root@previous-server ~]# awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /root/move/shadow.mig


SYNCHRONIZE Your Home Directory
previous-server IP : 192.168.0.30
next-server IP : 192.168.0.31

install rsync application for synchronize betwen two server
[root@previous-server ~]# yum install rsync
[root@previous-server ~]# rsync -av -e ssh /home/* 192.168.0.31:/home/
 
copy all login/password/shadow backup data from previous-server onto next-server using scp application
[root@next-server ~]# scp -r 192.168.0.30:/root/move /root

Replace with backup data into your next-server
[root@next-server ~]# cd /root/move
[root@next-server ~]# cat passwd.mig >> /etc/passwd
[root@next-server ~]# cat group.mig >> /etc/group
[root@next-server ~]# cat shadow.mig >> /etc/shadow

PREPARE YOUR SAMBA
[root@next-server ~]# yum install samba samba-common
[root@next-server ~]# rsync -av -e ssh 192.168.0.30:/etc/samba/* /etc/samba/
[root@next-server ~]# rsync -av -e ssh 192.168.0.30:/var/lib/samba/* /var/lib/samba/

Because Samba was newer on the CentOS6 box. It was using Samba 3.5, while the CentOS 5 box still had Samba 3.0. The migration was pretty simple, In Samba 3, the config files are all in /etc/samba. This includes the security files, too.
In Samba 3.5, the main smb.conf is still located in the /etc/samba folder, but the other two security files (passdb.tdb and secrets.tdb) are now located in /var/lib/samba/private/.
so later u need to remove  the  passdb.tdb and secrets.tdb onto  this directory

before copying  Samba 3.5 using "passdb.tdb" for replacing the old "smbpasswd" from samba 3.0
so we need to import the smbpasswd file using the "pdbedit"

[root@next-server ~] pdbedit -i smbpasswd -e tdbsam
Importing accout for user1...ok
Importing accout for user2...ok

it will create the "passdb.tdb"  files , move the files into /var/lib/samba/private/

[root@next-server ~]# service smb start; chkconfig smb on
[root@next-server ~]# service nmb start; chkconfig nmb on
[root@next-server ~]# netstat -tulpn


No comments: