Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Monday, November 11, 2019

Benchmark Linux Disk Read/Write Speed

hdparm is a command line utility to set and view hardware parameters of hard disk drives. It can also be used as a simple benchmarking tool.

Install hdparm

CentOS

[[email protected] ~]# yum install hdparm

Ubuntu

[email protected]:~# apt-get install hdparm

Friday, November 8, 2019

Basic Linux Commands (Tips and Tricks)

Linux Developing History

This post is to collect some basic linux commands I used while working on some Linux system:
  • Upgrade System
  • Basic Commands
  • Iptable firewalls
  • User and Group
  • Change Interface IP Address 
  • Fold and Disk Commands
  • Cron Job
  • Create SSH Trust Relationship between two Linux Machines
  • Find Big Files in Linux File System 
  • Find Out My Linux Distribution Name and Version
  • Check Your Public IP Address from CLI
  • PS command
  • VI Command
  • Check Hardware Info
  • Install a software on Linux
  • Use ssh key to encrypt / decrypt files
  • AWS Amazon Linux Instance Commands
  • Change Time Zone
  • Add/Remove Route
  • Remove Specific SSH Host Key 

Linux System Performance Analytics

This post is going to use an java code example to show the process how to analysis linux system performance issue using all kinds of Linux internal commands without other third party tools.

System: Top

Here is a java code for an example
public class JavaDemo2 {
    public static void main(String[] args) {
        while (true){
            System.out.println(new java.util.Random().nextInt(77778888));
        }
    }
}
top check system resource usage
[[email protected] ~]# top
top - 11:28:50 up 7 min, 2 users, load average: 0.73, 0.39, 0.18 Tasks: 230 total, 1 running, 229 sleeping, 0 stopped, 0 zombie Cpu(s): 1.0%us, 2.3%sy, 0.0%ni, 96.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 1906280k total, 649948k used, 1256332k free, 21164k buffers Swap: 2097148k total, 0k used, 2097148k free, 203820k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3672 root 20 0 3158m 94m 11m S 15.6 5.1 0:13.67 java 3397 root 20 0 100m 5388 3396 S 9.3 0.3 0:09.00 sshd 39 root 20 0 0 0 0 S 1.7 0.0 0:00.25 events/4 37 root 20 0 0 0 0 S 1.0 0.0 0:00.39 events/2 35 root 20 0 0 0 0 S 0.3 0.0 0:01.27 events/0 36 root 20 0 0 0 0 S 0.3 0.0 0:00.34 events/1 41 root 20 0 0 0 0 S 0.3 0.0 0:00.24 events/6 [[email protected] ~]# uptime 11:29:09 up 7 min, 2 users, load average: 0.52, 0.36, 0.18


Friday, October 18, 2019

Some Popular Linux VPS Bench Scripts



Cloud service providers often define host tiers by the allocated resources, but the differences in the underlying hardware, architecture and performance tuning can result in varying capabilities even between similar configurations. The easiest way to measure the real differences between servers is to run a set of tests, i.e. a benchmark, to create simple to read values for comparisons.

