Tikejhya: Ashish Nepal

Knowledgebase

Month: October 2012

How to create ssl certificate files

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

How to create .csr file
How to create ssl key file

openssl req -new -newkey rsa:2048 -nodes -keyout ashishnepal.com.key -out ashishnepal.com.csr

How to create .crt file

openssl x509 -req -days 365 -in ashishnepal.com.csr -signkey ashishnepal.com.key -out ashishnepal.com.crt

or simply paste, required file into your crt provider. (e.g. paste csr file into godaddy ssl generator.)

How to create .pem file.

A pem file contains the certificate and the private key. It depends on the format your certificate/key are in, but probably it’s as simple as this:

cat ashishnepal.com.crt ashishnepal.com.key > ashishnepal.com.pem

How to Force Proxy Settings Via Group Policy on all browsers

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

How to Force Proxy Settings Via Group Policy on all browsers

How to Force Proxy Settings Via Group Policy on all browsers
i.e. Google Chrome, firefox , IE

This article describes how to force proxy settings via Group Policy.

Click Start – All programs – Administrative Tools – Group Policy Management.
Create or Edit Group Policy Objects.

[I would recommend doing a new group policy object]

Expand User configuration – Policies – Windows Settings – Internet Explorer Maintenance – Connection.
In right Pane Proxy Settings.

For some security reasons maybe administrator need to prevent end users from change their proxy settings.
You can do it with group policy follow this steps:

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Click Start – All programs – Administrative Tools – Group Policy Management.
Create or Edit Group Policy Objects.
Expand Computer Configuration – Administrative Templates – Windows Components - Internet Explorer – Internet Control Panel
In right Pane Disable the Connections page (Enabled)

Now this above given would help you doing for IE, but how to force proxy settings via Group policy on Google Chrome

Google has provided policy tamplate,

http://www.chromium.org/administrators/policy-templates

And so is provided by Firefox aswell.

http://sourceforge.net/projects/firefoxadm

How to add firefox/ google adm templates

Expand the “Computer Configuration” level in the tree. for the Group policy object that you want to edit.
Right-click on “Administrative Templates” and select “Add/Remove Templates”.
Click the “Add”

Upgrade php Script

#!/bin/bash

#######################################################################
# This script upgrades php into newer version with simply passing     #
# version as an argument i.e. sh upgrade_php.sh PHP-5.3.17 (if        #
# i want to upgrade to given version.)                                #
#                                                                     #
# This script usage repo of uk.php.net which might not work if there  #
# is change with layout of repository, you might simply want to change#
# URL on REPO on line 35                                              #
#                                                                     #
# NOTE: So far this script only identifies HTTPD/LIGHTTPD, which      #
# has to be changed according to your need on line 45 (i.e. grep )    #
#######################################################################

function chkInput
                {
                if [ -z "$1" ];then
                displayUsage
                exit 0;
                fi
                }

function displayUsage
                {
                echo "Please enter php version you want to upgrade for"
                echo "If you want to upgrade php version 5.3.17 please write PHP-5.3.17"
                echo "Usage: sh upgrade_php.sh PHP-5.x.x"
                }



chkInput $1

REPO=`echo http://uk.php.net/get/$1.tar.gz/from/this/mirror | sed -e's/PHP/php/g'`


CUR_VERSION=`php --version | head -1 | cut -d' ' -f1,2 | sed -e 's/PHP /php-/g'`
CONFIGURE=`php -i | grep -i configure | awk '{for (i=1; i<=NF-3; i++) $i = $(i+3); NF-=3; print}'`
TARFILE=`echo $REPO | cut -d"/" -f5`
VERSION=`echo $REPO | cut -d"/" -f5 | sed -e's/.......$//g'`
SRC="/usr/local/src"
LOCALREPO="/usr/local/src/$VERSION/"

