Affa Server Setup on CentOS 6

From Nikoforge Wiki
Jump to: navigation, search

Contents

Introduction

This document describes a typical setup of an Affa server. Although CentOS 6 is used here as the OS it should also work with other RPM based linuxes.

The system will be installed virtually on a VMWare ESX Server. A small virtual disk (16 GB is more than enough) for the system itself is used. An iSCSI storage for the backup archives will be added later.

Installing the CentOS 6

Set up the server as described here: Basic Installation of a CentOS 6 Server

Install the Nikoforge Repository

rpm -ivH http://repo.nikoforge.org/redhat/el6/nikoforge-release-latest

Install needed Packages

yum -y install perl-Filesys-DiskFree perl-Compress-Bzip2 \
    perl-TimeDate perl-MailTools perl-Net-DNS perl-Config-IniFiles \
    perl-Proc-ProcessTable samba iscsi-initiator-utils lsscsi mdadm \
    freedup affa

Turn on Samba Service

chkconfig smb on
service smb start

Create Default Samba User

useradd affa
smbpasswd -a affa

Postfix Configuration

If no DNS A-Record has been set up for the FQHN, the receiving mail server may reject Affa messages. To avoid this, set the Envelope-From to the domain name.

sed --in-place=.BAK 's:[# \t]*myorigin[ \t]*=[ \t]*\$mydomain.*:myorigin=$mydomain:g' /etc/postfix/main.cf

restart the service

service postfix restart

If mail should be sent through a relay add this line to /etc/postfix/main.cf

relayhost=mail.domain.tld

Adding Storage for the Backups

The following describes how to add iSCSI volumes and mount them as the backup storage. If no iSCSI storage available you can simply add physical or virtual harddisk.

In this example we have 7 iSCSI 1.8 TB volumes on a FreeNAS target with IGN iqn.2011-07.ak.lan:Affa-Store on target portal 10.203.0.56:3260 with CHAP authentication. We merge them to a big RAID-0 array und mount it as the Affa backup storage (RootDir).

Note-icon.gif Note:
Adjust IGN, IP, Port, number of volumes and device names to your setup.

iSCSI Configuration

Edit /etc/iscsi/iscsid.conf and uncomment and change the following settings

node.session.auth.authmethod = CHAP
node.session.auth.username = chap_username
node.session.auth.password = chap_password

and replace chap_username and chap_password by the CHAP username and password which are set on the iSCSI target

Discover the targets

iscsiadm --mode discovery --type sendtargets --portal 10.203.0.56:3260

All found nodes are listed now. Log into the wanted node:

iscsiadm --mode node --login --portal 10.203.0.56:3260 --targetname iqn.2011-07.ak.lan:Affa-Store 

Everything went well if you see an output like this

Logging in to [iface: default, target: iqn.2011-07.ak.lan:Affa-Store, portal: 10.203.0.56,3260]
Login to [iface: default, target: iqn.2011-07.ak.lan:Affa-Store, portal: 10.203.0.56,3260] successful.

to list the SCSI devices run:

lsscsi

Output:

[1:0:0:0]    cd/dvd  NECVMWar VMware IDE CDR10 1.00  /dev/sr0
[2:0:0:0]    disk    VMware   Virtual disk     1.0   /dev/sda
[4:0:0:0]    disk    FreeBSD  iSCSI DISK       0001  /dev/sdb
[4:0:0:1]    disk    FreeBSD  iSCSI DISK       0001  /dev/sdc
[4:0:0:2]    disk    FreeBSD  iSCSI DISK       0001  /dev/sdd
[4:0:0:3]    disk    FreeBSD  iSCSI DISK       0001  /dev/sde
[4:0:0:4]    disk    FreeBSD  iSCSI DISK       0001  /dev/sdf
[4:0:0:5]    disk    FreeBSD  iSCSI DISK       0001  /dev/sdg
[4:0:0:6]    disk    FreeBSD  iSCSI DISK       0001  /dev/sdh

Create RAID-0 Array and make Filesystem

Skip the steps of this chapter and continue with chapter Mounting if the array already exists (e.g. because you have done a Affa re-install)

Create RAID-0 Array

We now create a linear array of 4 disk.

mdadm --create /dev/md100 --level=0 --raid-devices=7 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh

Make the Filesystem

mkfs.ext4 /dev/md100

This may take a long time.

Tune Filesystem

Disable automatic file system check

tune2fs -c 0 -i 0 /dev/md100

Mounting

Verify that you proceed with the correct device

cat /proc/mdstat

Output is something like

md100 : active raid0 sdh[6] sdd[2] sdg[5] sdf[4] sdc[1] sde[3] sdb[0]
     12597620736 blocks super 1.2 512k chunks

Edit /etc/fstab and add this line

/dev/md100 /var/affa ext4 defaults 0 0

Create the the Affa RootDir and mount the new filesystem

mkdir -p /var/affa
mount /var/affa/

and verify that the new filesystem is available

df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_affa2-lv_root
                       18G  1.1G   16G   7% /
tmpfs                 499M     0  499M   0% /dev/shm
/dev/sda1             485M   48M  412M  11% /boot
/dev/md100             11T  154M   11T   1% /var/affa

Additional Information

For reference purposes a list of all installed RPM packages of a working installation can be found here.

User comments

Please leave your comments and suggestions on the discussion page.


Personal tools
Namespaces
Variants
Actions
Navigation
Category cloud