UnixBench

    UnixBench is the original BYTE UNIX benchmark suite, updated and revised by many people over the years.The purpose of UnixBench is to provide a basic indicator of the performance of a Unix-like system. Hence, multiple tests are used to test various aspects of the system’s performance. These test results are then compared to the scores from a baseline system to produce an index value, which is generally easier to handle than the raw scores. The entire set of index values is then combined to make an overall index for the system.
    Some very simple graphics tests are included to measure the 2D and 3D graphics performance of the system.

    UnixBench Benchmark repository is at https://github.com/cloudharmony/unixbench

    Wednesday, September 25, 2019

    Install Portainer to Manage Containers - Nginx, MySQL, WordPress

    Portainer is a lightweight management UI which allows you to easily manage your different Docker
    environments (Docker hosts or Swarm clusters). It is meant to be as simple to deploy as it is to use. It consists of a single container that can run on any Docker engine (can be deployed as Linux container or a Windows native container). Portainer allows you to manage your Docker containers, images, volumes, networks and more !


    1. Installation in CentOS / Ubuntu
    1.1 CentOS 7/Debian 9

    Here is an easiest way to install docker into your CentOS / Debian system. It is just one command:
    
    
    sudo -i
    yum -y update
    curl -sSL https://get.docker.com/ | sh

    Tuesday, September 17, 2019

    Using SSMTP to Send Email From Linux VPS Command Line Through Gmail Account

    Ssmtp (Simple SMTP) is a little nice tool you can use under Linux command line to send out email. SSMTP allows users to transfer emails through an SMTP server from the Linux command line. It provides the means to connect to a mailhub with a proper configuration file. If your config file was set up right, all your worries regarding command line email sending can disappear.

    System Repository Update
    Before we do anything else we should bring the Ubuntu Repository up to date. Type the following command to update Ubuntu System Repository:
    sudo apt-get update


    Install the ssmtp package:
    sudo apt-get install ssmtp

    Thursday, September 5, 2019

    Monit - Linux Open Source System or Process Monitor Program

    1. What is Monit?
    Monit is a utility for managing and monitoring processes, programs, files, directories and file systems on a Unix like system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations. E.g. Monit can start a process if it does not run, restart a process if it does not respond and stop a process if it uses too much resources. You can use Monit to monitor files, directories and file systems for changes, such as timestamps changes, checksum changes or size changes.

    Monit is controlled via an easy to configure control file (/etc/monit/monitrc) based on a free-format, token-oriented syntax. Monit logs  to syslog or to its own log file (/var/log/monit.log) and notifies you about error conditions via customisable alert messages.

    Monday, September 2, 2019

    Linux Virtual Machine PHP Invoked OOM-killer (Out of Memory) Issue

    One of my GCP VM is running at f1-Micro type which only has limited memory, 614MB. From syslog, I found it has a PHP invoked OOM killer messages. This usually means this server essentially ran out of memory and extra memory should add into this system, Based on some posts online, especially this 2010's  post :

    "The Linux kernel likes to always allocate memory if applications asking for it. Per default it doesn’t really check if there is enough memory available. Given that behavior applications can allocate more memory as really is available. At some point it can definitely cause an out of memory situation. As result the OOM killer will be invoked and will kill that process:"

    Friday, August 30, 2019

    Ubuntu Basic System and Service Configuration Commands


    1. Update / Upgrade Commands
    • sudo apt-get update : In a nutshell, apt-get update doesn't actually install new versions of software. Instead, it updates the package lists for upgrades for packages that need upgrading, as well as new packages that have just come to the repositories.
    • sudo apt-get upgrade : will fetch new versions of packages existing on the machine if APT knows about these new versions by way of apt-get update. An update must be performed first so that apt-get knows that new versions of packages are available.
    • sudo apt-get dist-upgrade: will do the same job which is done by apt-get upgrade, plus it will also intelligently handle the dependencies, so it might remove obsolete packages or add new ones. 

    Note: we can combine commands with && signs, such as:
    • sudo apt-get update && sudo apt-get dist-upgrade

    Friday, February 1, 2019

    Kali Usage Tips and Tricks

    Kali Linux is a Debian-based Linux distribution aimed at advanced Penetration Testing and Security Auditing. Kali contains several hundred tools which are geared towards various information security tasks, such as Penetration Testing, Security research, Computer Forensics and Reverse Engineering.

    Download Kali: https://www.kali.org/downloads/

    Basic Configuration Videos:


    Tuesday, January 8, 2019

    CentOS Basic Configuration and Services/Software Installation (Docker, Vsftp, Samba, etc)

    The CentOS (Community Enterprise Operating System) Project is a community-driven free software effort focused on delivering a robust open source ecosystem. For users, CentOS offers a consistent manageable platform that suits a wide variety of deployments. For open source communities, CentOS offers a solid, predictable base to build upon, along with extensive resources to build, test, release, and maintain their code.

    CentOS uses the Red Hat source code base to create a product similar to RHEL. So CentOS is very close to being RHEL without the branding and support. In particular, the library versions are the same, so binaries that work on one will work on the other. The administration tools are the same and configured in similar ways. However, there are a few differences, as the two distributions sometimes apply different minor patches.

    Tuesday, December 18, 2018

    Ubuntu 16.04.5 LTS (Xenial Xerus) Installation Step by Step in VMWare Workstation (Not Easy Installation)


    1. Ubuntu16.04 Installation
    1.1 VMware Workstation Virtual Machine Creation for not easy installation
    If you are using VMware workstation , by default, system will do easy installation for you, which means all settings will be automatically entered by VMware Workstation. You wont need to provide too much or any information during installation process. We are not going to use this method in this post. We just choose  the option "I will install the operating system later" to skip easy installation.

    YouTube Video:
    Easy Install vs Non Easy Install

    Tuesday, April 17, 2018

    Install OpenVAS on Ubuntu


    OpenVAS is a framework of several services and tools offering a comprehensive and powerful vulnerability scanning and vulnerability management solution. The framework is part of Greenbone Networks' commercial vulnerability management solution from which developments are contributed to the Open Source community since 2009.

    1. Install dependencies

    OpenVAS Virtual Appliance / GreenBone Installation

    OpenVAS Framework
    The GSM Community Edition is a derivate of the GSM ONE and allows a quick and easy option on Windows, Linux or Mac to give the solution a trial. No particular know-how is needed.
    In contrast to the commercial solution the Community Feed instead of the Greenbone Security Feed is used. Also some management functions like for TLS certificates are not included. Feed updates happen on a regular basis, but the system itself can not be updated. The commercial version can be updated seamless and also includes access to the Greenbone Support.
    The Community Edition as well as the GSM ONE are designed for use with a laptop. The full feature set for a vulnerability management process (schedules, alarms, sensors) are only available with the bigger GSM models (see here for an overview) and can be obtained from Greenbone as an evaluation unit.

    1. OpenVAS / GreenBone Installation Video