2016-03-26

INSTALLATION VIRTUALBOX 5.0.16.r105871 ON CENTOS 7.2.15.11 x64

#OS:
root@dc1 /opt/VirtualBox-Storage# uname -a
Linux dc1 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux


root@dc1 /opt/VirtualBox-Storage# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
root@dc1 /opt/VirtualBox-Storage#  








<br>


########################
echo "######################################"
echo "INSTALLATION VIRTUALBOX 5.0.16.r105871 for CENTOS 7.2.1511 x64"


#mkdir -p /opt/VirtualBox-Storage/
#useradd vbox
#passwd  vbox
#Enter new UNIX password: vbox
#Retype new UNIX password: vbox
#passwd: password updated successfully
#usermod -aG vboxusers vbox
#chown -R vbox.vboxusers /opt/VirtualBox-Storage/


mkdir -p /opt/VirtualBox-Storage
cd /opt/VirtualBox-Storage


#/etc/yum.repos.d/virtualbox.repo
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc


wget http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -Uvh epel-release-7-5.noarch.rpm


yum -y install gcc make patch  dkms qt libgomp
yum -y install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel
yum -y install VirtualBox-5.0


#/etc/profile
echo "" >> /etc/profile
echo "KERN_DIR=/usr/src/kernels/3.10.0-327.10.1.el7.x86_64" >> /etc/profile
echo "export KERN_DIR" >> /etc/profile
source /etc/profile

cd VirtualBox-5.0-5.0.16_105871_el7-1.x86_64
wget http://download.virtualbox.org/virtualbox/5.0.16/Oracle_VM_VirtualBox_Extension_Pack-5.0.16-105871.vbox-extpack
VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-5.0.16-105871.vbox-extpack 

POSTFIX MTA as a SMART HOST + SSH LOGIN WARNING OVER EMAIL

#http://tecadmin.net/bash-mail-command-not-found/
#CENTOS: yum -y install mailx
#UBUNTU: apt-get install mailutils



#Sending Test Email
echo "Message Body" | mail -s "Message Subject" xxx@gmail.com



mkdir -p  /opt/script/
cd /opt/script/
echo "">/opt/script/ssh-alert-via-email.sh
nano /opt/script/ssh-alert-via-email.sh



 

#UBUNTU:
echo "##################################" >>/root/.bashrc
echo "/opt/script/ssh-alert-via-email.sh" >>/root/.bashrc


#CENTOS:
echo "##################################" >>/root/.bash_profile
echo "/opt/script/ssh-alert-via-email.sh" >>/root/.bash_profile

#END
 



###################################
#/opt/script/ssh-alert-via-email.sh
#13:55 08/09/2015
###################################
NOW="$(date +'%Y.%m.%d-%H.%M.%S.%6N')"
IP="$(echo $SSH_CONNECTION | cut -d " " -f 1)"
HOSTNAME=$(hostname)
USER_NAME=$(whoami)

#NOTE: CURRENT SERVER SSH PORT
SSH_PORT=65113

echo -e "################################" > /var/log/mail.log
echo -e "THOI GIAN BAT DAU GUI EMAIL | "$NOW >>/var/log/mail.log
echo -e "################################" >> /var/log/mail.log

echo -e "SSH REMOTE LOGIN NOTIFICATION: " > /tmp/ps-ssh-$NOW.log
echo -e "DATE......:"$NOW         >>/tmp/ps-ssh-$NOW.log
echo -e "IP........:"$IP          >>/tmp/ps-ssh-$NOW.log
echo -e "HOSTNAME..:"$HOSTNAME    >>/tmp/ps-ssh-$NOW.log
echo -e "USERNAME..:"$USER_NAME   >>/tmp/ps-ssh-$NOW.log
echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
w                               >>/tmp/ps-ssh-$NOW.log

echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
ps aux | egrep "USER|sshd"      >>/tmp/ps-ssh-$NOW.log

echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
netstat -n | egrep "Send-Q|$SSH_PORT" >>/tmp/ps-ssh-$NOW.log

echo -e "#####################" >>/tmp/ps-ssh-$NOW.log
echo -e "ps aux | egrep \"USER|sshd\"  | awk '{print \$2}' | xargs kill -9" >>/tmp/ps-ssh-$NOW.log

mail -s "SSH WARNING [$HOSTNAME|$IP|$NOW]" tinhcx@daivietgroup.net.vn tinhcx@gmail.com </tmp/ps-ssh-$NOW.log

cat /tmp/ps-ssh-$NOW.log
echo "__________________________________________________________________________"
sleep 5
cat /var/log/mail.log



 









 

2016-03-25

Freenas vs NAS4Free vs Openfiler vs OMV (Open Media Vault)

I was Looking For a Simple Free Home NAS,  Start small and Grow by adding disks later. 

Looked at OpenFiler (OF) , NAS4Free, FreeNAS, Open Media Vault (OMV) to find a suitable NAS for my Home NAS. 


Here are my findings, (As of January 2013)


There are many options out there, where you can setup a small low-power, low-cost server and run your home NAS at home to store files and don't loose them in case of a disk failure. But what NAS software to choose from? My blog is on what I found out during my research. (I have no bias to anyone of them)


Openfiler.

OF is Old - Look like development is stopped. Version 2.99.1 has a bug where GUI do leave 5% of storage behind when using GUI / GPT disks. (Can fix using command line parted but not straight forward - no one in development community care to fix any more). Prior version 2.3 is good but iSCSI support is old (If you don't use iSCSI, OF 2.3 version is good enough). Volume Snapshots are available, when enabled, performance drop is significant, but that is part of the linux lvm implementation and you have to live with it if you want snapshots.

One of the great features for a home user that I see with OF is that we can go to disk partition level from the GUI to create storage groups. Where as none other programs did provide this capability. For example ;  If I had 3 x 3TB disks I can partition each disk to 3 partitions, and create 3 raid - stripes (each stripe will hold 2TB data with 2+1 raid) and later I can add a 1TB disk to the mix and expand one of the stripes to make that stripe a 3TB (re-stripe to 3+1 from 2+1) without loosing data. (Need to go to command line to issue few simple commands to re-stripe but simple enough to do).


FreeNAS / NAS4Free (Version 9.x)

FreeNAS has been out there for a long time, and NAS4Free is a fork from FreeNAS. FreeNAS interface is modern, but both interfaces does the similar functionality at the end. Both are very good and stable.  Both offer encryption and de-duplication (5GB of Memory per 1TB of de-dup recommended sort of high requirement for a home NAS if you need dedup, but that is what you need for for that kind of technology.), Both based on FreeBSD. For home use, issue that I have is zfs-raidz (their raid 5 implementation) cannot add a disk later and expand without destroying data on it. (Example If I start with 3 disk raid config and want to add a disk to make make a 4 disk raid  later, I have to destroy data before I can make it a new 4 disk raid, This was a big no for me for my home NAS.). FreeNAS/NAS4Free work well installed from a USB stick. (Notes : Embedded install option is great and make sure not to enable de-dupe unless you know what you are getting into.  Read Here before enabling de-dupe.)


OMV (Open Media Vault)

From performance perspective, Openfiler and OMV is similar. Both don't have zfs, no pre-fetching. Openfiler may still be better and stable than OMV in my opinion. OMV is new and it can take some time to see if it is for real and people will support development going into future. OMV also have LVM and iSCSI as plug-ins. Confusing to find how to enable them for the first time user, but they are there. OMV is similar in many ways to OF as both are based on Linux. Now that OF project is dead you can consider OMV as a upgrade to OF as well.

My Thoughts :
So which NAS to choose ?
Short answer...
        Simple,  Flexible & Work with low end hardware -> Openfiler or OMV (Both Similar)
        Performance, Complex & More Memory -> FreeNAS or NAS4Free (Both similar)

Long Answer .....
If looking for performance and have good cpu & memory to go with it,  FreeNAS/NAS4Free is good. Specially in multi-user environments features like pre-fetch has value.  For a simple home NAS, you need to be able to grow easily by adding additional storage disks, and with FreeNAS it is not easy to add disk. Some of the zfs features may not even necessary for a home NAS environment (over-kill). Openfiler (or OMV) is still probably best if looking for flexibility of growth & ok performance.