什么是Samba
Samba是在Linux和UNIX系统上实现SMB协议的一个免费软件,由服务器及客户端程序构成。SMB(Server Messages Block,信息服务块)是一种在局域网上共享文件和打印机的一种通信协议,它为局域网内的不同计算机之间提供文件及打印机等资源的共享服务。SMB协议是客户机/服务器型协议,客户机通过该协议可以访问服务器上的共享文件系统、打印机及其他资源。通过设置“NetBIOS over TCP/IP”使得Samba不但能与局域网络主机分享资源,还能与全世界的电脑分享资源。
在ubuntu上安装Samba会遇到各种问题,随着ubuntu的更新很多的依赖库和程序的名字都开始改变,要么是找不到对应的库要么是依赖的库文件版本不对。造成安装的时候会出现各种问题
步骤:
1.先执行更新命令sudo apt-get update
更新过程中,有些资源没有找到的会报错,这个先不用理会
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/main/source/Sources Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/restricted/source/Sources Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/multiverse/source/Sources Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages 404 Not Found [IP: 91.189.88.161 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/restricted/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/multiverse/binary-amd64/Packages Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-i386/Packages Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/restricted/binary-i386/Packages Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/universe/binary-i386/Packages Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/multiverse/binary-i386/Packages Hash Sum mismatc
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/main/i18n/Translation-en Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/multiverse/i18n/Translation-en Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/restricted/i18n/Translation-en Hash Sum mismatch
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/universe/i18n/Translation-en Hash Sum mismatch
2.执行安装命令:sudo apt-get install samba smbfs samba-common smbclient
提示smbfs用cifs-utils:i386 cifs-utils 这个两个替代
root@ubuntu:~# sudo apt-get install samba smbfs samba-common smbclient
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package smbfs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
cifs-utils:i386 cifs-utils
E: Package 'smbfs' has no installation candidate
3.执行安装命令:sudo apt-get install samba cifs-utils samba-common smbclient
提示很多的依赖库版本不对
The following packages have unmet dependencies:
samba : Depends: samba-common (= 2:4.1.6+dfsg-1ubuntu2) but 2:4.3.9+dfsg-0ubuntu0.14.04.3 is to be installed
Depends: samba-common-bin (= 2:4.1.6+dfsg-1ubuntu2) but 2:4.3.9+dfsg-0ubuntu0.14.04.3 is to be installed
Depends: samba-dsdb-modules but it is not going to be installed
Depends: samba-libs (= 2:4.1.6+dfsg-1ubuntu2) but 2:4.3.9+dfsg-0ubuntu0.14.04.3 is to be installed
Recommends: attr
Recommends: samba-vfs-modules but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我们可以手动安装这些库
root@ubuntu:~# apt-get install samba-libs=2:4.1.6+dfsg-1ubuntu2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
samba-libs
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@ubuntu:~#
提示samba-libs这个库没有安装
root@ubuntu:~# apt-get install samba-dsdb-modules
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
samba-dsdb-modules : Depends: samba-libs (= 2:4.1.6+dfsg-1ubuntu2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@ubuntu:~#
提示samba-libs (= 2:4.1.6+dfsg-1ubuntu2)没有安装
4.apt-get install samba-libs=2:4.1.6+dfsg-1ubuntu2
安装提示安装
5.在安装时遇到其他的依赖库没有安装的时候,可以apt-get install 安装。