Monday 28 April 2014

Configure NFS in Linux

Three rpm's are required to configure nfs server.
nfs, portmap and xinetd, check them if not found then install them,

rpm -qa nfs*
nfs-utils-1.0.9-66.el5
nfs-utils-lib-1.0.8-7.9.el5

rpm -qa portmap*
portmap-4.0-65.2.2.1

rpm -qa xinetd*
xinetd-2.3.14-17.el5


/etc/init.d/portmap restart
/etc/init.d/xinetd restart
/etc/init.d/nfs restart


chkconfig portmap on
chkconfig xinetd on
chkconfig nfs on

mkdir /data
chmod 777 /data
vi /etc/exports

/data   192.168.209.128 (rw,sync)

exportfs -r

showmount -e 192.168.209.128

Export list for 192.168.209.128:
/data (everyone)

mount -t nfs 192.168.209.128:/data/ /mnt

cd /mnt/

cat > test
This is testfile

cd
umount /mnt

mkdir /temp

vi /etc/fstab

192.168.209.128:/data /temp nfs defaults 0 0

reboot

cd /temp
ls
test

ref : http://computernetworkingnotes.com/network-administrations/nfs-server.html

Windows Useful Commands


Application = Command

Accessibility Controls = access.cpl
Add Hardware Wizard = hdwwiz.cpl
Add/Remove Programs = appwiz.cpl
Administrative Tools = control admintools
Automatic Updates = wuaucpl.cpl

Bluetooth Transfer Wizard = fsquirt
Calculator = calc
Certificate Manager = certmgr.msc
Character Map = charmap
Check Disk Utility = chkdsk

Clipboard Viewer = clipbrd
Command Prompt = cmd
Component Services = dcomcnfg
Computer Management = compmgmt.msc
Date and Time Properties = timedate.cpl

DDE Shares = ddeshare
Device Manager = devmgmt.msc
Direct X Control Panel (If Installed)* = directx.cpl
Direct X Troubleshooter = dxdiag
Disk Cleanup Utility = cleanmgr

Disk Defragment = dfrg.msc
Disk Management = diskmgmt.msc
Disk Parmelonion Manager = diskpart
Display Properties = control desktop/desk.cpl
Dr. Watson System Troubleshooting Utility = drwtsn32

Driver Verifier Utility = verifier
Event Viewer = eventvwr.msc
File Signature Verification Tool = sigverif
Findfast = findfast.cpl
Folders Properties = control folders

Fonts = control fonts
Fonts Folder = fonts
Free Cell Card Game = freecell
Game Controllers = joy.cpl
Group Policy Editor (XP Prof) = gpedit.msc

Hearts Card Game = mshearts
Iexpress Wizard = iexpress
Indexing Service = ciadv.msc
Internet Properties = inetcpl.cpl
IP Configuration = ipconfig

Java Control Panel (If Installed) = jpicpl32.cpl
Java Application Cache Viewer (If Installed) = javaws
Keyboard Properties = control keyboard
Local Security Settings = secpol.msc
Local Users and Groups = lusrmgr.msc

Logs You Out Of Windows = logoff
Microsoft Chat = winchat
Minesweeper Game = winmine
Mouse Properties = control mouse
Mouse Properties = main.cpl

Network Connections = control netconnections
Network Connections = ncpa.cpl
Network Setup Wizard = netsetup.cpl
Notepad = notepad
Nview Desktop Manager (If Installed) = nvtuicpl.cpl

Object Packager = packager
ODBC Data Source Administrator = odbccp32.cpl
On Screen Keyboard = osk
Opens AC3 Filter (If Installed) = ac3filter.cpl
Password Properties = password.cpl

Performance Monitor = perfmon.msc
Performance Monitor = perfmon
Phone and Modem Options = telephon.cpl
Power Configuration = powercfg.cpl
Printers and Faxes = control printers

Printers Folder = printers
Private Character Editor = eudcedit
Quicktime (If Installed) = QuickTime.cpl
Regional Settings = intl.cpl
Registry Editor = regedit

Registry Editor = regedit32
Remote Desktop = mstsc
Removable Storage = ntmsmgr.msc
Removable Storage Operator Requests = ntmsoprq.msc
Resultant Set of Policy (XP Prof) = rsop.msc

