How to create repository in Redhat 7 Linux


Repository is database of application installation and up-gradation of packages which are available on different Linux distributions. The packages of distros are available on official websites or you can extract them from official CD/DVD. We can easily install, upgrade or delete packages from repository.

Step 1: Mount ISO from DVD or Folder

In order to create repository, first mount ISO image from Official DVD or download it from given websites.

# cd /root
# mount -o loop RHEL-7.0 Server.x86_64-dvd.iso /mnt/	(For Redhat 7)
# mount -r -t iso9660 -o loop -v rhel-server-6.4-x86_64-dvd.iso /mnt	(For Redhat 6)

Step 2: Create Repository

To create repository follow the following steps.

# cd /etc/yum.repos.d/
# vi rhel7.repo

Step 3: Install Packages

Install Packages using yum command.

# yum clean all
# yum install ftp httpd gcc

How to reset root password in Linux


If you forgot your root password, then it’s not a big deal. Below are the methods to reset root password in different linux distributions.

Step 1: Power on Redat/CentOS 7 Server

First power on your Redhat/CentOS 7 server. At the boot menu, select the Kernel you want to boot up and press e to edit the selected boot entry.


Find the line rhgb quiet :


and replace it with init=/bin/bash



Then press CTRL+X to enter into single user mode.

Step 2: Mount / partition

# mount -o remount,rw /

Step 3: Change root password

# passwd root

Step 4: Create File

# touch /.autorelabel

Step 5: Execute Command

# exec /sbin/init

How to Install and Configure dnsmasq in Linux


Dnsmasq is a lightweight DNS forwarder and resource constrained routers and firewalls. It is widely used for tethering on smartphones and portable hotspots, and to support virtual networking in virtualisation frameworks. Dnsmasq is included in most Linux distributions like FreeBSD, OpenBSD and NetBSD.

Step 1: Install dnsmasq

First install dnsmasq package using yum command.

# yum -y install dnsmasq

Step 2: Configuration

Configure dnsmasq service as per following settings.

# vi /etc/dnsmasq.conf
# line 19: uncomment (never forward plain names)
# line 21: uncomment (never forward addresses in the non-routed address spaces)
# line 41: uncomment (query with each server strictly in the order in resolv.conf)
# line 55: add if you need
# query the specific domain name to the specific DNS server
# the example follows means query [] domain to the [] server
# line 123: uncomment (add domain name automatically)
# line 133: add (define domain name)

Step 3: Start Service

Run the DHCP service by using below command and start service.

# systemctl start dnsmasq
# systemctl enable dnsmasq

Step 4: Entry in hosts file

# vi /etc/hosts   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# add records   dlp.tecdistro dlp 

Restart the dnsmasq service.

# systemctl restart dnsmasq

Step 5: Add service in firewall

# firewall-cmd --add-service=dns --permanent 
# firewall-cmd --reload 

WiFi Router Security breaches


Wifi security breaches when the research and development team scanned 32 WiFi router firmware firmware products offered by more than 10 of the most popular home, SMB and enterprise wireless routers in the US, Europe and Asia Manufacturer: Asus, Belkin, Buffalo, Cisco, D-Link, EFM, Huawei, Linksys, Netis and TP-Link.

Severity Level

The firmware of the WiFi router sold by the top vendors included versions of open source components with vulnerabilities specified in the binary scans. The firmware of most models contained security holes “Severity High” and “Severity Middle”. This means that deployed products and firmware updates remain vulnerable to potential security threats.


The entire firmware uses Busybox and Samba by default, as the report shows. More than 60 percent used OpenSSL. Significant security issues arise from OpenSSL. This should prompt vendors to consistently use the latest patches or use the version of the software that contains the fix, the researchers said. Much of the firmware did not use the correct, most recent versions of OSS components available, the study found.


How to create FTP user and assign quota in Solaris


File Transfer Protocol(FTP) is a network protocol used for the transfer of files between a client and server on network.

