Let's Share Knowledge And Make A Difference

  • Monitor your network and systems like a hawk

    There are some perfact open souce solution for monitoing your Network devices and server system's health. Nagios, Cacti, WhatsUpGold and Smokeping are the leading monitoring tools among them...

    Read More
  • Email service and Security

    Now a days life without email service is unthinkable and E-mail service is quite expensive. As always linux gives us the answer with a strong mail service named postfix...

    Read More
  • Data Center Solution

    A data centre is a facility where companies can keep and operate most of the ICT infrastructure that supports their business. IT host the most critical systems that are vital to the continuity of daily operations...

    Read More

Friday, July 9, 2021

How to solve a problem of NFS 'permission denied'



1. Created a new user at the QNAP server named 'username' and gave him full permission on the desired folder. For example, let's share the 'media' folder.

2. Mounted the partition from the client machine
[root@redhat ~]# mkdir /opt/mymedia/
[root@redhat ~]# mount -t cifs -o username=username,password=user's_password,uid=application_name,gid=application_name //192.168.1.1/media /opt/mymedia/

Testing:
[root@redhat ~]# cd /opt/mymedia/
[root@redhat mymedia]# ll
total 2
-rwxr-xr-x 0 nginx nginx  7 2020-12-15 12:44 100.txt
-rwxr-xr-x 0 nginx nginx  6 2020-12-15 12:44 200.txt
-rwxr-xr-x 0 nginx nginx 15 2020-12-15 12:45 adib.txt
-rwxr-xr-x 0 nginx nginx  5 2021-07-09 12:28 file_permisssion_testing
drwxr-xr-x 0 nginx nginx  0 2021-07-08 18:52 notification_request
drwxr-xr-x 0 nginx nginx  0 2021-06-13 15:10 @Recycle
drwxr-xr-x 0 nginx nginx  0 2021-01-09 18:26 uploads

The problem should be solved now!!! enjoy!!!

Friday, May 21, 2021

How to monitor hardware RAID array status from Linux

 


First check which raid card we are using:

To find out which RAID you are using, just type one command to the command line:

[root@school ~]# lspci -vv | grep -i raid

15:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS-3 3108 [Invader] (rev 02)

Kernel driver in use: megaraid_sas

Kernel modules: megaraid_sas


There may be several responses to this request:

 1. Hewlett-Packard is your HP RAID array

 2. 3ware is your 3ware RAID array

 3. megaRAID is your MegaRAID array

If we do not receive a response or some other answer, then most likely you have software RAID. Here we are using the MegaRAID array.


Let’s install the driver:

Download file from below link

"https://www.broadcom.com/products/storage/raid-controllers/megaraid-sas-9361-8i#downloads"

root@school ~]# wget https://repo.aerisnetwork.com/stable/centos/7/x86_64/megaraid-utils-1.8-2.el7.x86_64.rpm --no-check-certificate


[root@school ~]# yum install mutt

[root@school ~]# rpm -ivh megaraid-utils-1.8-2.el7.x86_64.rpm 

warning: megaraid-utils-1.8-2.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 66e70bec: NOKEY

Preparing...                ########################################### [100%]

   1:megaraid-utils         ########################################### [100%]


Megacli and StorCLI have been installed. We recommend adding the following to your profile:

alias megacli="/opt/megaraid/megacli"

alias storcli="/opt/megaraid/storcli"


Check the RAID status:

[root@school ~]# /opt/megaraid/storcli show

Status Code = 0

Status = Success

Description = None


Number of Controllers = 1

Host Name = school.surecashbd.com

Operating System  = Linux2.6.32-431.el6.x86_64


System Overview:

================


--------------------------------------------------------------------------

Ctl Model          Ports PDs DGs DNOpt VDs VNOpt BBU sPR DS EHS ASOs Hlth 

--------------------------------------------------------------------------

  0 ServeRAIDM5210     8   2   1     0   1     0 Opt On  -  Y      2 Opt  

--------------------------------------------------------------------------


