Wednesday, August 27, 2014

How to Install & Run NFS Server with Fixed Ports

Important Files for NFS Configuration
/etc/exports : Its a main configuration file of NFS, all exported files and directories are defined in this file at the NFS Server end.
/etc/fstab : To mount a NFS directory on your system across the reboots, we need to make an entry in /etc/fstab.
/etc/sysconfig/nfs : Configuration file of NFS to control on which port rpc and other services are listening.

NFS Default Ports
111  NFS
2049 Portmap


Install Server with below command
yum install nfs-utils nfs-utils-lib


Start the service & add in startup
/etc/init.d/nfs start
chkconfig nfs on

Edit file to share directory
vi /etc/exports

To share with all
/home/shared *(rw,sync)

To share with particular IP
/home/shared  172.39.253.10(rw,sync)

Important NFS Sharing Options
Some other options we can use in /etc/exports file for file sharing is as follows.
ro: With the help of this option we can provide read only access to the shared files i.e client will only be able to read.
rw: This option allows the client server to both read and write access within the shared directory.
sync: Sync confirms requests to the shared directory only once the changes have been committed.
no_subtree_check: This option prevents the subtree checking. When a shared directory is the subdirectory of a larger file system, nfs performs scans of every directory above it, in order to verify its permissions and details. Disabling the subtree check may increase the reliability of NFS, but reduce security.
no_root_squash: This phrase allows root to connect to the designated directory.


Need to run the below command to export directory after adding in exports file
exportfs -a
 
After changing in exports file run below command to share again (Only required once you shared new directory or changed permission in exports file)
exportfs -r
 
To check files
exportfs -v
 ................................................................................
Client machine
yum install nfs-utils nfs-utils-lib

Start the service & add in startup
/etc/init.d/nfs start
chkconfig nfs on

Run the below command to check shared directory
showmount -e Server-IP

To mount share directory
mount 172.39.253.28:/home/Shared /mnt

Check mount directory
mount | grep nfs

To mount on reboot
172.39.253.28:/home/Shared /mnt  nfs defauls 0 0
 ........................................................................................

 IMPORTANT
Allow NFS with Fixed ports  on Server

Please add the following lines in  /etc/sysconfig/nfs configuration file on server. Any free port may be specified.
LOCKD_TCPPORT=33776
LOCKD_UDPPORT=33776
MOUNTD_PORT=33777
STATD_PORT=33778
RQUOTAD_PORT=33779
RPCNFSDCOUNT=32

Allow above ports on iptables with default 111 & 2049 ports

Restart NFS service
# service nfs restart
# service nfslock restart

Tuesday, August 19, 2014

Bandwidth Monitoring Tool for Linux

There are lot of tools to do the task, I am using bwm-ng

To install it on FEDORA / CENTOS, use
   
yum -y install bwm-ng

To run it , Type the below command at terminal

    bwm-ng

Use following shortcut to tune bwm-ng

Press + to set time interval, default is set to 0.5 seconds which is too short, make it at least 1.00 or 1.1 to get mroe stable value.

Press u to get DATA in kb (kilobits), default is set to KB (Kilo Bytes)

To see data of eth0, with kilobits, and 1 second refresh rate , use following . . .

    bwm-ng +I eth0 -u bits -t 1000

.......................................................................

You can also try alternate tools like iptraf & netwatch (For IP Based utilization)

Friday, August 8, 2014

"There was a problem sending the command to the program" Error in MS Excel

 While double clicking on excel file you got the error There was a problem sending the command to the program & then you need to open the file manually from File menu.
 
Follow below steps to resolve this issue

Microsoft Excel 2010 and 2013

Click the File tab, and then click Options.
Click Advanced, scroll down to the General section, and then clear the Ignore other applications that use Dynamic Data Exchange (DDE) check box in the General area.
Click OK.

Microsoft Excel 2007

Click the Microsoft Office Button, and then click Excel Options.
Click Advanced, and then clear the Ignore other applications that use Dynamic Data Exchange (DDE) check box in the General area.
Click OK.

