How to Install and Configure Samba Server on CentOS 6.2

The Samba server is a popular open-source implementation of the Server Message Block (SMB) protocol, which allows seamless file and print sharing between Windows and Linux/UNIX systems. Installing and configuring Samba on CentOS 6.2 enables you to create a file server that can be accessed by Windows clients on your network.

In this how-to, we will walk you through the step-by-step process of installing and configuring Samba server on CentOS 6.2. By the end of this guide, you will have a functional Samba server that allows Windows clients to access shared files and folders.

Step 1: Install Samba

Log in to your CentOS 6.2 server as the root user or a user with sudo privileges.
Open a terminal window.
Update the package manager by running the following command:

sudo yum update

Install the Samba package by running the following command:

sudo yum install samba

Example:

[root@centos62 ~]# yum install samba
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.maulvi.net
 * extras: centos.maulvi.net
 * updates: centos.maulvi.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package samba.i686 0:3.5.10-114.el6 will be installed
--> Processing Dependency: samba-winbind-clients = 3.5.10-114.el6 for package: samba-3.5.10-114.el6.i686
--> Processing Dependency: samba-common = 3.5.10-114.el6 for package: samba-3.5.10-114.el6.i686
--> Processing Dependency: libtdb.so.1 for package: samba-3.5.10-114.el6.i686
--> Processing Dependency: libcups.so.2 for package: samba-3.5.10-114.el6.i686
--> Processing Dependency: libwbclient.so.0 for package: samba-3.5.10-114.el6.i686
--> Processing Dependency: libtalloc.so.2 for package: samba-3.5.10-114.el6.i686
--> Running transaction check
---> Package cups-libs.i686 1:1.4.2-44.el6 will be installed
--> Processing Dependency: libavahi-client.so.3 for package: 1:cups-libs-1.4.2-44.el6.i686
--> Processing Dependency: libtiff.so.3 for package: 1:cups-libs-1.4.2-44.el6.i686
--> Processing Dependency: libjpeg.so.62 for package: 1:cups-libs-1.4.2-44.el6.i686
--> Processing Dependency: libavahi-common.so.3 for package: 1:cups-libs-1.4.2-44.el6.i686
--> Processing Dependency: libpng12.so.0(PNG12_0) for package: 1:cups-libs-1.4.2-44.el6.i686
--> Processing Dependency: libpng12.so.0 for package: 1:cups-libs-1.4.2-44.el6.i686
---> Package libtalloc.i686 0:2.0.1-1.1.el6 will be installed
---> Package libtdb.i686 0:1.2.1-3.el6 will be installed
---> Package samba-common.i686 0:3.5.10-114.el6 will be installed
--> Processing Dependency: /usr/bin/pkg-config for package: samba-common-3.5.10-114.el6.i686
---> Package samba-winbind-clients.i686 0:3.5.10-114.el6 will be installed
--> Running transaction check
---> Package avahi-libs.i686 0:0.6.25-11.el6 will be installed
---> Package libjpeg.i686 0:6b-46.el6 will be installed
---> Package libpng.i686 2:1.2.46-1.el6_1 will be installed
---> Package libtiff.i686 0:3.9.4-1.el6_0.3 will be installed
---> Package pkgconfig.i686 1:0.23-9.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                      Arch        Version                 Repository                   Size
====================================================================================================
Installing:
 samba                        i686        3.5.10-114.el6          CentOS6.2-Repository        5.0 M
Installing for dependencies:
 avahi-libs                   i686        0.6.25-11.el6           CentOS6.2-Repository         54 k
 cups-libs                    i686        1:1.4.2-44.el6          CentOS6.2-Repository        324 k
 libjpeg                      i686        6b-46.el6               CentOS6.2-Repository        133 k
 libpng                       i686        2:1.2.46-1.el6_1        CentOS6.2-Repository        184 k
 libtalloc                    i686        2.0.1-1.1.el6           CentOS6.2-Repository         18 k
 libtdb                       i686        1.2.1-3.el6             CentOS6.2-Repository         29 k
 libtiff                      i686        3.9.4-1.el6_0.3         CentOS6.2-Repository        338 k
 pkgconfig                    i686        1:0.23-9.1.el6          CentOS6.2-Repository         67 k
 samba-common                 i686        3.5.10-114.el6          CentOS6.2-Repository         13 M
 samba-winbind-clients        i686        3.5.10-114.el6          CentOS6.2-Repository        1.1 M

