Wednesday, August 9, 2017

How to Install docker-compose CentOS7

 Install Docker-compose on CentOs7 Linux.

yum install -y epel-release

yum install -y python-pip

pip install --upgrade pip

pip install docker-compose

pip install backports.ssl_match_hostname --upgrade

Also need to run :
pip install six --upgrade


Checking :
[root@slaveserver ~]# docker-compose -v
docker-compose version 1.15.0, build e12f3b9
[root@slaveserver ~]#

Run docker-compose help for more command-line options.

[root@slaveserver ~]#  docker-compose help
Define and run multi-container applications with Docker.

Usage:
  docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...]
  docker-compose -h|--help

Options:
  -f, --file FILE             Specify an alternate compose file (default: docker-compose.yml)
  -p, --project-name NAME     Specify an alternate project name (default: directory name)
  --verbose                   Show more output
  -v, --version               Print version and exit
  -H, --host HOST             Daemon socket to connect to

  --tls                       Use TLS; implied by --tlsverify
  --tlscacert CA_PATH         Trust certs signed only by this CA
  --tlscert CLIENT_CERT_PATH  Path to TLS certificate file
  --tlskey TLS_KEY_PATH       Path to TLS key file
  --tlsverify                 Use TLS and verify the remote
  --skip-hostname-check       Don't check the daemon's hostname against the name specified
                              in the client certificate (for example if your docker host
                              is an IP address)
  --project-directory PATH    Specify an alternate working directory
                              (default: the path of the Compose file)

Commands:
  build              Build or rebuild services
  bundle             Generate a Docker bundle from the Compose file
  config             Validate and view the Compose file
  create             Create services
  down               Stop and remove containers, networks, images, and volumes
  events             Receive real time events from containers
  exec               Execute a command in a running container
  help               Get help on a command
  images             List images
  kill               Kill containers
  logs               View output from containers
  pause              Pause services
  port               Print the public port for a port binding
  ps                 List containers
  pull               Pull service images
  push               Push service images
  restart            Restart services
  rm                 Remove stopped containers
  run                Run a one-off command
  scale              Set number of containers for a service
  start              Start services
  stop               Stop services
  top                Display the running processes
  unpause            Unpause services
  up                 Create and start containers
  version            Show the Docker-Compose version information
[root@slaveserver ~]#


Friday, August 4, 2017

How to restore chmod exicutable permission

If a careless sysadmin executes this command  chmod 444 /bin/chmod - what do you do to fix this?

Solution !


This command  will fix it if you are root user, Most unix and linux based OS's have perl installed and available by default.

#perl -e 'chmod 0755, "/bin/chmod";' 
 

Thursday, January 1, 2015

Install Darkstat - a network traffic analyzer

Darkstat is a opensource network monitoring tool, It is a packet sniffer which runs as a background process and serves its statistics to a web browser , Captures network traffic, calculates statistics about usage, and serves reports over HTTP.

Features:
    Traffic graphs, reports per host, shows ports for each host.
    Embedded web-server with deflate compression.
    Asynchronous reverse DNS resolution using a child process.
    Small. Portable. Single-threaded. Efficient.
    Supports IPv6.

Installation :
Rhel/centOs/Fedora
#sudo yum install darkstat

Ubuntu :
#sudo apt-get install darkstat

# darkstat -i eth0

Install From Source :
Download :
Darkstat <

# ./configure
# make

Once built, this is all it takes to get darkstat running:

# darkstat -i eth0

Although it's possible to configure / complicate things further, once out of the box, darkstat will just work without much trouble on your part.

Test :
http://ip-address:667


Screenshots: 




Wednesday, April 9, 2014

How to find files on Linux

It give the full path of file find every where-------



Find at current location
# find    / -name abc.txt   

Find file name case insensitively
# find / -iname abc.txt   

Find the file in / .
# find / -name *.txt       

Find the file where 'pass' in /etc
# find /etc -name *pass*   


Find the file in /data created by macho
# find / -user macho       

Find the file in /data which is not created by macho
# find / -not -user macho   

Find the file with uid of 500
# find / -user macho -uid 500   

Matches if mode is exactly 755
# find / -perm 755       

Matches if anyone can write
# find / -perm +222       

Matches if everyone can write
# find / -perm -222       

Matches if other can write
# find / -perm -002          

Files with a size of exactly 10M
# find / -size 10M       

Files with a size of above 10M
# find / -size +10M       

Files with a size of less than 10M
# find / -size -10M       

When file was last read (min)
# find / -amin 10       

When file data last changed
# find / -mmin -10       

When file data or metadata last changed
# find / -cmin 10       

By this commnad linux find only file with exetantion .txt and
copy again with .doc ( -exec not ask to do )
# find / -name "*.txt" -exec cp {} {}.doc \;
   
