FILE SERVER INSTALLATION

A detailed step by step installation for creating your own file server using Centos 6.5.

Variables:

Hardware:           Supermicro SS823TQ-X9SCA

3.1Ghz Quad Core Xeon E3-1220 V2 Processor

Intel C204 PCH Chipset

4GB DDR3 1333 ECC Memory Card

Matrox 6200Ew Graphics

Supermicro SMC2108 LSI SAS/ATA Raid Controller

6 x 2TB SATA 7200RPM Hard Drives

OS: CentOS 6.5

Hostname:  srv03

IP Address: 192.168.1.3

Subnet Mask: 255.255.255.0

Gateway: 192.168.1.1

Workgroup: WORKGROUP

RAID 10 Setup for 6 Hard Drives;

  1. Press Ctrl+H during LSI configuration boot.
  2. Configuration Wizard
    1. New Configuration -> Next
    2. Confirm clearing of configuration -> Yes
    3. Manual Configuration -> Next
    4. Set Drive/Slot 0 and Drive/Slot 3 as 1st Drive Group -> Add to Array -> Accept DG
    5. Set Drive/Slot 1 and Drive/Slot 4 as 2nd Drive Group -> Add to Array -> Accept DG
    6. Set Drive/Slot 2 and Drive/Slot 5 as 3rd Drive Group -> Add to Array -> Accept DG
    7. Add Drive Group 0, 1 and 2 to Span -> Next
    8. Setup Raid Configuration
      1. RAID Level : 10
      2. Strip Size: 64KB
  • Access: RW
  1. Read: Normal
  2. Default Write: Write Through
  3. I/O: Direct
  • Drive Cache: Disable
  • Disable BGI: No
  1. Update, Accept and Initialize
  2. Exit and Reboot

CentOS 6.5 Setup:

  1. Insert DVD Installer and boot to DVD
  2. Skip Media Check
  3. Hostname: srv03.deltaearthmoving.com
  4. Set time zone: Asia/Manila
  5. Set Root Password
  6. Use All Space
  7. Basic Server
  8. Partition /home <for users> and /data <for groups>

Setup File Server Settings:  Perform as root and must know nano commands

Network Settings:

  1. Setup Ethernet configuration

# nano /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0 <refer to used network port>

HWADDR=<already set>

IPADDR=<IP Address>

NETMASK=<Subnet Mask>

TYPE=Ethernet

UUID=<already set>

ONBOOT =yes

NM_CONTROLLED=yes

BOOTPROTO=static

# nano /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=<Hostname>

GATEWAY=<Gateway>

# nano /etc/resolv.conf

nameserver 192.168.1.1

  1. Setup SELINUX

# nano /etc/sysconfig/selinux

SELINUX=disabled

  1. Install and setup Samba

# yum install samba -y

# chkconfig smb on

# chkconfig nmb on

  1. Reboot

# reboot

Firewall Settings:

  1. # setup

Select Firewall Configuration

Select Customize

Enable Samba and Samba Client

Select Close then OK

Select Yes for confirmation

Quit

Shared Folder Configuration:

  1. Create groups: support, operation, executive, managers, board

# groupadd support                                 “Support Division”

# groupadd operation                    “Operation Division”

# groupadd executive                            “Executives (XVPs)”

# groupadd managers                                               “Managers”

# groupadd board                                   “Board Members”

  1. Setup global samba configuration:

# nano /etc/samba/smb.conf

[global]

printable = No

read only = Yes

create mask = 0770

directory mas = 2770

workgroup = WORKGROUP

  1. Setup group and folder share for public except guests while files can only be edited by owning group.

# groupadd public

# mkdir -p /data/public/

# chown root.public /data/public/

# chmod 777 /data/public/

# chmod 2777 /data/public/

# nano /etc/samba/smb.conf

[public]

comment = Public Files

path = /data/public/

write list = @public

create mask = 0777

directory mask – 2777

  1. Setup group and folder share for each group:

# groupadd group

# mkdir -p /data/group/

# chown root.group /data/group/

# chmod 776 /data/group/

# chmod 2776 /data/group/

# nano /etc/samba/smb.conf

[group]

comment = Group Files

path = data/group/

valid users  = @group,@anothergroupwhocanview

write list = @group,@anothergroupwhocanwrite

force group = group

Create a members script to show group members:

# nano /usr/bin/members

#!/bin/bash

srchGroup=”$1″

# get the corresponding line from /etc/group

for thisLine in “`grep “^${srchGroup}:” /etc/group`”

do

# get the parts of interest

grpNumber=”`echo ${thisLine} | cut -d”:” -f3`”

grpUsers=”`echo ${thisLine} | cut -d”:” -f4 | sed ‘s/,/ /g’`”

done

# check /etc/passwd

pwdUsers=”`awk -F”:” ‘ $4 ~ /’${grpNumber}’/ { printf(“%s “,$1) }’ /etc/passwd`”

echo “0 ${srchGroup}” # given at commandline

echo “1 ${grpNumber}” # from /etc/group

echo “2 ${grpUsers}”  # from /etc/group

echo “3 ${pwdUsers}”  # from /etc/passwd

echo “All users: ${grpUsers} ${pwdUsers}”

# chmod +x /usr/bin/members

Group and User Management:

  1. Add users and set passwords:

# useradd -g primarygroup user

# passwd user

# smbpasswd –a user

  1. Add user to a secondary group:

# usermod -G -a secondarygroup user

  1. Set primary group for user:

# usermod -g primarygroup user

  1. Delete user and its files:

# userdel –rf user

  1. Add group:

# groupadd group

  1. Delete empty group:

# groupdel group

  1. Check group members:

# members group

Quota Configuration:

  1. Setup Quota Files and Partition:
  1. # nano /etc/fstab

<edit /data and /home partition>

/data ext4 defaults,grpjquota=aquota.group,jqfmt=vfsv0     1    2

/home ext4 defaults,usrjquota=aquota.user,jqfm=vfsv0  1    2

  1. # mount -o remount /data
  2. # mount -o remount /home
  3. # quotacheck –vaumc /home
  4. # quotacheck –vagmc /data
  1. Set Group Quota: 100GB

# setquota -g group -F vfsv0 102400000 104800000 0 0 /data

  1. Set User Quota: 10GB

# setquota –u user -F vfsv0 10240000 11240000 0 0 /home

Check quota usage:

  1. Show user quota:

# repquota –u /home

  1. Show group quota:

# repquota –g /data

Notes: service smb restart

service nmb restart