Transaction Summary
====================================================================================================
Install      11 Package(s)

Total download size: 20 M
Installed size: 70 M
Is this ok [y/N]: y
Downloading Packages:
----------------------------------------------------------------------------------------------------
Total                                                                10 MB/s |  20 MB     00:02
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : libtalloc-2.0.1-1.1.el6.i686                                                    1/11
  Installing : libtdb-1.2.1-3.el6.i686                                                         2/11
  Installing : samba-winbind-clients-3.5.10-114.el6.i686                                       3/11
  Installing : libjpeg-6b-46.el6.i686                                                          4/11
  Installing : libtiff-3.9.4-1.el6_0.3.i686                                                    5/11
  Installing : 2:libpng-1.2.46-1.el6_1.i686                                                    6/11
  Installing : 1:pkgconfig-0.23-9.1.el6.i686                                                   7/11
  Installing : samba-common-3.5.10-114.el6.i686                                                8/11
  Installing : avahi-libs-0.6.25-11.el6.i686                                                   9/11
  Installing : 1:cups-libs-1.4.2-44.el6.i686                                                  10/11
  Installing : samba-3.5.10-114.el6.i686                                                      11/11

Installed:
  samba.i686 0:3.5.10-114.el6

Dependency Installed:
  avahi-libs.i686 0:0.6.25-11.el6              cups-libs.i686 1:1.4.2-44.el6
  libjpeg.i686 0:6b-46.el6                     libpng.i686 2:1.2.46-1.el6_1
  libtalloc.i686 0:2.0.1-1.1.el6               libtdb.i686 0:1.2.1-3.el6
  libtiff.i686 0:3.9.4-1.el6_0.3               pkgconfig.i686 1:0.23-9.1.el6
  samba-common.i686 0:3.5.10-114.el6           samba-winbind-clients.i686 0:3.5.10-114.el6

Complete!

Step 2: Configure Samba

Open the Samba configuration file using a text editor. For example, you can use the nano editor:

sudo nano /etc/samba/smb.conf

In the [global] section of the file, add the following lines to set the workgroup and security settings:

   workgroup = WORKGROUP
   security = user

Replace “WORKGROUP” with the appropriate workgroup name used by your Windows clients.
3. Scroll down to the end of the file and add the following section to define a shared directory:

   [shared]
      comment = Shared Directory
      path = /path/to/shared/directory
      valid users = @users
      browseable = yes
      writable = yes
      create mask = 0664
      directory mask = 0775

Replace “/path/to/shared/directory” with the actual path to the directory you want to share. Modify the other options as per your requirements.
4. Save the changes and exit the text editor.

See also  How to Install Httpd on CentOS 6.3

Step 3: Set up Samba User Accounts

Create a Samba user by running the following command:

sudo smbpasswd -a username

Replace “username” with the desired username for Samba access.
2. Enter a password for the Samba user when prompted.

Repeat the above steps to create additional Samba users if needed.

Step 4: Start and Enable Samba

Start the Samba service by running the following command:

sudo service smb start

Enable the Samba service to start automatically at system boot:

sudo chkconfig smb on

Outcome

Congratulations! You have successfully installed and configured Samba server on CentOS 6.2. You now have a functional file server that can be accessed by Windows clients on your network. Users can connect to the shared directory using the Samba username and password you created.

See also  How to Install PHP 5.3.3 on CentOS 5.8

Feel free to comment and suggest any improvements to this guide.

Comments

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *