Thursday, October 2, 2014

Linux Partition & RAID Administration

Meta Device RAID 

/sbin/mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sda1 /dev/sdf1


LVM

Initialize Disk
pvcreate /dev/md0

Create Volume Group
vgcreate -s 32M lvm_group /dev/md0 /dev/md1

Create Logical Volume
lvcreate -L 200GB lvm_group1 -n lv1

Check Logical Volume
lvdisplay lvm_group/lv1

Make File System
mkfs.ext4 /dev/lvm_group1/lv1

Mount
mount /dev/lvm_group1/lv1 /data/mysql/


Wednesday, October 1, 2014

Linux Disk & Partition Checking


  • fidsk -l [/dev/sde]
  • parted -l
  • df -h
  • sfdisk -l [-uM]
  • cfdisk /dev/sdb
  • lsblk
  • blkid

Logical Volume:
  • pvscan
  • pvdisplay
  • vgdisplay
  • lvdisplay
Meta Devices:
  • mdadm --detail /dev/md0

Tuesday, August 12, 2014

Vertically Centered Content in HTML Div

<div class="outer">
  <div class="inner">
    Content
  </div>
</div>

.outer
{
height: 12em;
position: relative;
}

.inner
{
position: absolute;
height: 6em;
margin-top: -3em;
top: 50%;
}

As simple as sample:

  • Outer div with relative position and specific height (optional if it is inhereted from its parent)
  • inner div styles by specific height (like half of parent), absolute position, 50% top and negative half height top margin.

Monday, July 7, 2014

Sending data_sm by jSMPP

String messageId = session.dataShortMessage( "",
                    TypeOfNumber.UNKNOWN,
                    NumberingPlanIndicator.UNKNOWN, "1234",
                    TypeOfNumber.UNKNOWN,
                    NumberingPlanIndicator.UNKNOWN, "099232322",
                    new ESMClass(),
                    new RegisteredDelivery( SMSCDeliveryReceipt.DEFAULT ),
                    new GeneralDataCoding( Alphabet.ALPHA_DEFAULT, MessageClass.CLASS1, false ),
                    new OptionalParameter.COctetString( (short)0x0424, "Message content and payload") );

Monday, June 16, 2014

Build RPM Source

rpmbuild --rebuild package-src.rpm


Install rpmbuild:

yum install rpm-build

Wednesday, April 30, 2014

Certificate for HTTPS Server

1- Create private/public keys
openssl genrsa -out prv.key 2048

2- Create certificate request
openssl req -new -key prv.key -out cert.csr

3- Create self-signed root authority certificate
openssl req -new -x509 -days 1826 -key prv.key -out ca.crt

4- Sign the certificate request (csr file)
openssl x509 -req -in cert.csr -CA ca.crt -CAkey prv.key -CAcreateserial -out signedCert.crt -days 500

Please note I used same private key for both CA and certificate, that can be different.
To deploy signed certificate the private key and signed  certificated should be copied to proper location and configuration.

Tuesday, April 15, 2014

Creating Local Repository in RedHat

Install createrepo

Make repository directory and put RPMs there

createrepo /path/to/RPMS

Create repo file

/etc/yum.repos.d/local.repo

[local]
name=Local Repository Demo
baseurl=file:///absolute/path/to/RPMS
enabled=1
gpgcheck=0
protect=1

Wednesday, April 9, 2014

Running 32 bits Binary in Linux 64

It usually shows the problem as complaining about ld-linux.so not found.

Installing glib 32 bit version solve the problem.

In RHEL:

yum install glibc.i686

It is better to define original installation dvd as a repo and use it to install.

RHEL Add Local DVD as Reporsitry

Touch /etc/yum.repose.d/rhe-dvd.repo
Add The following inside:

[rhel-dvd]
name=Red Hat Enterprise Linux $releasever - $basearch - DVD
baseurl=file:///mnt/dvdrom/
enabled=1
gpgcheck=0


/mnt/dvdrom supposed to be mount point of DVD

Add Sudoer

Platform: RHEL

Config File: /etc/sudoers

Add username as the following format:

user MACHINE=COMMANDS
like
username ALL=(ALL)     ALL

Sunday, March 9, 2014

Generate a Date Range in MySQL

Set @i:=0;

SELECT DATE(DATE_ADD( '2014-03-01' - INTERVAL 1 DAY, INTERVAL @i:=@i+1 DAY ) ) AS datesSeries
FROM `CS3_Statistics`.`HC_Report`, (SELECT @i:=0) r
where @i < DATEDIFF( '2014-03-07' + INTERVAL 1 DAY, '2014-03-01' )
;