Friday, October 31, 2014

Set linux date n time

set date and time:
(date --set="YYYYmmdd HH:MM")

date --set="2 OCT 2006 18:00:00"

or

date +%Y%m%d -s "20081128"

set only time:
date +%T -s "10:13:13"


set only year:
date --set="$(date +'2013%m%d %H:%M')"


set hardware clock in line with linux time
hwclock --systohc

or  
hwclock -w

Thursday, October 23, 2014

add feature NTOP pada Centos

Install Ntop in Centos


Download ntop from RPM

yum localinstall ntop


Start ntop
/usr/sbin/ntop -i "eth0,eth1" -d -L -u ntop -P /etc/ntop --skip-version-check --use-syslog=daemon

Open iptables on ntop port

Saturday, October 18, 2014

Email -Test smtp via telnet

Open a CMD prompt
type  TELNET MAIL.THEIRDOMAIN.COM 25 

You should see something like this as a response:
220 mx.google.com ESMTP 6si6253627yxg.6

test sending mail:

ehlo mydomain.com
mail from:<fedrik@mydomain.com>
rcpt to:<recipient@theirdomain.com>
data 

"This is a test, please do not respond "
.
quit

Monday, October 13, 2014

Create Repo distro from CENTOS


# install createrepo, genisoimage, isomd5sum

yum -y install rsync yum-utils createrepo genisoimage isomd5sum
# mounting CD
mount /dev/cdrom /mnt
 
#(if you need to mount the ISO inside of the filesystem itself, use the next command instead)
mount -o loop CentOS-6.4-x86_64-minimal.iso /mnt

#Create directoty for package


mkdir /root/buil

# copy file in CD to directory package
cd /root/build
rsync -av /mnt/


# remove file


find . -name TRANS.TBL -exec rm -f {} \; -print
./repodata/TRANS.TBL
./images/TRANS.TBL
./isolinux/TRANS.TBL
./Packages/TRANS.TBL
./EFI/TRANS.TBL
./EFI/BOOT/TRANS.TBL
./TRANS.TBL

# Testing and download package
cd Packages
yumdownloader httpd

rpm --initdb --dbpath /root/build/Packages/
rpm -ivh --test --dbpath /root/build/Packages/ /root/build/Packages/*.rpm 


warning: /root/build/Packages/acl-2.2.49-6.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
/etc/mime.types is needed by httpd-2.2.15-26.el6.centos.x86_64
apr-util-ldap is needed by httpd-2.2.15-26.el6.centos.x86_64
httpd-tools = 2.2.15-26.el6.centos is needed by httpd-2.2.15-26.el6.centos.x86_64
libapr-1.so.0()(64bit) is needed by httpd-2.2.15-26.el6.centos.x86_64
libaprutil-1.so.0()(64bit) is needed by httpd-2.2.15-26.el6.centos.x86_64 

Dependecy error fix with this.


yum provides "*/etc/mime.types*"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.cs.vt.edu
* extras: centos.mirror.constant.com
* updates: mirror.ubiquityservers.com
mailcap-2.1.31-2.el6.noarch : Helper application and MIME type associations for file types
Repo : base
Matched from:
Filename : /etc/mime.types

Test again with completed package:


rpm -ivh --test --dbpath /root/build/Packages/ /root/build/Packages/*.rpm
warning: /root/build/Packages/acl-2.2.49-6.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]


# create kickstart like my prior post.

cd /root/build/
mkdir ks


# prepare installed package


cd repodata

rm -rf *x86_64
mv 34bae2d3c9c78e04ed2429923bc095005af1b166d1a354422c4c04274bae0f59-c6-minimal-x86_64.xml comps.xml
ls | grep -v comps.xml | xargs rm -rf
ls
comps.xml

edit comp.xml and add your package
insert your package before "mdadm"

 
# create new repo

cd /root/build 

export discinfo=$(head -1 .discinfo)
createrepo -u "media://$discinfo" -g repodata/comps.xml /root/build 



# create new iso

mkisofs -o /tmp/newdistro.iso -b  isolinux.bin -c  boot.cat  -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T /root/build

Good luck ..