WEBSERVER=`netstat -tupan | grep -i 80 | grep -i "httpd" | awk '{ print $7}' | cut -d'/' -f2 | sort | uniq`




         if [ "$CUR_VERSION" = "$VERSION" ]; then
         echo 'Old Version: '$CUR_VERSION' Is same as Target Version: '$VERSION''


         else
                echo " Preparing PHP Upgrade from $CUR_VERSION to $VERSION "

                        read -t 5 -p "Press 'Q' to abort within 5 seconds..:" confirm

                                if [ "$confirm" != 'Q' ];then

                                                `cd $SRC && wget $REPO && tar -zxvf $TARFILE && cd $VERSION && $CONFIGURE && make && make install && service $WEBSERVER restart`

                                else
                                                echo "User Abort,exiting..."
                                fi
        fi

###### Standard PHP Config

./configure  --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5 --with-apxs2 --with-openssl --with-kerberos --with-zlib --with-bz2 --enable-calendar --with-curl --enable-dba --with-db4 --with-gdbm --enable-ftp --with-gd --with-jpeg-dir=/usr/lib64 --with-png-dir=/usr/lib64 --enable-gd-native-ttf --with-gettext --with-mhash --with-imap --with-imap-ssl --with-ldap --with-ldap-sasl --enable-mbstring --with-mcrypt --with-mysql --enable-soap --enable-sockets --enable-sqlite-utf8 --enable-zip --with-libdir=lib64 --with-iconv --with-xmlrpc --with-mime-magic --enable-pdo --with-gd-ttf --with-freetype-dir=/usr/include/freetype2/ --enable-intl --enable-bcmath

How to check modules compiled with php on your server

How to check modules compiled with php on your server

php -i | grep -i configure | awk '{for (i=1; i<=NF-3; i++) $i = $(i+3); NF-=3; print}'

How to expand size of ext3 (non-LVM)

// Lets Run df -h
// To see the size of disks

#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
47G 19G 26G 43% /
/dev/sda1 99M 20M 75M 21% /boot
tmpfs 3.0G 0 3.0G 0% /dev/shm
/dev/sdb1 197G 182G 4.9G 98% /var

// OOPS, seems like we are running out of disk on /dev/sdb1 i.e. /var
// And this is critical disk for me.

# fdisk -l

Disk /dev/sda: 53.6 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 6527 52323705 8e Linux LVM

Disk /dev/sdb: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 26108 209712478+ 83 Linux

Okie, so as i expanded disk from clound cPanel, i have got 268.4 GB of disk,
however df -h still doesnot show the equal amount.
Now that means i will have to delete and re partition it.
Yes, Delete, And yes, it wont delete files. So do need to worry.

# fdisk /dev/sdb

The number of cylinders for this disk is set to 32635.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdb: 268.4 GB, 268435456000 bytes
255 heads, 63 sectors/track, 32635 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 26108 209712478+ 83 Linux

Command (m for help): d
Selected partition 1

// I have deleted partition 1 on /dev/sdb
// It could be sdb2 in your case which will be partition 2 and sdb3 might be 3 and so on.

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-32635, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-32635, default 32635):
Using default value 32635

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

# resize2fs /dev/sdb1
resize2fs 1.39 (29-May-2006)
The filesystem is already 52428119 blocks long. Nothing to do!

Yes here we will need to reboot.
# reboot

Broadcast message from root (pts/0) (Sat Apr 6 22:18:38 2013):

The system is going down for reboot NOW!

OOPSY not yet, ok lets not worry
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
47G 19G 26G 43% /
/dev/sda1 99M 20M 75M 21% /boot
tmpfs 3.0G 0 3.0G 0% /dev/shm
/dev/sdb1 197G 182G 4.9G 98% /var

# resize2fs /dev/sdb1
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/sdb1 is mounted on /var; on-line resizing required

Performing an on-line resize of /dev/sdb1 to 65535151 (4k) blocks.
The filesystem on /dev/sdb1 is now 65535151 blocks long.

# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
47G 19G 26G 43% /
/dev/sda1 99M 20M 75M 21% /boot
tmpfs 3.0G 0 3.0G 0% /dev/shm
/dev/sdb1 247G 182G 52G 78% /var

Bingo ))

Powered by WordPress & Theme by Anders Norén