发布时间:2014-09-05 17:01:34作者:知识屋
前提RHEL5.3 samba3.5.11
1.备份(service smb stop)
#rsync -av /etc/samba/ /etc/samba.old/
#cp /etc/init.d/smb /etc/init.d/smb.bak
检测一下原先的版本号 rpm -q samba(如果是rpm装的,不是的话用smbd -b)
2.编译安装新的源码包(samba-3.5.11)
#tar -xvf samba-3.0.37.tar.gz
#cd samba-3.5.11
# cd source3
#./autogen.sh
#./configure --prefix=/usr/local/samba
#make &&make install
#cp -v /etc/samba/*.tdb /usr/local/samba/private/
#cp -v /etc/samba/smb.conf /usr/local/samba/lib/
#rm -rfv /etc/samba/
# ./bin/smbpasswd #测试一下,
vi /etc/ld.so.conf
加入:/usr/local/samba/lib
然后运行#ldconfig
# yum remove system-config-samba (或rpm -e )
# yum remove samba
设置Samba路径
Samba默认是安装在/usr/local/samba,因此安装完成后,可能bin、sbin目录下的程序以及man无法使用。
解决办法:
a.修改/etc/profile (全局) 或者在.bash_profile,.bashrc 文件中加上对应路径(使用下面的脚本也是一个选择)
例如# vim ~/.bash_profile
PATH=$PATH:HOME/bin:/usr/local/samba/bin:/usr/local/samba/sbin
b.增加man手册
#vim /etc/man.config
MANPATH /usr/local/samba/share/man
MANPATH_MAP /usr/local/samba/bin /usr/local/samba/share/man
MANPATH_MAP /usr/local/samba/sbin /usr/local/samba/share/man
修改samba服务启动脚本
#cp /etc/init.d/smb.bak /etc/init.d/smb
Vim smb (修改脚本)
#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops the Samba smbd and nmbd daemons /
# used to provide SMB network services.
#
# pidfile: /usr/local/samba/var/locks/var/smbd.pid
# pidfile: /usr/local/samba/var/locks/nmbd.pid
# config: /usr/local/samba/lib/smb.conf
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 1
fi
# Avoid using root's TMPDIR
unset TMPDIR
# Source networking configuration.
. /etc/sysconfig/network
if [ -f /etc/sysconfig/samba ]; then
. /etc/sysconfig/samba
fi
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 1
# Check that smb.conf exists.
[ -f /usr/local/samba/lib/smb.conf ] || exit 6
RETVAL=0
start() {
KIND="SMB"
echo -n $"Starting $KIND services: "
daemon smbd $SMBDOPTIONS
RETVAL=$?
echo
KIND="NMB"
echo -n $"Starting $KIND services: "
daemon nmbd $NMBDOPTIONS
RETVAL2=$?
echo
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /usr/local/samba/var/locks/smbd.pid || /
RETVAL=1
return $RETVAL
}
stop() {
KIND="SMB"
echo -n $"Shutting down $KIND services: "
killproc smbd
RETVAL=$?
echo
KIND="NMB"
echo -n $"Shutting down $KIND services: "
killproc nmbd
RETVAL2=$?
[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /usr/local/samba/var/locks/smbd.pid
echo ""
return $RETVAL
}
restart() {
stop
start
}
reload() {
echo -n $"Reloading smb.conf file: "
killproc smbd -HUP
RETVAL=$?
echo
return $RETVAL
}
rhstatus() {
status smbd
RETVAL=$?
status nmbd
RETVAL2=$?
if [ $RETVAL -ne 0 ] ; then
return $RETVAL
fi
if [ $RETVAL2 -ne 0 ] ; then
return $RETVAL2
fi
}
# Allow status as non-root.
if [ "$1" = status ]; then
rhstatus
exit $?
fi
# Check that we can write to it... so non-root users stop here
[ -w /usr/local/samba/lib/smb.conf ] || exit 4
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload)
reload
;;
status)
rhstatus
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 2
esac
exit $?
加入服务 Chkconfig --add smb
修改bin的路径
#!/bin/bash
for bin in `ls -1 /usr/local/samba/bin`
do
cp -bv /usr/local/samba/bin/$bin /usr/bin/
done
for sbin in `ls -1 /usr/local/samba/sbin`
do
cp -bv -s /usr/local/samba/sbin/$sbin /usr/sbin/
done
exit 0
此时
可以启动samba了
Service smb start
本文出自 “Mylinux” 博客
linux一键安装web环境全攻略 在linux系统中怎么一键安装web环境方法
Linux网络基本网络配置方法介绍 如何配置Linux系统的网络方法
Linux下DNS服务器搭建详解 Linux下搭建DNS服务器和配置文件
对Linux进行详细的性能监控的方法 Linux 系统性能监控命令详解
linux系统root密码忘了怎么办 linux忘记root密码后找回密码的方法
Linux基本命令有哪些 Linux系统常用操作命令有哪些
Linux必学的网络操作命令 linux网络操作相关命令汇总
linux系统从入侵到提权的详细过程 linux入侵提权服务器方法技巧
linux系统怎么用命令切换用户登录 Linux切换用户的命令是什么
在linux中添加普通新用户登录 如何在Linux中添加一个新的用户
2012-07-10
CentOS 6.3安装(详细图解教程)
Linux怎么查看网卡驱动?Linux下查看网卡的驱动程序
centos修改主机名命令
Ubuntu或UbuntuKyKin14.04Unity桌面风格与Gnome桌面风格的切换
FEDORA 17中设置TIGERVNC远程访问
StartOS 5.0相关介绍,新型的Linux系统!
解决vSphere Client登录linux版vCenter失败
LINUX最新提权 Exploits Linux Kernel <= 2.6.37
nginx在网站中的7层转发功能