Category: Linux

  • Ant Media Server Ubuntu firewall configuration

    Ant Media Server Ubuntu firewall configuration

    To enable firewal for Ant Media Server on Ubnuntu server, use following rules

    ufw allow ssh
    ufw allow http
    ufw allow https
    ufw allow 1935/tcp
    ufw allow 5080/tcp
    ufw allow 5443/tcp
    ufw allow 5000:65000/udp
    enable ufw
    

    After enabling, you will have following status

    root@server:~# ufw status
    Status: active
    
    To                         Action      From
    --                         ------      ----
    22/tcp                     ALLOW       Anywhere                  
    80/tcp                     ALLOW       Anywhere                  
    443/tcp                    ALLOW       Anywhere                  
    1935/tcp                   ALLOW       Anywhere                  
    5080/tcp                   ALLOW       Anywhere                  
    5443/tcp                   ALLOW       Anywhere                  
    5000:65000/udp             ALLOW       Anywhere                  
    22/tcp (v6)                ALLOW       Anywhere (v6)             
    80/tcp (v6)                ALLOW       Anywhere (v6)             
    443/tcp (v6)               ALLOW       Anywhere (v6)             
    1935/tcp (v6)              ALLOW       Anywhere (v6)             
    5080/tcp (v6)              ALLOW       Anywhere (v6)             
    5443/tcp (v6)              ALLOW       Anywhere (v6)             
    5000:65000/udp (v6)        ALLOW       Anywhere (v6)             
    
    root@server:~# 
    

    Port forwarding

    You can forward port 80 and 443 to Ant Media Server, so you don’t have to use ports.

    You can use following iptables commands

    sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5080
    sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 5443
    

    To make it permanent, edit

    vi /etc/ufw/before.rules
    

    In the beginning of the file, find

    *filter
    

    Add above

    *nat
    :PREROUTING ACCEPT [0:0]
    -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 5080
    -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 5443
    COMMIT
    

    Restart ufw firewall

    ufw disable
    ufw enable
    

    See Ant Media Server

  • bash: warning: setlocale: LC_ALL: cannot change locale

    On an Ubuntu server, when i login, i get following error

    -bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
    

    To fix this, run

    echo "LC_ALL=en_US.UTF-8" >> /etc/environment
    echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
    echo "LANG=en_US.UTF-8" > /etc/locale.conf
    locale-gen en_US.UTF-8
    

    See Errors

  • Install libwebp

    You can download webp from

    https://developers.google.com/speed/webp/community

    To install webp, run

    cd /usr/local/src
    git clone https://chromium.googlesource.com/webm/libwebp
    cd libwebp
    ./autogen.sh
    ./configure
    make
    make install
    

    webp install following executable files

    /usr/local/bin/cwebp
    /usr/local/bin/dwebp
    
  • Install gifsicle

    You can download gifsicle from

    https://www.lcdf.org/gifsicle/

    To install gifsicle, run

    cd /usr/local/src
    wget https://www.lcdf.org/gifsicle/gifsicle-1.92.tar.gz
    tar xvf gifsicle-1.92.tar.gz
    cd gifsicle-1.92
    ./configure
    make
    make install
    

    Gifsicle binary file will be installed at

    /usr/local/bin/gifsicle
    
  • Install optipng

    You can download optipng from

    http://optipng.sourceforge.net

    To install optipng, run

    cd /usr/local/src
    wget -O optipng-0.7.7.tar.gz http://prdownloads.sourceforge.net/optipng/optipng-0.7.7.tar.gz?download
    tar xvf optipng-0.7.7.tar.gz
    cd optipng-0.7.7/
    ./configure
    make
    make install
    

    Binary will be installed at

    /usr/local/bin/optipng
    
  • Install jpegoptim

    jpegoptim is an open source image optimizer for JPEG image format.

    https://github.com/tjko/jpegoptim

    You can download latest version of from

    https://www.kokkonen.net/tjko/projects.html

    To install jpegoptim, run

    cd /usr/local/src/
    wget https://www.kokkonen.net/tjko/src/jpegoptim-1.4.6.tar.gz
    tar xvf jpegoptim-1.4.6.tar.gz
    jpegoptim-1.4.6/
    ./configure
    make
    make install
    
  • Enable Logging on SFTP

    To enable logging in SFTP, edit file

    vi /etc/ssh/sshd_config
    

    Find

    Subsystem sftp /usr/libexec/openssh/sft
    

    Replace wih

    Subsystem sftp /usr/libexec/openssh/sftp-server -l INFO
    

    Restart sshd

    systemctl restart sshd
    

    See sftp

  • Yum Error Operation too slow

    When i did yum update on a CloudLinux server, i get following error

    error was [Errno 12] Timeout on https://cl-mirror.dewabiz.com/XMLRPC/GET-REQ/cloudlinux-x86_64-server-7/repodata/filelists.xml.gz: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 120 seconds')
    

    This is because server is unable to connect to one of the yum mirrors.

    To fix this, we need to disable the mirror that cause this timeout.

    Edit file

    vi /etc/yum/pluginconf.d/fastestmirror.conf
    

    Find

    enabled=0
    

    Replace with

    enabled=1
    

    Find

    exclude=
    

    Add below

    exclude=cl-mirror.dewabiz.com
    

    run

    yum clean all
    yum makecache
    

    Now yum will work.

    See yum

  • Reinstall Kernel in Ubuntu/Debian

    Reinstall Kernel in Ubuntu/Debian

    To reinstall Kernel in Ubunru, you need to find the version of kernal installed, for this run

    dpkg -l | grep linux-image
    

    Or you can use command, find the kernel version you need to install

    apt-cache search linux-image
    

    Once you have the name of linux-image package you need to install, you can run

    apt-get install --reinstall PKG_NAME_HERE
    

    Example

    reinstall ubuntu kernel

    See apt, Ubuntu, Debian

  • yum fix duplicate package error

    When installing a package, i get following error

    Protected multilib versions: 1:systemd-libs-219-78.el7.cloudlinux.i686 != 1:systemd-libs-219-78.el7_9.2.cloudlinux.x86_64
    

    To fix, remove the conflicting package with

    rpm -e --nodeps --justdb systemd-libs
    

    See yum, Fix yum duplicate packages

  • install Shotcut Video Editor in ubuntu

    Shotcut is an free open source video editor for Ubuntu. You can find more info at

    https://shotcut.org

    Latest version of Shotcut video editor can be installed on Ubuntu using command

    sudo snap install shotcut --classic
    

    shotcut is also available to be installed from apt, but this is slightly older version than snap. To install from apt, use command

    sudo apt install shotcut
    

    See Ubuntu