Scanners and Cameras = sticpl.cpl
Scheduled Tasks = control schedtasks
Security Center = wscui.cpl
Services = services.msc
Shared Folders = fsmgmt.msc

Shuts Down Windows = shutdown
Sounds and Audio = mmsys.cpl
Spider Solitare Card Game = spider
SQL Client Configuration = cliconfg
System Configuration Editor = sysedit

System Configuration Utility = msconfig
System File Checker Utility = sfc
System Properties = sysdm.cpl
Task Manager = taskmgr
Telnet Client = telnet

User Account Management = nusrmgr.cpl
Utility Manager = utilman
Windows Firewall = firewall.cpl
Windows Magnifier = magnify
Windows Management Infrastructure = wmimgmt.msc

Windows System Security Tool = syskey
Windows Update Launches = wupdmgr
Windows XP Tour Wizard = tourstart
Wordpad = write

Friday 25 April 2014

Increasing group_concat_max_len param in MySQL


SET GLOBAL group_concat_max_len=1024M

vi /etc/my.cnf

group_concat_max_len = 1024M

/etc/init.d/mysql restart

Shutting down MySQL......                                  [  OK  ]
Starting MySQL..                                           [  OK  ]

mysql -u root -p

Enter password:

mysql>SHOW VARIABLES LIKE "%group_concat_max_len";
+----------------------+------------+
| Variable_name        | Value      |
+----------------------+------------+
| group_concat_max_len | 1073741824 |
+----------------------+------------+
1 row in set (0.00 sec)

Copying files using pscp

Copying files from your UNIX host to your Windows PC

C:\Program Files (x86)>pscp "H:\Digitally_3.6_International\vmware.log" root@172
.16.0.134:/tmp/

root@172.16.0.134's password:
vmware.log                | 84 kB |  84.0 kB/s | ETA: 00:00:00 | 100%

http://www.nber.org/pscp.html

Limit number of simultaneous logins attempts for a user


To limit the max number of logins to 2 for user vivek

vi /etc/security/limits.conf

vivek         hard    maxlogins       2

ref:http://nixcraft.com/centos-rhel-fedora/13764-ssh-limit-number-simultaneous-logins-attempts-each-user.html

Thursday 24 April 2014

Change SVN Server IP


Modify when SVN server IP address changes

cd /data/mysql-svn-bkp/ObjectMap/

svn switch --relocate svn://172.16.0.25/db-backup/Trunk/mysql/ svn://10.98.33.63/db-backup/Trunk/mysql/


Shrink VMware Virtual Disk File (.vmdk)


To remove any unneeded files from the virtual machine to free space

yum clean

To fill the unused space with zeros

cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill

poweroff

Start cmd

C:\Program Files (x86)\VMware\VMware Player>vmware-vdiskmanager.exe -k "H:\Digit
ally_3.6\Edulinux_en-gb.vmdk"

  Shrink: 100% done.
Shrink completed successfully.

Ref:- http://www.howtoforge.com/how-to-shrink-vmware-virtual-disk-files-vmdk

Wednesday 23 April 2014

Change the MySQL data default directory


Steps for MySQL data directory change,

Stopping the MySQL server

service mysql stop

Create a new data directory and move the content from the old data directory

mkdir /data/var/lib/mysql

chown mysql:mysql /data/var/lib/mysql