Ctl=Controller Index

DGs=Drive groups

VDs=Virtual drives

Fld=Failed

PDs=Physical drives

DNOpt=DG NotOptimal

VNOpt=VD NotOptimal

Opt=Optimal

Msng=Missing

Dgd=Degraded

NdAtn=Need Attention

Unkwn=Unknown

sPR=Scheduled Patrol Read

DS=DimmerSwitch

EHS=Emergency Hot Spare

Y=Yes|N=No

ASOs=Advanced Software Options

BBU=Battery backup unit

Hlth=Health

Safe=Safe-mode boot


RESULT:

In the Hlth column, the status should be Opt. If not, it means there are problems with the array. Here, our result is "Opt" which means our raid array health is good.


Note:

The command for other server vendors:

  1. Hewlett-Packard is your HP RAID array

~# hpacucli ctrl all show config

  1. 3ware is your 3ware RAID array

~# cat /proc/mdstat

  1. Check Software RAID Status

~# cat /proc/mdstat


blocks [2/1] [_U]

blocks [2/2] [UU]

[UU] or U = healthy, full-featured RAID partition. 

[_U] or [U_] = failed disk.


Sunday, October 12, 2014

MYSQL ERROR 1051 (42S02): Unknown table corrupttablename


Very rare we got a message to the browser saying "Unknown table tablename". Though we have the database and the table properly to the server. To solve the issue, we need to follow the below steps-

ERROR 1051 (42S02): Unknown table corrupttablename

[root@db ~]# service mysqld stop
[root@db ~]# mv /var/lib/mysql/database_name/corrupttablename.frm /tmp
[root@db ~]# service mysqld start

Wednesday, August 27, 2014

How to capture network traffic using Wireshark & TCPdump

How to capture network traffic using Wireshark & TCPdump

Using Wireshark (Grafical interface)
Install wireshark:
mahidul@mtr:~$ sudo apt-get install wireshark

Or, download it from official site https://www.archlinux.org

Error: Wireshark not listing interfaces on Ubuntu 12.04 precise pangolin
Solution:
mahidul@mtr:~$ sudo dpkg-reconfigure wireshark-common
mahidul@mtr:~$ sudo usermod -a -G wireshark $USER
mahidul@mtr:~$ sudo reboot

Reference:
http://it-connects.co/wireshark-not-listing-interfaces-on-ubuntu-12-04-precise-pangolin/


Using TCPdump (Command Line Interface)
Install tcpdump in redhat.
[root@mahidul ~]# yum install tcpdump

Install tcpdump in ubuntu.
mahidul@mtr:~$ apt-get install tcpdump

Check if tcpdump installed properly.
[root@mahidul ~]# rpm -qa | grep tcpdump

1. Capture Packets from Specific Interface
[root@mahidul ~]# tcpdump -i eth0

2. Capture Only N Number of Packets
[root@mahidul ~]# tcpdump -c 5 -i eth0

3. Display Available Interfaces
[root@mahidul ~]# tcpdump -D

4. Display Available Interfaces
[root@mahidul ~]# tcpdump -D

5. Display Captured Packets in HEX and ASCII
[root@mahidul ~]# tcpdump -XX -i eth0

6. Capture and Save Packets in a File
[root@mahidul ~]# tcpdump -w 0001.pcap -i eth0

7. Read Captured Packets File
[root@mahidul ~]# tcpdump -r 0001.pcap

8. Capture IP address Packets
[root@mahidul ~]# tcpdump -n -i eth0

9. Capture only TCP Packets.
[root@mahidul ~]# tcpdump -i eth0 tcp

10. Capture Packet from Specific Port
[root@mahidul ~]# tcpdump -i eth0 port 22

11. Capture Packets from source IP
[root@mahidul ~]# tcpdump -i eth0 src 192.168.0.2

12. Capture Packets from destination IP
[root@mahidul ~]# tcpdump -i eth0 dst 50.116.66.139
 


Reference:
http://www.tecmint.com/12-tcpdump-commands-a-network-sniffer-tool/