Step 1: Create User

First create FTP user by using following method.

# useradd test
# passwd test

Step 2: Create FTP user Directory

Make a directory in ftpdata folder

# cd /ftpdata/
# ls -l
# mkdir test
# chown test:staff test

Step 3: How to assign quota for FTP User in Solaris

In order to assign quota to FTP user below is the method.

# zfs create ftpdata/test
# zfs set quota=50M ftpdata/test

Thanks, all done :)


4 ways to check size of physical memory in Linux


In this article we will see basic commands to check the physical memory on the server under Linux. Many beginners struggle to know their system well in the context of resources such as CPU, Memory, Disks, etc. So I decided to write this small item pointing command to check the RAM on the Linux server. These commands will work in different flavors of Linux like Red Hat, CentOS, Suse, Ubuntu, Fedora, Debian etc.

1) Using free command

This command is mainly used to check the RAM and SWAP on the system. Using a different change, you can change the output byte format. Like -b for bytes, -k for kilobytes, -m for megabytes, and -g for gigabytes.

# free -b
              total        used        free      shared  buff/cache   available
Mem:     3976634368  3096838144   187990016    51572736   691806208   540106752
Swap:    4001361920     8826880  3992535040
# free -k
              total        used        free      shared  buff/cache   available
Mem:        3883432     3024204      183600       50364      675628      527488
Swap:       3907580        8620     3898960
# free -m
              total        used        free      shared  buff/cache   available
Mem:           3792        2953         179          49         659         515
Swap:          3815           8        3807
# free -g
              total        used        free      shared  buff/cache   available
Mem:              3           2           0           0           0           0
Swap:             3           0           3

2) Using /proc/meminfo file

# cat /proc/meminfo |grep Mem
MemTotal:        3883432 kB
MemFree:          183268 kB
MemAvailable:     527276 kB

3) Using top command

# top
top - 12:36:36 up 8 days,  2:58,  2 users,  load average: 0.14, 0.14, 0.08
Tasks: 213 total,   1 running, 212 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.2 us,  0.7 sy,  0.0 ni, 99.0 id,  0.2 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  3883432 total,   182356 free,  3025080 used,   675996 buff/cache
KiB Swap:  3907580 total,  3898960 free,     8620 used.   526608 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                            
 2303 root      20   0 2378464 541076   7692 S   1.0 13.9 417:16.56 OpsCenterDBd   

4) Using vmstat

[root@opscenter ~]# vmstat -s
      3883432 K total memory
      3025552 K used memory
      2439780 K active memory
       870348 K inactive memory
       181812 K free memory
       138712 K buffer memory
       537356 K swap cache
      3907580 K total swap
         8620 K used swap
      3898960 K free swap
      2323674 non-nice user cpu ticks
         2978 nice user cpu ticks
       944914 system cpu ticks
    135133743 idle cpu ticks
       692582 IO-wait cpu ticks
          121 IRQ cpu ticks
        49623 softirq cpu ticks
            0 stolen cpu ticks
      1931906 pages paged in
     23034525 pages paged out
          377 pages swapped in
         2353 pages swapped out
    956323695 interrupts
   2040196891 CPU context switches
   1505191059 boot time
       849343 forks


How to install snmp in Redhat 7/CentOS 7


SNMP stands for Simple Network Management Protocol. It is a protocol used to monitor servers. It is used for collecting information from, and configuring, network devices, such as servers, printers, hubs, switches, and routers on an Internet Protocol (IP) network.\

Step 1: Install SNMP

# yum install -y net-snmp net-snmp-utils
# cd /etc/snmp
# cp -p snmpd.conf snmpd.conf.dist
# echo "rocommunity public">snmpd.conf
# echo "syslocation here" >>snmpd.conf
# echo "syscontact root@localhost" >>snmpd.conf
# systemctl enable snmpd && systemctl start snmpd
# snmpwalk -v 1 -c public -O e
SNMPv2-MIB::sysDescr.0 = STRING: Linux 3.10.0-54.0.1.el7.x86_64 #1 SMP Tue Nov 26 16:51:22 EST 2013 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10

