Category: Linux

  • Asterisk

    Asterisk is open source framework to build communication applications (PBX).

    https://www.asterisk.org

    Access Asterisk console

    asterisk -vvvvvvvvvvvvvvvr
    asterisk -x 'sip show peers'
    asterisk -r -x 'core show channels' | grep 'active calls' | awk {'print $1'}
    asterisk -rx "manager show connected" | grep 'users connected'|awk {'print $1'}
    

    Here is list of asterisk console commands

    https://gist.github.com/serverok/6741ab13c2c8a647cf43f6e1d645cf6b

    Stop/Start Asterisk

    service asterisk stop
    service asterisk start
    service asterisk status
    

    Asterisk Config files

    /etc/asterisk/sip_additional.conf
    /etc/asterisk/pjsip.registration.conf
    /etc/asterisk/pjsip.auth.conf
    

    Asterisk install folder

    /var/www/html/
    

    voip

  • Sentora Free Hosting Control Panel

    Sentora is a free hosting control panel.

    http://www.sentora.org

    Apache config is stored in folder

    /etc/sentora/configs/apache/httpd.conf
    /etc/sentora/configs/apache/httpd-vhosts.conf
    

    Web site files are stored in

    cd /var/sentora/hostdata/
    

    After instal, you find login credentials in file

    /root/passwords.txt
    

    Login to Panel at

    http://panel.yourdomain.com
    default user = zadmin
    

    See Hosting Control Panel

  • history

    To get history show time

    echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bashrc
    source  ~/.bashrc

    history -a will append your current session history to the content of the history file.

    history -w will replace the content of the history file with your current session history.

    To remove the line number from history, run

    history | sed 's|[0-9]\+\s\+||'

    Or

    history | cut -d' ' -f5-40

    Log everything

    To log everything, edit

    vi /etc/bash.bashrc

    Add

    test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'script' || (script -f $HOME/$(date +"%d-%b-%y_%H-%M-%S")_shell.log)

    Or manually start logging in with

    script -f $HOME/session.log

    Linux Server show IP address in history

    Method 2: Log Commands

    edit /etc/profile

    vi /etc/profile

    At end of the file, add

    export HISTTIMEFORMAT="%F %T "
    PROMPT_COMMAND='echo "$(date +"%F %T") `whoami` from `who -u am i 2>/dev/null | awk "{print \$NF}" | tr -d "()"` ran `history 1 | sed "s/^[ ]*[0-9]\+[ ]*//"`" >> /var/log/commands.log'
  • r1soft public key is not available

    When updating a server with r1soft backup manager installed, i get following error

    root@localhost:~# apt update
    Hit:1 http://mirrors.linode.com/ubuntu xenial InRelease
    Hit:2 http://mirrors.linode.com/ubuntu xenial-updates InRelease
    Hit:3 http://mirrors.linode.com/ubuntu xenial-backports InRelease
    Ign:4 http://repo.r1soft.com/apt stable InRelease
    Hit:6 http://security.ubuntu.com/ubuntu xenial-security InRelease
    Get:5 http://repo.r1soft.com/apt stable Release [3,255 B]
    Get:7 http://repo.r1soft.com/apt stable Release.gpg [230 B]
    Err:7 http://repo.r1soft.com/apt stable Release.gpg
    The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 39A4965166BD1D82
    Fetched 3,485 B in 0s (11.0 kB/s)
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    All packages are up to date.
    W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repo.r1soft.com/apt stable Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 39A4965166BD1D82
    W: Failed to fetch http://repo.r1soft.com/apt/dists/stable/Release.gpg The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 39A4965166BD1D82
    W: Some index files failed to download. They have been ignored, or old ones used instead.
    root@localhost:~#

    This is because r1soft changed the key they used before. To fix, run

    rm -f r1soft.asc
    wget http://repo.r1soft.com/r1soft.asc
    apt-key add r1soft.asc
    

    Now apt update will work properly.

    r1soft

  • vsftpd

    Install vsftpd on CentOS

    To install vsftpd in Debian/Ubuntu, run

    apt install vsftpd -y

    To enable vsftpd start on boot, run

    systemctl enable vsftpd

    Configure vsftpd, edit

    vi /etc/vsftpd.conf

    Add

    write_enable=YES
    chroot_local_user=YES
    allow_writeable_chroot=YES
    local_umask=002
    file_open_mode=0755
    force_dot_files=YES
    utf8_filesystem=YES

    Restart vsftpd with

    systemctl restart vsftpd

    Create FTP User

    useradd -m -s /bin/bash FTP_USERNAME
    passwd FTP_USERNAME

    ftp

  • new pc

    Branded Vs Assembed

    If you build a similar config as branded PC, it usually costs more than a randed PC. With branded PC, you get professional support and 3 year warranty.

    DELL Inspiron 15 5570 Laptop

    8th Generation Intel® Core™ i5-8250U Processor, 8GB RAM, 1TB HDD, AMD Radeon® 530 Graphics with 2G GDDR5, 1Yr Ltd Hardware Warranty. CPU Score 7653

    Branded Desktop

    HP Pavilion 590-p0207il
    4LZ72AA#ACJ 
    AMD Ryzen 3 2200G 
    Free Dos 
    4 GB DDR4
    1 TB HDD 
    VEGA 8 GFX 
    Wired KBM
    3 Year Onsite Warranty
    Rs. 26,900.00
    

    HP Pavilion 590-p0207il on Amazon

    Useful sites

  • Installing doctl on Ubuntu

    Go to

    https://github.com/digitalocean/doctl/releases

    Download latest version for linux 64 bit.

    cd /usr/local/src
    wget https://github.com/digitalocean/doctl/releases/download/v1.7.2/doctl-1.7.2-linux-amd64.tar.gz
    tar xvf doctl-1.7.2-linux-amd64.tar.gz
    rm -f doctl-1.7.2-linux-amd64.tar.gz
    mv doctl /usr/local/bin
    

    digitalocean

  • Install PHP 7 on CentOS 6

    Install EPEP repo with command

    yum install -y epel-release
    

    Next you need REMI repo, you can get it form

    https://rpms.remirepo.net/

    Install it with

    rpm -ivh https://rpms.remirepo.net/enterprise/remi-release-6.rpm
    

    You can search for PHP versions with command

    yum search php
    

    Select PHP version

    First install yum-utils

    yum install yum-utils
    

    Now you can select required PHP version with command

    yum-config-manager --enable remi-php72
    

    Use remi-php70 for PHP 7.0, remi-php71 for PHP 7.1

    Install PHP

    To install PHP 7.2, run

    yum install php72 -y
    

    PHP binary will be installed as php72, you can create a synlink if you need.

    ln -s /usr/bin/php72 /usr/bin/php
    

    Enable PHP in Apache

    yum install php72-php
    

    Now restart apache

    service httpd restart
    

    php
    CentOS 6