Raspberry Pi 有個不錯的功能,稱為 Samba 能夠將 Raspberry Pi 透過網路連線當作是網路的磁碟一樣來使用,存取目錄和檔案,透過這個方式,可以將日後需要傳到 Raspberry Pi 的程式以 Samba 方式來傳送,非常方便
Jason Chin 2016/11/7
root@raspberrypi:~# sudo apt-get install samba
正在讀取套件清單… 完成
正在重建相依關係
正在讀取狀態資料… 完成
The following packages were automatically installed and are no longer required:
libass4 libvdpau1
Use ‘apt-get autoremove’ to remove them.
下列的額外套件將被安裝:
libwbclient0 samba-common smbclient tdb-tools
建議套件:
openbsd-inetd inet-superserver smbldap-tools ldb-tools ctdb
推薦套件:
samba-common-bin
下列【新】套件將會被安裝:
samba tdb-tools
下列套件將會被升級:
libwbclient0 samba-common smbclient
升級 3 個,新安裝 2 個,移除 0 個,有 130 個未被升級。
需要下載 8,292 kB 的套件檔。
此操作完成之後,會多佔用 20.3 MB 的磁碟空間。
是否繼續進行 [Y/n]?y
正在預先設定套件 …
(讀取資料庫 … 目前共安裝了 77450 個檔案和目錄。)
正準備替換 libwbclient0:armhf 2:3.6.6-6+deb7u2(使用 …/libwbclient0_2%3a3.6.6-6+deb7u4_armhf.deb)…
解開替代套件 libwbclient0:armhf …
正準備替換 smbclient 2:3.6.6-6+deb7u2(使用 …/smbclient_2%3a3.6.6-6+deb7u4_armhf.deb)…
解開替代套件 smbclient …
正準備替換 samba-common 2:3.6.6-6+deb7u2(使用 …/samba-common_2%3a3.6.6-6+deb7u4_all.deb)…
解開替代套件 samba-common …
選取了原先未選的套件 samba。
解開 samba(從 …/samba_2%3a3.6.6-6+deb7u4_armhf.deb)…
選取了原先未選的套件 tdb-tools。
解開 tdb-tools(從 …/tdb-tools_1.2.10-2_armhf.deb)…
執行 man-db 的觸發程式 …
設定 libwbclient0:armhf (2:3.6.6-6+deb7u4) …
設定 samba-common (2:3.6.6-6+deb7u4) …
設定 smbclient (2:3.6.6-6+deb7u4) …
設定 samba (2:3.6.6-6+deb7u4) …
Generating /etc/default/samba…
Adding group `sambashare’ (GID 114) …
Done.
update-alternatives: 以 /usr/bin/smbstatus.samba3 提供 自動模式 中的 /usr/bin/smbstatus (smbstatus)
insserv: warning: script ‘mathkernel’ missing LSB tags and overrides
[ ok ] Starting Samba daemons: nmbd smbd.
設定 tdb-tools (1.2.10-2) …
update-alternatives: 以 /usr/bin/tdbbackup.tdbtools 提供 自動模式 中的 /usr/bin/tdbbackup (tdbbackup)
root@raspberrypi:~#
如下為安裝 Samba Server 的過程
如下圖,再以指令啓動 samba service 即可
root@raspberrypi:~# sudo apt-get install samba-common-bin
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
samba-common-bin
0 upgraded, 1 newly installed, 0 to remove and 24 not upgraded.
Need to get 2,722 kB of archives.
After this operation, 16.2 MB of additional disk space will be used.
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main samba-common-bin armhf 2:3.6.6-6+deb7u14 [2,722 kB]
Fetched 2,722 kB in 3s (750 kB/s)
Selecting previously unselected package samba-common-bin.
(Reading database … 81334 files and directories currently installed.)
Unpacking samba-common-bin (from …/samba-common-bin_2%3a3.6.6-6+deb7u14_armhf.deb) …
Processing triggers for man-db …
Setting up samba-common-bin (2:3.6.6-6+deb7u14) …
update-alternatives: using /usr/bin/nmblookup.samba3 to provide /usr/bin/nmblookup (nmblookup) in auto mode
update-alternatives: using /usr/bin/net.samba3 to provide /usr/bin/net (net) in auto mode
update-alternatives: using /usr/bin/testparm.samba3 to provide /usr/bin/testparm (testparm) in auto mode
root@raspberrypi:~#
root@raspberrypi:~# sudo apt-get install samba
正在讀取套件清單… 完成
正在重建相依關係
正在讀取狀態資料… 完成
下列的額外套件將被安裝:
attr libaio1 libfile-copy-recursive-perl python-dnspython python-ldb
python-samba python-tdb samba-common-bin samba-dsdb-modules
samba-vfs-modules tdb-tools update-inetd
建議套件:
python-gpgme bind9 bind9utils ctdb ldb-tools ntp | chrony smbldap-tools
winbind ufw heimdal-clients
下列【新】套件將會被安裝:
attr libaio1 libfile-copy-recursive-perl python-dnspython python-ldb
python-samba python-tdb samba samba-common-bin samba-dsdb-modules
samba-vfs-modules tdb-tools update-inetd
升級 0 個,新安裝 13 個,移除 0 個,有 0 個未被升級。
需要下載 3,474 kB 的套件檔。
此操作完成之後,會多佔用 23.7 MB 的磁碟空間。
是否繼續進行 [Y/n]? [Y/n] y
正在預先設定套件 …
選取了原先未選的套件 python-dnspython。
(讀取資料庫 … 目前共安裝了 134547 個檔案和目錄。)
Preparing to unpack …/00-python-dnspython_1.15.0-1+deb9u1_all.deb …
Unpacking python-dnspython (1.15.0-1+deb9u1) …
選取了原先未選的套件 python-ldb。
Preparing to unpack …/01-python-ldb_2%3a1.1.27-1+deb9u1_armhf.deb …
Unpacking python-ldb (2:1.1.27-1+deb9u1) …
選取了原先未選的套件 python-tdb。
Preparing to unpack …/02-python-tdb_1.3.11-2_armhf.deb …
Unpacking python-tdb (1.3.11-2) …
選取了原先未選的套件 python-samba。
Preparing to unpack …/03-python-samba_2%3a4.5.16+dfsg-1+deb9u1_armhf.deb …
Unpacking python-samba (2:4.5.16+dfsg-1+deb9u1) …
選取了原先未選的套件 samba-common-bin。
Preparing to unpack …/04-samba-common-bin_2%3a4.5.16+dfsg-1+deb9u1_armhf.deb …
Unpacking samba-common-bin (2:4.5.16+dfsg-1+deb9u1) …
選取了原先未選的套件 tdb-tools。
Preparing to unpack …/05-tdb-tools_1.3.11-2_armhf.deb …
Unpacking tdb-tools (1.3.11-2) …
選取了原先未選的套件 libfile-copy-recursive-perl。
Preparing to unpack …/06-libfile-copy-recursive-perl_0.38-1_all.deb …
Unpacking libfile-copy-recursive-perl (0.38-1) …
選取了原先未選的套件 update-inetd。
Preparing to unpack …/07-update-inetd_4.44_all.deb …
Unpacking update-inetd (4.44) …
選取了原先未選的套件 samba。
Preparing to unpack …/08-samba_2%3a4.5.16+dfsg-1+deb9u1_armhf.deb …
Unpacking samba (2:4.5.16+dfsg-1+deb9u1) …
選取了原先未選的套件 attr。
Preparing to unpack …/09-attr_1%3a2.4.47-2_armhf.deb …
Unpacking attr (1:2.4.47-2) …
選取了原先未選的套件 libaio1:armhf。
Preparing to unpack …/10-libaio1_0.3.110-3_armhf.deb …
Unpacking libaio1:armhf (0.3.110-3) …
選取了原先未選的套件 samba-dsdb-modules。
Preparing to unpack …/11-samba-dsdb-modules_2%3a4.5.16+dfsg-1+deb9u1_armhf.deb …
Unpacking samba-dsdb-modules (2:4.5.16+dfsg-1+deb9u1) …
選取了原先未選的套件 samba-vfs-modules。
Preparing to unpack …/12-samba-vfs-modules_2%3a4.5.16+dfsg-1+deb9u1_armhf.deb …
Unpacking samba-vfs-modules (2:4.5.16+dfsg-1+deb9u1) …
設定 python-dnspython (1.15.0-1+deb9u1) …
設定 python-tdb (1.3.11-2) …
Processing triggers for libc-bin (2.24-11+deb9u4) …
設定 libaio1:armhf (0.3.110-3) …
Processing triggers for systemd (232-25+deb9u11) …
設定 tdb-tools (1.3.11-2) …
update-alternatives: using /usr/bin/tdbbackup.tdbtools to provide /usr/bin/tdbbackup (tdbbackup) in auto mode
Processing triggers for man-db (2.7.6.1-2) …
設定 samba-dsdb-modules (2:4.5.16+dfsg-1+deb9u1) …
設定 attr (1:2.4.47-2) …
設定 libfile-copy-recursive-perl (0.38-1) …
設定 python-ldb (2:1.1.27-1+deb9u1) …
設定 update-inetd (4.44) …
設定 samba-vfs-modules (2:4.5.16+dfsg-1+deb9u1) …
設定 python-samba (2:4.5.16+dfsg-1+deb9u1) …
設定 samba-common-bin (2:4.5.16+dfsg-1+deb9u1) …
設定 samba (2:4.5.16+dfsg-1+deb9u1) …
Adding group `sambashare’ (GID 115) …
Done.
Samba is not being run as an AD Domain Controller, masking samba-ad-dc-service.
Please ignore the following error about deb-systemd-helper not finding samba-ad-dc-service.
Created symlink /etc/systemd/system/multi-user.target.wants/nmbd.service → /lib/systemd/system/nmbd.service.
Failed to preset unit: Unit file /etc/systemd/system/samba-ad-dc.service is masked.
/usr/bin/deb-systemd-helper: error: systemctl preset failed on samba-ad-dc.service: No such file or directory
Created symlink /etc/systemd/system/multi-user.target.wants/smbd.service → /lib/systemd/system/smbd.service.
Processing triggers for libc-bin (2.24-11+deb9u4) …
Processing triggers for systemd (232-25+deb9u11) …
root@raspberrypi:~# sudo apt-get install samba-common-bin
正在讀取套件清單… 完成
正在重建相依關係
正在讀取狀態資料… 完成
samba-common-bin is already the newest version (2:4.5.16+dfsg-1+deb9u1).
samba-common-bin 被設定為手動安裝。
升級 0 個,新安裝 0 個,移除 0 個,有 0 個未被升級。
root@raspberrypi:~# sudo service samba restart
Failed to restart samba.service: Unit samba.service is masked.
root@raspberrypi:~# sudo service samba start
Failed to start samba.service: Unit samba.service is masked.
root@raspberrypi:~#
ans:
#service smbd start