Category: Linux

  • interworx

    To update interwrox license, run

    /usr/local/interworx/cron/license.pex --sync
    

    Configuration file for interwrox at

    /usr/local/interworx/iworx.ini
    

    Interworx login url

    https://SERVER-HOSTNAME:2443/nodeworx/index
    

    Webmail

    https://SERVER-HOSTNAME:2443/webmail/
    

    Create an interworx user from command line

  • openSUSE

    To find version of OpenSuse, run

    server3:~ # cat /etc/*release
    NAME="openSUSE Leap"
    VERSION="15.1"
    ID="opensuse-leap"
    ID_LIKE="suse opensuse"
    VERSION_ID="15.1"
    PRETTY_NAME="openSUSE Leap 15.1"
    ANSI_COLOR="0;32"
    CPE_NAME="cpe:/o:opensuse:leap:15.1"
    BUG_REPORT_URL="https://bugs.opensuse.org"
    HOME_URL="https://www.opensuse.org/"
    server3:~ # 
    

    To install a program, run

    zypper insall PROGRAM_NAME
    

    Example

    zypper install nginx
    
  • lvs

    lvs command is used to display logical volumes. You can also use command lvdisplay

    root@server70:~# lvs
      LV            VG  Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      data          pve -wi-ao----  93.65g                                                    
      vm-100-disk-1 pve -wi-ao---- 500.00g                                                    
      vm-101-disk-1 pve -wi-ao----  50.00g                                                    
      vm-102-disk-1 pve -wi-ao---- 100.00g                                                    
      vm-104-disk-1 pve -wi-ao---- 800.00g                                                    
      vm-105-disk-1 pve -wi-ao----  32.00g                                                    
      vm-105-disk-2 pve -wi-ao----   6.00g                                                    
      vm-106-disk-1 pve -wi-ao----  50.00g                                                    
      vm-108-disk-1 pve -wi-ao----  32.00g                                                    
    root@server70:~# 
    

    To get detailed list, use lvdisplay command

    root@server70:~# lvdisplay
      --- Logical volume ---
      LV Path                /dev/pve/data
      LV Name                data
      VG Name                pve
      LV UUID                l7KQll-xHh4-NeJZ-A0q2-H30v-tj3U-DoOM8s
      LV Write Access        read/write
      LV Creation host, time rescue.ovh.net, 2015-12-17 19:45:51 +0000
      LV Status              available
      # open                 1
      LV Size                93.65 GiB
      Current LE             23975
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:0
       
      --- Logical volume ---
      LV Path                /dev/pve/vm-100-disk-1
      LV Name                vm-100-disk-1
      VG Name                pve
      LV UUID                DyrKed-bfZT-pyjO-DU6C-h7Nc-Qfy5-SYbbJe
      LV Write Access        read/write
      LV Creation host, time server70, 2015-12-21 05:57:53 +0000
      LV Status              available
      # open                 1
      LV Size                500.00 GiB
      Current LE             128000
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:1
       
      --- Logical volume ---
      LV Path                /dev/pve/vm-105-disk-1
      LV Name                vm-105-disk-1
      VG Name                pve
      LV UUID                bBHa7g-VBvY-nZfB-lAcw-0eL7-MBOz-QTGKKV
      LV Write Access        read/write
      LV Creation host, time server70, 2016-01-11 06:15:37 +0000
      LV Status              available
      # open                 1
      LV Size                32.00 GiB
      Current LE             8192
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:2
       
      --- Logical volume ---
      LV Path                /dev/pve/vm-105-disk-2
      LV Name                vm-105-disk-2
      VG Name                pve
      LV UUID                zHJvYJ-UjWi-u6dK-ez0u-5kcA-6pJH-PIqmgg
      LV Write Access        read/write
      LV Creation host, time server70, 2016-02-26 08:09:56 +0000
      LV Status              available
      # open                 1
      LV Size                6.00 GiB
      Current LE             1536
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:3
       
      --- Logical volume ---
      LV Path                /dev/pve/vm-106-disk-1
      LV Name                vm-106-disk-1
      VG Name                pve
      LV UUID                p7CBJM-tI3v-zH3G-BhhD-Xabx-UY0R-wOpm6n
      LV Write Access        read/write
      LV Creation host, time server70, 2016-03-27 17:10:46 +0000
      LV Status              available
      # open                 1
      LV Size                50.00 GiB
      Current LE             12800
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:4
       
      --- Logical volume ---
      LV Path                /dev/pve/vm-101-disk-1
      LV Name                vm-101-disk-1
      VG Name                pve
      LV UUID                2aUOze-mNh0-rXnn-qc1J-xpvy-ubhO-SgvEi8
      LV Write Access        read/write
      LV Creation host, time server70, 2016-04-15 04:08:34 +0000
      LV Status              available
      # open                 1
      LV Size                50.00 GiB
      Current LE             12800
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:5
       
      --- Logical volume ---
      LV Path                /dev/pve/vm-108-disk-1
      LV Name                vm-108-disk-1
      VG Name                pve
      LV UUID                RqTmNC-0IL6-N67Q-nh0a-MmS7-9G00-S3KqZy
      LV Write Access        read/write
      LV Creation host, time server70, 2016-12-09 20:46:32 +0000
      LV Status              available
      # open                 1
      LV Size                32.00 GiB
      Current LE             8192
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:6
       
      --- Logical volume ---
      LV Path                /dev/pve/vm-102-disk-1
      LV Name                vm-102-disk-1
      VG Name                pve
      LV UUID                11FKBs-gSYi-owds-4wLU-kT7z-xwcm-lZnamc
      LV Write Access        read/write
      LV Creation host, time server70, 2018-04-28 09:11:33 +0000
      LV Status              available
      # open                 1
      LV Size                100.00 GiB
      Current LE             25600
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:7
       
      --- Logical volume ---
      LV Path                /dev/pve/vm-104-disk-1
      LV Name                vm-104-disk-1
      VG Name                pve
      LV UUID                WrdrmV-jj6z-Nb23-Pdlz-lLYn-wUVZ-hlF5XU
      LV Write Access        read/write
      LV Creation host, time server70, 2018-04-29 16:31:28 +0000
      LV Status              available
      # open                 1
      LV Size                800.00 GiB
      Current LE             204800
      Segments               2
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:8
       
    root@server70:~# 
    

    See lvm

  • lscpu

    lscpu command shows CPU on your server.

    lscpu linux command

  • dmesg

    dmesg command on linux shows boot message.

    dmesg
    

    To see with human readable time, use

    dmesg -T
    
  • Install bitninja firewall

    To install bitninja on Debian/Ubuntu, run

    sudo su -c "echo deb http://apt.bitninja.io/debian/ bitninja non-free >> /etc/apt/sources.list.d/bitninja.list"
    sudo su -c "wget -O- http://apt.bitninja.io/7F8B47DC.gpg | apt-key add -"
    sudo apt-get update
    sudo apt-get install bitninja
    sudo bitninja-config --set license_key=YOUR_LICENSE_KEY_HERE
    sudo /etc/init.d/bitninja start
    

    To scan malware, run

    bitninjacli --module=MalwareScanner --scan=/var/www
    
  • Prevent Notification steal focus on Ubuntu 18.04

    On Ubuntu, some times notifications steal focus from current application. This annoying when you are working on terminal. This is due to start focus feature of gnome when your mouse is over the notification area.

    boby@sok-01:~$ gsettings get org.gnome.desktop.wm.preferences focus-new-windows 
    'smart'
    boby@sok-01:~$ 
    

    We need to change the value of focus-new-windows from smart to strict. This can be done with command

    gsettings set org.gnome.desktop.wm.preferences focus-new-windows 'strict'
    
  • yum commands

    Install a software with yum

    yum install PKG_NAME
    

    Uninstall a software

    yum remove 
    

    Example for installing php and GD

    yum install php php-gd
    

    When you need to update all install software, run

    yum update
    

    List all available software

    yum list available
    yum list available "software-name"
    

    List all installed software

    yum list installed
    

    See yum

  • Download a package using apt on Debian/Ubuntu

    Download a package using apt on Debian/Ubuntu

    On Debian and Ubuntu servers, you can download a package using apt download command.

    apt download PKG_NAME
    

    download package using apt

    Package will get downloaded to current working directory. Better do this to /tmp to avoid permission errors.

    Method 2

    If you want to download package and dependencies, then use

    apt-get install --download-only PKG_NAME
    

    This will download the package and all dependency, store it in folder /var/cache/apt/archives.

    If you need to remove downloaded packages, run

    apt clean
    

    Seeapt-get

  • Blocking Package Upgrade on Debian/Ubuntu

    To block packages from upgrading, you can use command apt-mark hold.

    apt-mark hold PKG_NAME
    

    Example

    apt-mark hold libtomcat8-java tomcat8 tomcat8-admin tomcat8-common
    

    To list packages that are on hold, run

    root@ip-172-26-8-193:~# apt-mark showhold
    libtomcat8-java
    tomcat8
    tomcat8-admin
    tomcat8-common
    root@ip-172-26-8-193:~# 
    

    If you want to remove block, you can use apt-mark unhold command.

    apt-mark unhold libtomcat8-java tomcat8 tomcat8-admin tomcat8-common
    

    See apt

  • Find limit search depth

    I wanted to find some files inside the subdirectory of the current folder. To do this, find have maxdepth option.

    find ./ -maxdepth 2 -name '*.gz'

    This command will limit search depth to the current directory and all first-level sub folders.

    See find

  • EPEL – Extra Packages for Enterprise Linux

    EPEL (Extra Packages for Enterprise Linux) provide additional software for CentOS and RHEL.

    You can find more information about EPEL at

    http://fedoraproject.org/wiki/EPEL

    On CentOS 7/8, you can enable EPEP repo with command

    yum instal epel-release
    

    Or just download rpm package from the site and install.

    RHEL/CentOS 6:

    yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
    

    RHEL/CentOS 7:

    yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    

    RHEL/CentOS 8:

    yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
    

    See CentOS, yum