Sunday, June 26, 2016

Compile openssl


Get latest openssl serouce, at this time is link https://www.openssl.org/source/openssl-1.0.2h.tar.gz
Extract and point to source directory path.

apt-get install gcc
./config
make
make install
openssl version
mv /usr/bin/openssl /usr/bin/openssl.bak
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
openssl version

Resize partition size

root@server:/home/server# lsblk
NAME   MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda    254:0    0  20G  0 disk
└─vda1 254:1    0  20G  0 part /

root@server:/home/server# df -ah
Filesystem      Size  Used Avail Use% Mounted on
rootfs          9.9G  3.7G  5.8G  39% /
sysfs              0     0     0    - /sys
proc               0     0     0    - /proc
udev             10M     0   10M   0% /dev
devpts             0     0     0    - /dev/pts
tmpfs           388M  136K  388M   1% /run
/dev/vda1       9.9G  3.7G  5.8G  39% /
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           775M     0  775M   0% /run/shm

Block device size = 20GB
Current partition size= 10GB

Auto resize partition will expand it same block device size

root@server:/home/server# resize2fs /dev/vda1
resize2fs 1.42.5 (29-Jul-2012)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/vda1 to 5242624 (4k) blocks.
The filesystem on /dev/vda1 is now 5242624 blocks long.

root@serer:/home/server# df -ah
Filesystem      Size  Used Avail Use% Mounted on
rootfs           20G  3.7G   16G  20% /
sysfs              0     0     0    - /sys
proc               0     0     0    - /proc
udev             10M     0   10M   0% /dev
devpts             0     0     0    - /dev/pts
tmpfs           388M  136K  388M   1% /run
/dev/vda1        20G  3.7G   16G  20% /
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           775M     0  775M   0% /run/shm


Install Haproxy from source on Debian 7

apt-get install build-essential make g++ libssl-dev

tar xvf haproxy-1.6.5.tar.gz

cd haproxy-1.6.5

make TARGET=linux2628  USE_OPENSSL=yes USE_ZLIB=yes

make install

cp /usr/local/sbin/haproxy /usr/sbin/
cp examples/haproxy.init /etc/init.d/haproxy
chmod 755 /etc/init.d/haproxy
mkdir -p /etc/haproxy
mkdir -p /run/haproxy
mkdir -p /var/lib/haproxy
touch /var/lib/haproxy/stats
useradd -r haproxy


Monday, June 20, 2016

Create pem file for Haproxy

Decrypt private key
openssl rsa -in domain.com.key -out domain.com.decrypt.key

unzip nginx.zip from Starssl
cat 1_domain.com_bundle.crt domain.com.decrypt.key > domain.com.pem

Friday, June 3, 2016

Install SRILM

Download and install ubuntu minimal system from http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/mini.iso

Download source srilm 1.7.1 from: https://googledrive.com/host/0B30EeVPAcvhvdG04eVE4Uml1ZGs/srilm-1.7.1.tar.gz

wget http://googledrive.com/host/0B30EeVPAcvhvdG04eVE4Uml1ZGs/srilm-1.7.1.tar.gz
mkdir srilm
mv srilm-1.7.1.tar.gz srilm
cd srilm
tar -xvf srilm-1.7.1.tar.gz
export SRILM=/home/gbsofts/srilm
sh sbin/machine-type
sudo -s
apt-get install gcc
apt-get install gawk
apt-get install tcl
apt-get install tcl-dev tk-dev
apt-get install gzip bzip2 p7zip
apt-get install make
cd ../
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.11.tar.gz
tar -xvzf libiconv-1.11.tar.gz
cd libiconv-1.11
./configure --prefix=/usr/local/libiconv
make
make install
cd ../srilm/
export SRILM=/home/gbsofts/srilm
export PATH=$PATH:$SRILM/bin:$SRILM/bin/$MACHINE_TYPE
#change SRILM = /home/gbsofts/srilm from Makefile
make MACHINE_TYPE=i686-m64 World

Monday, May 30, 2016

Config date time

Change timezone:
dpkg-reconfigure tzdata

If you do not have root privileges or want to set for yourself a different timezone than the one the system uses, you can set the environment variable TZ. Use the command tzselect to show what value to use for TZ. 
export TZ=UTC

Saturday, February 20, 2016

GIN Index on Postgres


Install postgresql-contrib package 
apt-get install postgresql-contrib-9.x
(replace x with current version in used)


Create extension pg_trgm
log in postgres with superuser role,
CREATE EXTENSION IF NOT EXISTS pg_trgm;


Create GIN index
CREATE INDEX tbdatatest_idx_date  on tbdatatest  USING GIN ( playerid gin_trgm_ops);