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;
- Press Ctrl+H during LSI configuration boot.
- Configuration Wizard
- New Configuration -> Next
- Confirm clearing of configuration -> Yes
- Manual Configuration -> Next
- Set Drive/Slot 0 and Drive/Slot 3 as 1st Drive Group -> Add to Array -> Accept DG
- Set Drive/Slot 1 and Drive/Slot 4 as 2nd Drive Group -> Add to Array -> Accept DG
- Set Drive/Slot 2 and Drive/Slot 5 as 3rd Drive Group -> Add to Array -> Accept DG
- Add Drive Group 0, 1 and 2 to Span -> Next
- Setup Raid Configuration
- RAID Level : 10
- Strip Size: 64KB
- Access: RW
- Read: Normal
- Default Write: Write Through
- I/O: Direct
- Drive Cache: Disable
- Disable BGI: No
- Update, Accept and Initialize
- Exit and Reboot
CentOS 6.5 Setup:
- Insert DVD Installer and boot to DVD
- Skip Media Check
- Hostname: srv03.deltaearthmoving.com
- Set time zone: Asia/Manila
- Set Root Password
- Use All Space
- Basic Server
- Partition /home <for users> and /data <for groups>
Setup File Server Settings: Perform as root and must know nano commands
Network Settings:
- 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
- Setup SELINUX
# nano /etc/sysconfig/selinux
SELINUX=disabled
- Install and setup Samba
# yum install samba -y
# chkconfig smb on
# chkconfig nmb on
- Reboot
# reboot
Firewall Settings:
- # setup
Select Firewall Configuration
Select Customize
Enable Samba and Samba Client
Select Close then OK
Select Yes for confirmation
Quit
Shared Folder Configuration:
- 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”
- Setup global samba configuration:
# nano /etc/samba/smb.conf
[global]printable = No
read only = Yes
create mask = 0770
directory mas = 2770
workgroup = WORKGROUP
- 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
- 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:
- Add users and set passwords:
# useradd -g primarygroup user
# passwd user
# smbpasswd –a user
- Add user to a secondary group:
# usermod -G -a secondarygroup user
- Set primary group for user:
# usermod -g primarygroup user
- Delete user and its files:
# userdel –rf user
- Add group:
# groupadd group
- Delete empty group:
# groupdel group
- Check group members:
# members group
Quota Configuration:
- Setup Quota Files and Partition:
- # 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
- # mount -o remount /data
- # mount -o remount /home
- # quotacheck –vaumc /home
- # quotacheck –vagmc /data
- Set Group Quota: 100GB
# setquota -g group -F vfsv0 102400000 104800000 0 0 /data
- Set User Quota: 10GB
# setquota –u user -F vfsv0 10240000 11240000 0 0 /home
Check quota usage:
- Show user quota:
# repquota –u /home
- Show group quota:
# repquota –g /data
Notes: service smb restart
service nmb restart
No Comments