Category: Linux

  • 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

  • Configure OVH Failover IP in Ubuntu 20.04/22.04

    To configure IP in Ubuntu Server 20.04 guest, create a file

    vi /etc/netplan/50-netwrk.yaml

    add the following content

    network:
        version: 2
        ethernets:
            eth0:
                addresses:
                    - YOUR_FO_IP_HERE/32
                nameservers:
                    addresses:
                        - 1.1.1.1
                    search: []
                optional: true
                routes:
                    - to: 0.0.0.0/0
                      via: YOUR_GW_IP_HERE
                      on-link: true

    example

    root@easyengine:~# cat /etc/netplan/50-cloud-init.yaml
    network:
        version: 2
        ethernets:
            eth0:
                addresses:
                    - 164.132.150.95/32
                nameservers:
                    addresses:
                        - 1.1.1.1
                    search: []
                optional: true
                routes:
                    - to: 0.0.0.0/0
                      via: 51.255.79.254
                      on-link: true
    root@easyengine:~# 

    “on-link: true” is what makes it work. The “on-link: true” option is used to specify that a specific route should be considered “on-link.” This means that the route is directly reachable on the local network segment, and packets destined for that route should be sent directly to the network interface associated with that network segment, rather than being routed through a gateway.

    Test network config using

    netplan try

    If everything works fine, you can apply the changes with

    netplan apply

    See OVH, netplan