How to set session timeout

Step 1: Introduction

The utmpx and wtmpx files are extended database files that have superseded the obsolete utmp and wtmp database files.
The utmpx database contains user access and accounting information for commands such as who(1), write(1), and login(1). The wtmpx database contains the history of user access and accounting information for the utmpx database.

Step 2: Create Backup of wtmpx

In order to create a backup of wtmpx first check the disk space in /tmp and then copy the file in /tmp directory

# /usr/lib/acct/fwtmp < /var/adm/wtmpx > /tmp/wtmpx.orig

Step 3: Empty wtmpx file

To empty wtmpx file us the following command

# cat /dev/null > /var/adm/wtmpx

Step 4: Zip original wtmpx file

Create a zip of original wtmpx file using gzip command

# gzip /tmp/wtmpx.orig

Step 5: Copy original wtmpx

Copy original wtmpx file in /var/adm/ for audit purpose

# cp /tmp/wtmpx.orig.gz /var/adm/

How to Install TOP package in Solaris 10

Step-1: PreRequisites

For installation of top, download the following package.

# wget

Step-2: Extract Zip File

Extract top package using below command.

# gunzip top-3.6.1-sol10-sparc-local.gz

Step-3: Installation

Install and configure top package as given below:

# pkgadd -d top-3.6.1-sol10-sparc-local

The following packages are available:
  1  SMCtop     top
                (sparc) 3.6.1

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 

Processing package instance  from 

top(sparc) 3.6.1
LeFebvre et al

The selected base directory  must exist before
installation is attempted.

Do you want this directory created now [y,n,?,q] y
Using  as the package base directory.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

Installing top as 

## Installing part 1 of 1.
[ verifying class  ]

Installation of  was successful.

Set Default Path

Set the default path of top command in user’s profile.

#echo $PATH
#vi ~.profile

How to Install Raid 1 in Solaris 10

# format
Searching for disks...done

       0. c1t0d0 
       1. c1t1d0 
Specify disk (enter its number): ^Z

# prtvtoc /dev/dsk/c1t0d0s2 > c1t0d0s2.vtoc
# fmthard -s c1t0d0s2.vtoc /dev/rdsk/c1t1d0s2
# df -kh
# metadb -a -c 3 -f c1t0d0s7 c1t1d0s7
# umount /export/home
# metadb -a -c 3 -f c1t0d0s7 c1t1d0s7
# umount /export/home0
# metadb -a -c 3 -f c1t0d0s7 c1t1d0s7
# metainit -f d11 1 1 c1t0d0s0
# metainit -f d12 1 1 c1t1d0s0
# metainit d10 -m d11
# metaroot d10
# metainit -f  d21 1 1 c1t0d0s1
# metainit -f  d22 1 1 c1t1d0s1
# metainit d20 -m d21
# metastat | grep %
# vi /etc/vfstab
#device         device          mount           FS      fsck    mount   mount
#to mount       to fsck         point           type    pass    at boot options
fd      -       /dev/fd fd      -       no      -
/proc   -       /proc   proc    -       no      -
/dev/dsk/c1t0d0s1       -       -       swap    -       no      -
/dev/md/dsk/d10 /dev/md/rdsk/d10        /       ufs     1       no      -
#/dev/dsk/c1t0d0s7      /dev/rdsk/c1t0d0s7      /export/home    ufs     2       yes     -
#/dev/dsk/c1t1d0s7      /dev/rdsk/c1t1d0s7      /export/home0   ufs     2       yes     -
/devices        -       /devices        devfs   -       no      -
sharefs -       /etc/dfs/sharetab       sharefs -       no      -
ctfs    -       /system/contract        ctfs    -       no      -
objfs   -       /system/object  objfs   -       no      -
swap    -       /tmp    tmpfs   -       yes     -