Installing Samba on Ubuntu

Posted on

Samba is a utility which is used on most Unix and Unix-like systems released under the terms of GNU General Public License.  It is served as a free software for re-implementation of a SMB/CIFS networking protocol.   One of the main purpose for samba to be made is providing files and print services for various Microsoft Windowsclients and can integrate with a Microsoft Windows Server domain. Any samba-installed server can act as a Domain Controller (DC) or as a domain member.

In version 4, it supports Active Directory and also Microsoft Windows NT domains.  The name of the tools, Samba in this case comes from SMB (Server Message Block) and it is the name of the standard protocol used by the Microsoft Windows network file system.

user@hostname:~# apt-get install samba

The above command executed with original output can be shown as follows :

root@hostname:~# apt-get install samba
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
attr python-dnspython samba-dsdb-modules samba-vfs-modules tdb-tools
Suggested packages:
bind9 bind9utils ctdb ldb-tools smbldap-tools winbind
The following NEW packages will be installed:
attr python-dnspython samba samba-dsdb-modules samba-vfs-modules tdb-tools
0 upgraded, 6 newly installed, 0 to remove and 456 not upgraded.
1 not fully installed or removed.
Need to get 1.502 kB of archives.
After this operation, 14,6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 python-dnspython all 1.12.0-1 [85,2 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 tdb-tools amd64 1.3.8-2 [21,0 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 samba amd64 2:4.3.9+dfsg-0ubuntu0.16.04.2 [900 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 attr amd64 1:2.4.47-2 [25,5 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 samba-dsdb-modules amd64 2:4.3.9+dfsg-0ubuntu0.16.04.2 [215 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 samba-vfs-modules amd64 2:4.3.9+dfsg-0ubuntu0.16.04.2 [255 kB]
Fetched 1.482 kB in 1min 15s (19,6 kB/s)
Selecting previously unselected package python-dnspython.
(Reading database ... 826665 files and directories currently installed.)
Preparing to unpack .../python-dnspython_1.12.0-1_all.deb ...
Unpacking python-dnspython (1.12.0-1) ...
Selecting previously unselected package tdb-tools.
Preparing to unpack .../tdb-tools_1.3.8-2_amd64.deb ...
Unpacking tdb-tools (1.3.8-2) ...
Selecting previously unselected package samba.
Preparing to unpack .../samba_2%3a4.3.9+dfsg-0ubuntu0.16.04.2_amd64.deb ...
Unpacking samba (2:4.3.9+dfsg-0ubuntu0.16.04.2) ...
Selecting previously unselected package attr.
Preparing to unpack .../attr_1%3a2.4.47-2_amd64.deb ...
Unpacking attr (1:2.4.47-2) ...
Selecting previously unselected package samba-dsdb-modules.
Preparing to unpack .../samba-dsdb-modules_2%3a4.3.9+dfsg-0ubuntu0.16.04.2_amd64.deb ...
Unpacking samba-dsdb-modules (2:4.3.9+dfsg-0ubuntu0.16.04.2) ...
Selecting previously unselected package samba-vfs-modules.
Preparing to unpack .../samba-vfs-modules_2%3a4.3.9+dfsg-0ubuntu0.16.04.2_amd64.deb ...
Unpacking samba-vfs-modules (2:4.3.9+dfsg-0ubuntu0.16.04.2) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu6) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for ufw (0.35-0ubuntu2) ...
Setting up redmine (3.2.1-2) ...
Determining localhost credentials from /etc/mysql/debian.cnf: succeeded.
dbconfig-common: writing config to /etc/dbconfig-common/redmine/instances/default.conf
granting access to database redmine_default for redmine/instance@localhost: already exists.
creating database redmine_default: already exists.
dbconfig-common: flushing administrative password
rake aborted!
ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"]
/var/lib/gems/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:248:in `resolve_symbol_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:211:in `resolve_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:139:in `resolve'
/var/lib/gems/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:169:in `spec'
/var/lib/gems/2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:50:in `establish_connection'
/var/lib/gems/2.3.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:120:in `block (2 levels) in <class:Railtie>'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:in `each'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
/var/lib/gems/2.3.0/gems/activerecord-4.2.6/lib/active_record/base.rb:315:in `<module:ActiveRecord>'
/var/lib/gems/2.3.0/gems/activerecord-4.2.6/lib/active_record/base.rb:26:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/usr/share/redmine/lib/plugins/acts_as_activity_provider/init.rb:2:in `block in <top (required)>'
/usr/share/redmine/config/initializers/00-core_plugins.rb:12:in `eval'
/usr/share/redmine/config/initializers/00-core_plugins.rb:12:in `block in <top (required)>'
/usr/share/redmine/config/initializers/00-core_plugins.rb:2:in `each'
/usr/share/redmine/config/initializers/00-core_plugins.rb:2:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `block in load'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:652:in `block in load_config_initializer'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:166:in `instrument'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:651:in `load_config_initializer'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:615:in `each'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/engine.rb:615:in `block in <class:Engine>'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:55:in `block in run_initializers'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `each'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:44:in `tsort_each_child'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/initializable.rb:54:in `run_initializers'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:352:in `initialize!'
/usr/share/redmine/config/environment.rb:14:in `<top (required)>'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `block in require'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/lib/gems/2.3.0/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:328:in `require_environment!'
/var/lib/gems/2.3.0/gems/railties-4.2.6/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/var/lib/gems/2.3.0/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `load'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:63:in `kernel_load'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli/exec.rb:24:in `run'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:304:in `exec'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
/var/lib/gems/2.3.0/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
dpkg: error processing package redmine (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-dnspython (1.12.0-1) ...
Setting up tdb-tools (1.3.8-2) ...
update-alternatives: using /usr/bin/tdbbackup.tdbtools to provide /usr/bin/tdbbackup (tdbbackup) in auto mode
Setting up samba (2:4.3.9+dfsg-0ubuntu0.16.04.2) ...
insserv: warning: script 'K01alfresco' missing LSB tags and overrides
insserv: warning: script 'alfresco' missing LSB tags and overrides
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `nagios'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `nagios'
insserv: warning: script 'K01alfresco' missing LSB tags and overrides
insserv: warning: script 'alfresco' missing LSB tags and overrides
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `nagios'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `nagios'
insserv: warning: script 'K01alfresco' missing LSB tags and overrides
insserv: warning: script 'alfresco' missing LSB tags and overrides
insserv: Script nagios is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `nagios'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `nagios'
Setting up attr (1:2.4.47-2) ...
Setting up samba-dsdb-modules (2:4.3.9+dfsg-0ubuntu0.16.04.2) ...
Setting up samba-vfs-modules (2:4.3.9+dfsg-0ubuntu0.16.04.2) ...
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Processing triggers for systemd (229-4ubuntu6) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Errors were encountered while processing:
redmine
E: Sub-process /usr/bin/dpkg returned an error code (1)
You have new mail in /var/mail/root
root@hostname:~#

After finishing to execute the above command, make sure that the service is started. But before that, check the status of the samba service. It can be done by executing the following command :

service smbd status

Below it is the output of the command execution in a real situation :

root@hostname:~# service smbd status
● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
Active: inactive (dead) 
Docs: man:systemd-sysv-generator(8)
Process: 15979 ExecStop=/etc/init.d/smbd stop (code=exited, status=0/SUCCESS)
Process: 6396 ExecReload=/etc/init.d/smbd reload (code=exited, status=0/SUCCESS)
Process: 2255 ExecStart=/etc/init.d/smbd start (code=exited, status=0/SUCCESS)

As it can be seen above, the samba service status is inactive. To be able to use the service execute the following command to start samba service :

root@hostname:~# service smbd start
root@hostname

Check the status again by executing the following command :

root@hostname:~# service smbd status
● smbd.service - LSB: start Samba SMB/CIFS daemon (smbd)
Loaded: loaded (/etc/init.d/smbd; bad; vendor preset: enabled)
Active: active (running) since Min 2016-09-11 10:49:32 WIB; 4s ago
Docs: man:systemd-sysv-generator(8)
Process: 15979 ExecStop=/etc/init.d/smbd stop (code=exited, status=0/SUCCESS)
Process: 6396 ExecReload=/etc/init.d/smbd reload (code=exited, status=0/SUCCESS)
Process: 16049 ExecStart=/etc/init.d/smbd start (code=exited, status=0/SUCCESS)
Tasks: 3
Memory: 26.3M
CPU: 381ms
CGroup: /system.slice/smbd.service
├─16066 /usr/sbin/smbd -D
├─16067 /usr/sbin/smbd -D
└─16069 /usr/sbin/smbd -D

Sep 11 10:49:31 hostname systemd[1]: Starting LSB: start Samba SMB/CIFS daemon (smbd)...
Sep 11 10:49:32 hostname smbd[16049]:  * Starting SMB/CIFS daemon smbd
Sep 11 10:49:32 hostname smbd[16049]:    ...done.
Sep 11 10:49:32 hostname systemd[1]: Started LSB: start Samba SMB/CIFS daemon (smbd).
root@hostname:~#

As it can be seen in the above output command, the samba service has already started and now it is active to receive service request.

2 thoughts on “Installing Samba on Ubuntu

Leave a Reply