Linux find only those file with permisssion 002 and execute
it again 777 ( or full permission )
# find / -perm -002 -exec chmod 777 {} \;
   
    -exec     execute directly
    -ok    asking to do

# find / -name "*.doc" -ok rm {} \;

Thanks,
Vishal Vyas

Monday, January 20, 2014

A free tool to analyze AIX and Linux performance

One of the tools I use to monitor performance on IBM AIX 5.3 and Linux is NMON. Using nmon, you can monitor CPU, memory, network, disk, filesystems, NFS and Top Processes.



Install Nmon

CentOS users need to install nmon from rpmforge/repoforge repository. It is not present in Epel.

CentOs 4 :
i386     rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el4.rf.i386.rpm

x86_64   rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el4.rf.x86_64.rpm

CentOs5 :
i386     rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.i386.rpm

x86_64   rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm

CnetOs6 :
i686     rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm

x86_64   rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm


sudo yum install nmon
sudo apt-get install nmon

Usage :

$ nmon
And then choose what information you want to be displayed: C – for CPU; M – for Memory; T – for Processes





Keyboard shortcuts

The following keyboard shortcuts can be used turn on (and off) statistics about various components:

   c = CPU                 l = CPU Long-term   - = Faster screen updates
   m = Memory          j = Filesystems          + = Slower screen updates
   d = Disks               n = Network               V = Virtual Memory       
   r = Resource         N = NFS                     v = Verbose hints        
   k = kernel               t = Top-processes        .  = only busy disks/procs
   h = more options                                       q = Quit                  

Thursday, January 16, 2014

Audit Your Linux Security With Lynis

Lynis is an auditing tool for Unix/Linux. It performs a security scan and determines the hardening state of the machine. Any detected security issues will be provided in the form of a suggestion or warning. Beside security related information it will also scan for general system information, installed packages and possible configuration errors.

Examples of audit tests:
- Available authentication methods
- Expired SSL certificates
- Outdated software
- User accounts without password
- Incorrect file permissions
- Configuration errors
- Firewall auditing


Installation :

CentOs/Fedora
yum install lynis

Ubuntu :
apt-get install lynis

Install from source :
Create Directory
mkdir /usr/local/lynis

cd /usr/local/lynis
wget http://cisofy.com/files/lynis-1.3.9.tar.gz
tar -xvf lynis-1.3.9.tar.gz

cd lynis-1.3.9.
./lynis

Usage :
lynis -c

This will produce similar to the following output.
Once, you execute above command it will start scanning your system and ask you to Press Enter to continue, or CTRL+C to stop every process it scans and completes.



















































 











































Thanks,
Vishal Vyas

For More : http://www.rootkit.nl/

Thursday, January 9, 2014

GoAccess a Real time Web Server Log Analyzer

GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems. It provides fast and valuable HTTP statistics for system administrators that require a visual server report on the fly.

GoAccess parses the specified web log file and outputs the data to the X terminal.

  •     General Statistics, bandwidth, etc.
  •     Time taken to serve the request (useful to track pages that are slowing down your site.
  •     Top Visitors
  •     Requested files
  •     Requested static files, images, swf, js, etc.
  •     404 or Not Found
  •     Hosts, Reverse DNS, IP Location
  •     Operating Systems
  •     Browsers and Spiders
  •     Referring Sites
  •     Referrers URLs
  •     Keyphrases
  •     Geo Location - Continents/Countries New
  •     HTTP Status Codes
  •     Ability to output JSON and CSV New
  •     Different Color Schemes
  •     Support for IPv6
  •     Unlimited log file size
  •     Output statistics to HTML.

  
Installation :
GoAccess has minimal requirements, it's written in C, ncurses, GLib >= 2.0.0, and GeoIP (optional) for geolocation data

# yum install ncurses-devel glib2-devel GeoIP*
# cd /opt
# wget http://sourceforge.net/projects/goaccess/files/0.5/goaccess-0.5.tar.gz/download
# tar zxvf goaccess-0.5.tar.gz
# cd goaccess-0.5
# ./configure
#  make
# make install

How to use GoAccess :
once it has been installed (no configuration is needed), just run it against your web log file: (-a is optional)



To generate full statistics we can run GoAccess as:
 # goaccess -f /var/log/httpd/access_log -a














Select a log format and press F10















To generate an HTML report:
#goaccess -f  /var/log/httpd/access_log -a > report.html

To generate a CSV file:
# goaccess -f access.log -o csv > report.csv


Thanks,
Vishal Vyas

For more information and usage please visit http://goaccess.prosoftcorp.com/

How to Install docker-compose CentOS7

 Install Docker-compose on CentOs7 Linux. yum install -y epel-release yum install -y python-pip pip install --upgrade pip pip install ...