Friday, June 13, 2014

Burning CD/DVD using CLI in linux (redhat/debian/ubuntu)

Burning CD/DVD using CLI:
1. find cdrom/dvdrom
2. make an iso
    i. create an iso
    ii. create an iso from collecting data from diffrent location
    iii. add new data to an existence iso
3. burn the disk (cd/dvd)
    i. single session burning
    ii. Multi-session burning
    iii. Blank a disk for re-writing cd/dvd (re-writable disk)


1. First findout the cd drive. Here my cd/dvd rom is dev=1,0,0
root@mahidul:~# cdrecord --devices
wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
 0  dev='/dev/sg1'    rwrw-- : 'hp' 'DVDRAM GT80N'
-------------------------------------------------------------------------

"OR"
root@mahidul:~# cdrecord -scanbus
scsibus0:
    0,0,0      0) 'ATA     ' 'Hitachi HTS54757' 'JE4O' Disk
    0,1,0      1) *
    0,2,0      2) *
    0,3,0      3) *
    0,4,0      4) *
    0,5,0      5) *
    0,6,0      6) *
    0,7,0      7) *

scsibus1:
    1,0,0    100) 'hp      ' 'DVDRAM GT80N    ' 'R102' Removable CD-ROM
    1,1,0    101) *
    1,2,0    102) *
    1,3,0    103) *
    1,4,0    104) *
    1,5,0    105) *
    1,6,0    106) *
    1,7,0    107) *


2. Then make an iso of the folder that you want to write.
root@mahidul:~# mkisofs -J -r -o /storage/cdwrite.iso /storage/cdwrite/

If -joliet-long error shows then use below command.
root@mahidul:~# mkisofs -joliet-long -r -o /storage/cdwrite.iso /storage/cdwrite/

You can make an iso from diffrent locations.
root@mahidul:~# mkisofs -J -r -o  /root/testburn.iso -graft-points /folder1=/var/log/test.log /folder2=/home/mahidul/DSC_9881_20131111_140755.jpg

You can add folders/files later like the below step.

3. Now, Burn the cd with cdrecord command.
root@mahidul:~# cdrecord -v -dev='/dev/sg1' /storage/cdwrite.iso

"OR"
root@mahidul:~# cdrecord -v -dao dev=1,0,0 /storage/cdwrite.iso

"OR" Using wodim (Write Optical DIsc Media):
root@mahidul:~# wodim -eject -tao speed=1 dev=/dev/sg1 -v -data /storage/cdwrite.iso

Write multiple times to a re-writable disk:
root@mahidul:~# cdrecord -v -multi -eject -tao speed=1 -dev='/dev/sg1' /storage/cdwrite.iso

Note:
1. The programs wodim, cdrskin, and xorrecord may be used on all kinds of media with the options shown with "cdrecord".
2. The meaning of the options is:
    -V: Gives the filesystem a name which will probably show up as mount point if the medium is mounted automatically. The ISO specs allow             only "A" to "Z", "0" to "9", and "_". 32 characters at most.
    -J: Prepares names of up to 64 UTF-16 characters for MS-Windows readers. Aka "Joliet".
    -joliet-long: Would allow 103 UTF-16 characters for MS-Windows readers. Not conformant to Joliet specs.
    -r: Prepares names of up to 255 characters for Unix readers and gives read permission for everybody. Aka "Rock Ridge".
    -o: Sets the file path for the resulting ISO image.

Monday, June 2, 2014

Install and Configure Hudson in redhat 6.x

Install and Configure Hudson in redhat 6.x

Packages Requirements:
. Java
. Apache
. Apache-tomcat

Installing java:
Download the leatest java from http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u10-oth-JPR
[root@hudson~]# mkdir -p /usr/jdk
[root@hudson~]# tar -zxvf /Packages/jdk-7u10-linux-x64.tar.gz -C /usr/jdk/
[root@hudson~]# ls /usr/jdk/jdk1.7.0_10/