mv /var/lib/mysql/* /data/var/lib/mysql

Correct the MySQL configuration file

vi /etc/my.cnf

[mysqld]

datadir = /data/var/lib/mysql

socket = /data/var/lib/mysql/mysql.sock

slow_query_log_file = /data/var/lib/mysql/mysql-slow.log

general_log_file = /data/var/lib/mysql/general.log

[client]

socket = /data/var/lib/mysql/mysql.sock

Adjust SELinux parameters to accept our new change

getenforce
Disabled

If semanage SELinux Command Not Found

yum install policycoreutils-python

man semanage

rpm -qf `which semanage`
policycoreutils-python-2.0.83-19.39.el6.x86_64

semanage fcontext -a -t mysqld_db_t "/data/var/lib/mysql(/.*)?"

grep -i mysql /etc/selinux/targeted/contexts/files/file_contexts.local
/data/var/lib/mysql(/.*)?    system_u:object_r:mysqld_db_t:s0

restorecon -Rv data/var/lib/mysql

Starting the MySQL server

service mysql start

mysql -u root -p

mysql> show databases;

Optionally you can just use

mysql -u root -p --protocol tcp


Ref:-  

 http://crashmag.net/change-the-default-mysql-data-directory-with-selinux-enabled

https://blogs.oracle.com/jsmyth/entry/selinux_and_mysql

https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Managing_Confined_Services/sect-Managing_Confined_Services-MySQL-Configuration_Examples.html

Restore Power School Database


Stop Power Teacher Services

Stop Report Works Services

start cmd

cd \oracle\scripts

DropSchema.bat PRODDB

(Restart Oracle Services if schemas are fail to drop)

sqlplus / as sysdba

create user PS identified by password;

create user PS_MGMT identified by password;

grant create session, dba to PS;

grant create session, dba to PS_MGMT;

CREATE OR REPLACE DIRECTORY DATA_PUMP_DIR AS 'E:\oradata\PSPRODDB\data_pump_dir';

GRANT READ, WRITE ON DIRECTORY DATA_PUMP_DIR TO PS;

exit

replace the .dmp file in data_pump_dir

SYS@PSPRODDB AS SYSDBA>Import.bat PRODDB EXPDP_FULLDB Y

Start Power Teacher Services

Start Report Works Services


To reset user Passowrd

SYS@PSPRODDB AS SYSDBA>ALTER USER PS IDENTIFIED BY edurite;

User altered.

SYS@PSPRODDB AS SYSDBA>ALTER USER PS_MGMT IDENTIFIED BY edurite;

User altered.


To Unlock the user Accounts

SYS@PSPRODDB AS SYSDBA>ALTER USER PS_MGMT IDENTIFIED BY edurite ACCOUNT UNLOCK;

User altered.

SYS@PSPRODDB AS SYSDBA>ALTER USER PS IDENTIFIED BY edurite ACCOUNT UNLOCK;

User altered.



Backup Oracle Database in Windows Server


Start cmd

sqlplus / as sysdba

SYS@PRODDB AS SYSDBA>CREATE OR REPLACE DIRECTORY DATA_PUMP_DIR1 AS 'E:\Oracle_Backup';

Create Oracle_Backup directory if necessary.

E:\oracle\product\11.2.0\dbhome_1\BIN>expdp.exe '/ as sysdba' full=y directory=DATA_PUMP_DIR1 dumpfile=expdp_fulldb.dmp logfile=expdp_fulldb.log


Tuesday 15 April 2014

httpd and php Installation in RHEL 6

httpd 2.2.15-30 and php 5.5.9-1 Installation in RHEL 6

2.6.32-431.3.1.el6.x86_64

yum install httpd

rpm -qa | grep httpd
httpd-tools-2.2.15-30.el6_5.x86_64
httpd-2.2.15-30.el6_5.x86_64

vi /etc/httpd/conf/httpd.conf
AllowOverride All

http://rpm.pbone.net/
search php55w-common-5.5.9-1.w6

wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-cli-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-common-5.5.9-1.w6.x86_64.rpm

rpm -ivh php55w-common-5.5.9-1.w6.x86_64.rpm
rpm -ivh php55w-cli-5.5.9-1.w6.x86_64.rpm
rpm -ivh php55w-5.5.9-1.w6.x86_64.rpm

wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-mcrypt-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-soap-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-pecl-apcu-devel-4.0.3-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-opcache-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-bcmath-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-mysqlnd-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-odbc-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-xml-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-pecl-apcu-4.0.3-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-pecl-memcache-3.0.8-2.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-pdo-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-mbstring-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-xmlrpc-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-devel-5.5.9-1.w6.x86_64.rpm
wget ftp://ftp.pbone.net/mirror/repo.webtatic.com/yum/el6/x86_64/php55w-pecl-xdebug-2.2.3-2.w6.x86_64.rpm
wget ftp://ftp.uni-bayreuth.de/pub/redhat.com/fedora/linux/releases/10/Everything/ppc/os/Packages/php-pear-1.7.2-2.fc10.noarch.rpm

rpm -ivh php55w-bcmath-5.5.9-1.w6.x86_64.rpm
rpm -ivh php55w-mbstring-5.5.9-1.w6.x86_64.rpm
rpm -ivh php55w-pdo-5.5.9-1.w6.x86_64.rpm
rpm -ivh php55w-mysqlnd-5.5.9-1.w6.x86_64.rpm
rpm -ivh php55w-soap-5.5.9-1.w6.x86_64.rpm
rpm -ivh php55w-xmlrpc-5.5.9-1.w6.x86_64.rpm

yum install autoconf automake pcre-devel
rpm -ivh php55w-devel-5.5.9-1.w6.x86_64.rpm


wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/csbuild:/centosextra/RHEL_5/x86_64/libtool2-ltdl-2.2.6b-3.4.x86_64.rpm
wget ftp://ftp.univie.ac.at/systems/linux/fedora/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm

rpm -ivh libmcrypt-2.5.8-9.el6.x86_64.rpm
rpm -ivh libtool2-ltdl-2.2.6b-3.4.x86_64.rpm

rpm -ivh php55w-mcrypt-5.5.9-1.w6.x86_64.rpm

wget ftp://ftp.muug.mb.ca/mirror/centos/6.5/os/x86_64/Packages/unixODBC-2.2.14-12.el6_3.x86_64.rpm

rpm -ivh unixODBC-2.2.14-12.el6_3.x86_64.rpm
rpm -ivh php55w-odbc-5.5.9-1.w6.x86_64.rpm

wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/tsariounov:/tools/RedHat_RHEL-6/x86_64/libxslt1-1.1.28-66.1.x86_64.rpm
rpm -ivh libxslt1-1.1.28-66.1.x86_64.rpm
rpm -ivh php55w-xml-5.5.9-1.w6.x86_64.rpm

wget ftp://ftp.icm.edu.pl/vol/rzm2/linux-fedora-secondary/archive/development/ia64/os/Packages/php-pear-1.7.2-2.fc10.noarch.rpm
rpm -ivh php-pear-1.7.2-2.fc10.noarch.rpm

rpm -ivh php55w-pecl-apcu-4.0.3-1.w6.x86_64.rpm
rpm -ivh php55w-pecl-apcu-devel-4.0.3-1.w6.x86_64.rpm
rpm -ivh php55w-pecl-memcache-3.0.8-2.w6.x86_64.rpm
rpm -ivh php55w-pecl-xdebug-2.2.3-2.w6.x86_64.rpm

rpm -ivh php55w-opcache-5.5.9-1.w6.x86_64.rpm

pear list

Installed packages, channel pear.php.net:
=========================================
Package          Version State
Archive_Tar      1.3.7   stable
Console_Getopt   1.2.3   stable
PEAR             1.9.4   stable
Structures_Graph 1.0.4   stable
XML_RPC          1.5.4   stable
XML_Util         1.2.1   stable

pear install Auth_SASL Config Log MDB2 MDB2_Driver_mysqli Mail Mail_Mime Mail_mimeDecode Net_SMTP Net_Socket XML_Parser

pear list

Installed packages, channel pear.php.net:
=========================================
Package            Version State
Archive_Tar        1.3.2   stable
Auth_SASL          1.0.6   stable
Config             1.10.12 stable
Console_Getopt     1.2.3   stable
Log                1.12.7  stable
MDB2               2.4.1   stable
MDB2_Driver_mysqli 1.4.1   stable
Mail               1.2.0   stable
Mail_Mime          1.8.8   stable
Mail_mimeDecode    1.5.5   stable
Net_SMTP           1.6.2   stable
Net_Socket         1.0.14  stable
PEAR               1.7.2   stable
Structures_Graph   1.0.2   stable
XML_Parser         1.3.4   stable
XML_RPC            1.5.1   stable
XML_Util           1.2.1   stable

vi /var/www/html/index.php

<?php
 phpinfo();
?>

:wq

/etc/init.d/httpd restart

Now browse on any web browser with IP



Monday 14 April 2014

Grant usage for a specific user in MySQL


Grant usage for a specific user

mysql -u root -p
Enter password:

mysql> use mysql;

mysql> grant all on *.* to 'username'@'%' identified by 'password';

mysql> flush privileges;


Wednesday 9 April 2014

sar command in Linux


sar - Collect, report, or save system activity information.

yum install sysstat

cd /var/log/sa

sar

Linux 2.6.18-238.9.1.el5         04/09/2014

04:40:01 AM       CPU     %user     %nice   %system   %iowait    %steal     %idle
04:50:01 AM       all      9.93      0.00      1.04      1.02      0.00     88.01
05:00:01 AM       all      8.56      0.00      0.79      1.07      0.00     89.58
05:10:01 AM       all      6.81      0.00      0.65      1.18      0.00     91.36
05:20:01 AM       all      7.63      0.10      0.68      0.91      0.00     90.69
05:30:01 AM       all      6.95      0.00      0.64      0.79      0.00     91.62
05:40:01 AM       all     10.36      0.00      0.83      0.97      0.00     87.83
05:50:01 AM       all      9.30      0.00      0.82      0.92      0.00     88.96
06:00:01 AM       all      9.34      0.00      0.81      0.90      0.00     88.95
06:10:01 AM       all     12.96      0.00      0.81      0.81      0.00     85.43
06:20:01 AM       all     11.03      0.10      1.03      0.58      0.00     87.27
06:30:01 AM       all     12.49      0.00      1.10      0.70      0.00     85.72
06:40:01 AM       all      9.44      0.00      0.82      0.66      0.00     89.07
06:50:01 AM       all      9.09      0.00      0.79      0.56      0.00     89.56
07:00:01 AM       all     10.42      0.00      0.93      0.61      0.00     88.04
07:10:01 AM       all     10.75      0.00      0.91      0.63      0.00     87.71
Average:             all      9.67      0.01      0.84      0.82      0.00     88.65


             %user
                     Percentage of CPU utilization that occurred while execut-
                     ing at the user level (application).

              %nice
                     Percentage of CPU utilization that occurred while execut-
                     ing at the user level with nice priority.

              %system
                     Percentage of CPU utilization that occurred while execut-
                     ing at the system level (kernel).

              %iowait
                     Percentage of time that the CPU or CPUs were idle  during
                     which the system had an outstanding disk I/O request.

              %idle
                     Percentage of time that the CPU or CPUs were idle and the
                     system did not have an outstanding disk I/O request.

Ref:- http://www.linuxcommand.org/man_pages/sar1.html

Friday 4 April 2014

MySQL 5.6 Installation in RHEL 6


Download the rpm's to the /usr/local/src

wget https://downloads.skysql.com/archives/mysql-5.6/MySQL-client-5.6.12-1.el6.x86_64.rpm
wget https://downloads.skysql.com/archives/mysql-5.6/MySQL-server-5.6.12-1.el6.x86_64.rpm
wget https://downloads.skysql.com/archives/mysql-5.6/MySQL-shared-compat-5.6.12-1.el6.x86_64.rpm
wget https://downloads.skysql.com/archives/mysql-5.6/MySQL-devel-5.6.12-1.el6.x86_64.rpm
wget https://downloads.skysql.com/archives/mysql-5.6/MySQL-shared-5.6.12-2.el6.x86_64.rpm

rpm -e mysql-libs-5.1.71-1.el6.x86_64 --nodeps

rpm -ivh MySQL-client-5.6.12-1.el6.x86_64.rpm MySQL-devel-5.6.12-1.el6.x86_64.rpm MySQL-server-5.6.12-1.el6.x86_64.rpm MySQL-shared-5.6.12-2.el6.x86_64.rpm MySQL-shared-compat-5.6.12-1.el6.x86_64.rpm

/etc/init.d/mysql restart
Shutting down MySQL..                                      [  OK  ]
Starting MySQL.                                            [  OK  ]

Ref :- https://downloads.skysql.com/archive/index/p/mysql/v/5.6.12

Thursday 3 April 2014

Display recently modified files in Linux


Display Today’s modified Files in Linux

ls -al --time-style=+%D | grep `date +%D`
find . -maxdepth 1 -mtime -1
find . -mtime -1 -print
find . -mtime -1 -printf "%u %p\n" | sort

Display recently modified file in present working directory

find -maxdepth 1 -type f -mtime -1
find -maxdepth 1 -type f -daystart -mtime -1
find "pwd" -mtime -1 -type f -print
find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r


Display recently modified directory in present working directory

find -maxdepth 1 -type d -mtime -1
find -maxdepth 1 -type d -daystart -mtime -1
find "pwd" -mtime -1 -type d -print
find . -type d -printf '%TY-%Tm-%Td %TT %p\n' | sort -r


Wednesday 2 April 2014

Installing PHPUnit in RHEL


 wget https://phar.phpunit.de/phpunit.phar

 chmod +x phpunit.phar

 mv phpunit.phar /usr/local/bin/phpunit