Category: Linux

  • Install gifsicle from source

    gifsicle is a command line tool for editing, and creating GIF images.

    You can get it from

    https://www.lcdf.org/gifsicle

    To install, run

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

    Install optipng from source
    Install jpegoptim from source

  • Install jpegoptim from source

    jpegoptim is an open source jpeg image optizer. You can download it from

    https://github.com/tjko/jpegoptim

    To instll it, download latest version from

    https://github.com/tjko/jpegoptim/releases

    For version 1.4.6, run

    cd /usr/local/src
    wget https://github.com/tjko/jpegoptim/archive/RELEASE.1.4.6.tar.gz -O jpegoptim.tar.gz
    tar xvf jpegoptim.tar.gz
    cd jpegoptim-RELEASE.1.4.6/
    ./configure
    make
    make install
    
  • gem install error libxslt is missing

    When installing ruby gem, i get following error

    [root@video1 cms]# gem install sanitize -v 1.2.1 --no-ri --no-rdoc
    Building native extensions.  This could take a while...
    ERROR:  Error installing sanitize:
    	ERROR: Failed to build gem native extension.
    
    /usr/local/rvm/rubies/ruby-1.8.7-head/bin/ruby extconf.rb
    checking for libxml/parser.h... yes
    checking for libxslt/xslt.h... no
    -----
    libxslt is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
    -----
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of
    necessary libraries and/or headers.  Check the mkmf.log file for more
    details.  You may need configuration options.
    
    Provided configuration options:
    	--with-opt-dir
    	--without-opt-dir
    	--with-opt-include
    	--without-opt-include=${opt-dir}/include
    	--with-opt-lib
    	--without-opt-lib=${opt-dir}/lib
    	--with-make-prog
    	--without-make-prog
    	--srcdir=.
    	--curdir
    	--ruby=/usr/local/rvm/rubies/ruby-1.8.7-head/bin/ruby
    	--with-zlib-dir
    	--without-zlib-dir
    	--with-zlib-include
    	--without-zlib-include=${zlib-dir}/include
    	--with-zlib-lib
    	--without-zlib-lib=${zlib-dir}/lib
    	--with-iconv-dir
    	--without-iconv-dir
    	--with-iconv-include
    	--without-iconv-include=${iconv-dir}/include
    	--with-iconv-lib
    	--without-iconv-lib=${iconv-dir}/lib
    	--with-xml2-dir
    	--without-xml2-dir
    	--with-xml2-include
    	--without-xml2-include=${xml2-dir}/include
    	--with-xml2-lib
    	--without-xml2-lib=${xml2-dir}/lib
    	--with-xslt-dir
    	--without-xslt-dir
    	--with-xslt-include
    	--without-xslt-include=${xslt-dir}/include
    	--with-xslt-lib
    	--without-xslt-lib=${xslt-dir}/lib
    
    
    Gem files will remain installed in /usr/local/rvm/gems/ruby-1.8.7-head/gems/nokogiri-1.4.7 for inspection.
    Results logged to /usr/local/rvm/gems/ruby-1.8.7-head/gems/nokogiri-1.4.7/ext/nokogiri/gem_make.out
    [root@video1 cms]# 
    

    Soluton

    Install missing libxslt devel package.

    On CentOS installed.

    yum install -y libxslt-devel
    

    For error “libxml2 is missing.”, install

    yum install -y libxml2-devel
    
  • Convert CentOS to CloudLinux

    cloudlinux

    CloudLinux is a popular Linux distribution used by shared hosting providers. Some of the advantages of cloudlinux is users are running inside its own light weight virtual environment (CageFS). This will protect other sites on the server if one of the sites gets hacked. Also, CloudLinux allows you to set resource limits for each site, this way no one site can take down the entire web server.

    You can find more details on cloudlinux at the official website

    https://cloudlinux.com

    If you are using CentOS on your server, you can easily convert it to CloudLInux.

    To convert CentOS to CloudLinux, run

    wget https://repo.cloudlinux.com/cloudlinux/sources/cln/cldeploy
    sh cldeploy -k LICENSE_KEY_HERE

    You can get an activation key by getting 30 day trail or purchasing a CloudLinux license.

    If you have IP based license, run

    wget https://repo.cloudlinux.com/cloudlinux/sources/cln/cldeploy
    sh cldeploy -i

    Once install completed, reboot the server to get the server booted with CloudLinux kernel.

    reboot

    See cloudlinux

  • Reset VestaCP admin password

    To reset VestaCP admin password, loign to SSH, run

    v-change-user-password admin NEW_PASSWOARD
    

    if above method did not work, try

    passwd admin
    

    See VestaCP Free Hosting Control Panel

  • cagefs mount points exists

    On WHM > CloudLinux LVE Manager, i get following warning

    Check cagefs mount points exists

    There are missing mount points: [‘/usr/local/cpanel/whostmgr/docroot/cgi/softaculous’]

    This error is due to softaculous was removed from server, but was not removed from cagefs mount points file.

    To fix this error, edit file

    vi /etc/cafefs/cagefs.mp
    

    Remove the line

    /usr/local/cpanel/whostmgr/docroot/cgi/softaculous
    
  • EasyEngine

    EasyEngine is a command line tool to manage/configure Nginx web server.

    https://easyengine.io/

    To install EasyEngine, run

    wget -qO ee rt.cx/ee4 && sudo bash ee
    

    Create Web Site

    EasyEngine HOWTOs

    EasyEngine Errors

    EasyEngine Folders

    /opt/easyengine/services/docker-compose.yml docker-compose file
    /opt/easyengine/sites/DOMAIN_NAME_HERE/app/htdocs Website document root
    /opt/easyengine/services/mariadb MySQL data dir

    Restart Nginx container for a site

    ee site restart SITE_URL_HERE --nginx
    

    Clear Object cache for a site

    ee site clean SITE_URL_HERE
    
  • Configure Failover IP in Ubuntu 18.04 OVH VPS

    Default /etc/network/interfaces in Ubuntu 18.04 in OVH VPS look like following. Click here for Ubuntu 20.04 instructions.

    root@vps624512:~# cat /etc/network/interfaces 
    # ifupdown has been replaced by netplan(5) on this system.  See
    # /etc/netplan for current configuration.
    # To re-enable ifupdown on this system, you can run:
    #    sudo apt install ifupdown
    root@vps624512:~# 
    

    First install

    sudo apt install ifupdown -y
    

    Configure Main IP

    use “ip a” command to find out interface name and IP of the VPS

    root@vps624512:~# ip a
    1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: ens3:  mtu 1500 qdisc fq_codel state UP group default qlen 1000
        link/ether fa:16:3e:f4:1e:fd brd ff:ff:ff:ff:ff:ff
        inet 51.77.149.182/32 scope global dynamic ens3
           valid_lft 49349sec preferred_lft 49349sec
        inet6 fe80::f816:3eff:fef4:1efd/64 scope link 
           valid_lft forever preferred_lft forever
    root@vps624512:~#
    

    In this case,

    IP = 51.77.149.182
    Interface Name = ens3

    Use “route -n” command to find out gateway.

    root@vps624512:~# route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         51.77.148.1     0.0.0.0         UG    100    0        0 ens3
    51.77.148.1     0.0.0.0         255.255.255.255 UH    100    0        0 ens3
    root@vps624512:~# 
    

    GATEWAY = 51.77.148.1

    Edit /etc/network/interfaces

    vi /etc/network/interfaces
    

    Add following

    auto INTERFACE_NAME
    iface INTERFACE_NAME inet static
        address SEVER_MAIN_IP
        netmask 255.255.255.255
        broadcast SEVER_MAIN_IP
        dns-nameservers 8.8.8.8 1.1.1.1
        post-up route add GATEWAY_IP dev INTERFACE_NAME
        post-up route add default gw GATEWAY_IP
        post-down route del default gw GATEWAY_IP
        post-down route del GATEWAY_IP dev INTERFACE_NAME
    

    In the above, replace INTERFACE_NAME, SEVER_MAIN_IP and GATEWAY_IP.

    For this server, i added.

    auto ens3
    iface ens3 inet static
        address 51.77.149.182
        netmask 255.255.255.255
        broadcast 51.77.149.182
        post-up route add 51.77.148.1 dev ens3
        post-up route add default gw 51.77.148.1
        post-down route del default gw 51.77.148.1
        post-down route del 51.77.148.1 dev ens3
    

    Now reboot the server.

    Once server is back online, you can configure failover IPS.

    Configure Failover IP

    Use following script to generate your config, add in end of /etc/network/inferfaces file

    php script to generate ip config

    Once configured, you need to reboot the servr.

    Verify IP is up with fping command.

    fping
    /etc/inetnet/interfaces

  • Install ffmpeg on Ubuntu

    To install ffmpeg 4 on Ubuntu, you can use PPA

    https://launchpad.net/~jonathonf/+archive/ubuntu/ffmpeg-4

    apt install software-properties-common -y
    add-apt-repository ppa:jonathonf/ffmpeg-4 -y
    

    Now install ffmpeg with

    apt update && apt install ffmpeg -y
    

    See ffmpeg

  • Sending Email with telnet

    To send an email with telent, run

    telnet MAIL_SERVER_IP 25
    

    On the prompt, type the following

    ehlo localhost
    mail from: 
    rcpt to: 
    data
    Subject: Testing
    
    This is text email.
    .
    quit
    

    Email need to be specified within < and > symbols.

    See Telnet

  • Install Squid Proxy Server

    Proxy server allows hiding your IP address. You can find the Squid Proxy Installer script at

    https://github.com/serverok/squid-proxy-installer

    The script supports the following Operating systems

    • Ubuntu 18.04, 20.04, 22.04, 24.04
    • Debian 8, 9, 10, 11
    • CentOS 8, 9
    • AlmaLinux 8, 9

    Video Tutorial

    How to install Squid Proxy Server in DigitalOcean Droplet (VPS).

    https://rumble.com/vdswgv-install-squid-proxy-server-in-digitalocean-vps.html
    https://odysee.com/squid-proxy-install:1

    Become user root

    If you are not logged in as user root, you need to become user root. This can be done with the command

    sudo su

    If sudo su did not work for you, try

    su -

    Install wget

    On CentOS/AlmaLinix

    yum install -y wget

    On Ubuntu/Debian

    apt install -y wget

    install squid proxy server

    To install squid proxy server, run

    wget https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid3-install.sh -O squid3-install.sh
    bash squid3-install.sh

    After installing Squid Proxy Server, you may need to change the port. For instructions, see How to change Port of Squid Proxy Server

    Create a Proxy User

    To create a user in squid proxy, run

    sudo squid-add-user

    To change the password for an existing user, just create the user again with a different password. This will update the existing user password.

    Configure Multiple IPs

    If you have multiple IP addresses on the server, first make sure IPs are properly configured on your web server. If your secondary IPs are configured, you should be able to ping to these IPs and connect to the server using the IP address.

    Once IPs are configured in the server and able to ping, you can run following commands

    wget https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid-conf-ip.sh
    sudo bash squid-conf-ip.sh

    Now you will be able to use all IP available in the server as a proxy server.

    This won’t work if your IPs are behind NAT. You can verify this by running the command “ip a”, it should list all IP addresses.

    Test Proxy Server with curl

    curl -U PROXY_USER:PROXY_PW -x MY_PROXY_SERVER:PROXY_PORT https://checkip.amazonaws.com

    Related Posts