Installing Apache2:
[root@hudson~]# yum install httpd -y
[root@hudson~]# service httpd restart
[root@hudson~]# chkconfig httpd on

Installing apache-tomcat:
[root@hudson~]# wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.36/bin/apache-tomcat-6.0.36.tar.gz
[root@hudson~]# tar -zxvf /Packages/apache-tomcat-6.0.36.tar.gz -C /usr/share/
[root@hudson~]# vim /usr/share/apache-tomcat-6.0.36/bin/catalina.sh
    #Add the following lines
    JAVA_HOME=/usr/jdk/jdk1.7.0_10/ 
    JAVA_OPTS="-Xms1024m -Xmx4096m -XX:PermSize=256m -XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled"

### Set Java Heap size: (memory allocation for java)
[root@hudson ~]# vim /usr/share/apache-tomcat-6.0.36/bin/setenv.sh
CATALINA_OPTS="-Djava.awt.headless=true -Xms1024m -Xmx10240m -XX:PermSize=1024m -XX:MaxPermSize=2048m"

[root@hudson~]# sh /usr/share/apache-tomcat-6.0.36/bin/startup.sh

[root@hudson~]# yum install -y nmap
[root@hudson~]# nmap localhost
    8080/tcp open  http-proxy

Sometimes apache-tomcat get stuck then pls kill the apache-tomcat process and restart from the below script.

[root@hudson~]# vim /usr/share/apache-tomcat-6.0.36/conf/tomcat-users.xml
# Append the beloow lines under the tomcat-users tag
  <role rolename="manager-gui"/>
  <user username="tomcat" password="your_tomcat_password" roles="manager-gui"/>
 
Now restart the apache-tomcat services:
[root@hudson~]# killall java
[root@hudson~]# sh /usr/share/apache-tomcat-6.0.36/bin/shutdown.sh
[root@hudson~]# sh /usr/share/apache-tomcat-6.0.36/bin/startup.sh

Now our server is ready. We can install hudson in two diffrent ways. First option is using war file and second is installing from repository as standalone service. Here I have presented both procedures. Lets get started.

Install hudson from war file:
First download leatest hudson.war:
[root@hudson ~]# wget http://eclipse.stu.edu.tw//hudson/war/hudson-3.1.2.war

Stop tomcat service:
[root@hudson ~]# /usr/share/apache-tomcat-6.0.36/bin/shutdown.sh
[root@hudson ~]# ps aux | grep tomcat
[root@hudson ~]# killall tomcat
[root@hudson ~]# kill -9 tomcat_id

Copy the hudson war to the tomcat webapps folder.
[root@hudson ~]# cp hudson-3.1.2.war /usr/share/apache-tomcat-6.0.36/webapps/hudson.war

Make hudson home directory and give proper permission:
[root@hudson ~]# mkdir /usr/share/apache-tomcat-6.0.36/.hudson/
[root@hudson ~]# chown tomcat.tomcat -R /usr/share/apache-tomcat-6.0.36/.hudson/

Startup tomcat and check the logs:
[root@hudson ~]# /usr/share/apache-tomcat-6.0.36/bin/shartup.sh
[root@hudson ~]# tail -f /usr/share/apache-tomcat-6.0.36/logs/catalina.out

Wait until all of your web applications loaded. Now go to the web browser, install your required plugins and complete the installation.
http://your_ip_address:8080/hudson/

Note: If you are not getting the hudson you may need to restart the war from tomcat manager (http://your_ip_address:8080).

Install hudson (standalone) from rpm:

[root@hudson ~]# wget -O /etc/yum.repos.d/hudson.repo http://hudson-ci.org/redhat/hudson.repo
[root@hudson ~]# yum check-update
[root@hudson ~]# yum install hudson
[root@hudson ~]# /etc/init.d/hudson start
[root@hudson ~]# tail -f /var/log/hudson/hudson.log

Thats all. Hope this helps you.



Reference:
http://docs.oracle.com/middleware/1212/core/MAVEN/config_hudson.htm#A1001805