Now double click any Excel file & it will open without any error

Wednesday, July 30, 2014

Squid Stop Responding/Slow after some time - "WARNING! Your cache is running out of file descriptors"


Squid working fine for some time after restarting & then suddenly goes very slow. Even taking too much time to open google.co.in

Here are the steps need to check

[root@bhagwat ~]# tail -f /var/log/squid/cache.log

WARNING! Your cache is running out of filedescriptors
WARNING! Your cache is running out of filedescriptors
WARNING! Your cache is running out of filedescriptors
WARNING! Your cache is running out of filedescriptors
WARNING! Your cache is running out of filedescriptors


Please follow the below steps to fix the issue & improve the performance of squid

[root@bhagwat ~]# /etc/init.d/squid stop

##Open below file
v
i /etc/security/limits.conf

##Append following line to increase current limit from 1024 to 4096:

* - nofile 4096

[root@bhagwat ~]# vim /etc/squid/squid.conf

##Add the below line at last of squid.conf file

max_filedesc 8096

Save & quit squid.conf

Now open below file

[root@bhagwat ~]# vim /etc/init.d/squid

##Add this line before any code

ulimit -HSn 4096

save & quit the file

Start squid with below command

[root@bhagwat ~]# /etc/init.d/squid start

Enjoy..... Your issue is resolved.

Saturday, June 28, 2014

Install VNC Server in Centos

Installing TightVNC Server

[root@bhagwat ~]# yum install tigervnc-server

Create 1 User for VNC

[root@bhagwat ~]# useradd bhagwat
[root@bhagwat ~]# passwd bhagwat
Changing password for user bhagwat.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

Set VNC Password for User

[root@bhagwat ~]# su - bhagwat

[bhagwat@bhagwat ~]$ vncpasswd
Password:
Verify:

[bhagwat@bhagwat ~]$ exit


Now set the Xstarup Resolution

Go to
[root@bhagwat ~]# vi /etc/sysconfig/vncservers

Add the following lines at the bottom of file

## Single User ##
VNCSERVERS="1:bhagwat"
VNCSERVERARGS[1]="-geometry 1024x768"

Save & quit the file

Now start the VNC Server with below command

[root@bhagwat ~]# /etc/init.d/vncserver start
Starting VNC server: 1:bhagwat
New 'bhagwat.imcl:1 (bhagwat)' desktop is bhagwat.imcl:1

Starting applications specified in /home/bhawgat/.vnc/xstartup
Log file is /home/bhagwat/.vnc/bhagwat.imcl:1.log
                                                                                     [  OK  ]


Now Download VNC Viewer from Client machine & enter the VNC Server IP along with VNC ID(1 in our case)
Ex. if VNC server IP is 192.168.4.200 & your VNC ID is 1 then it should be
192.168.4.200:1

Enter password that we created with “vncpasswd” command.

##########
Disable SELinux & iptables if you are not able to access the shared directory

Tuesday, June 17, 2014

Samba Server Configuration in Centos 6 with Full Access


Install Samba with yum
[root@bhagwat ~]# yum install samba

Create a directory with full access
[root@bhagwat ~]# mkdir -p /home/software 
[root@bhagwat ~]# chmod -R 0777 /home/software

Edit smb.conf file (change the following line)
[root@bhagwat ~]# vi /etc/samba/smb.conf 
## Line no 75 - Change the to windows default workgroup 
      workgroup = WORKGROUP 

## Line no 81 - Uncomment and set the IP Range 
      hosts allow = 127. 192.168.4. 

## Line 102 - set no authentication 
      security = share 

## Add the following lines at the bottom 
   [Softwares] 
path = /home/software 
writable = yes 
browseable = yes 
guest ok = yes 
create mode = 0777 
directory mode = 0777

Save & exit the samba file & Start the samba service with below command
[root@bhagwat ~]# /etc/init.d/smb start


##########
Disable SELinux & iptables if you are not able to access the shared directory