Category: Linux

  • Install KernelCare

    KernelCare allow you to update Linux Kernel with out rebooting your server. You can find more info at

    https://www.kernelcare.com

    To install KernelCare, run

    curl -s -L https://kernelcare.com/installer | bash
    

    To activate the KernelCare license, run

    kcarectl --register LICENSE_KEY_HERE
    

    To update the kernel manually

    kcarectl --update
    

    Check if new update available

    kcarectl --check
    

    Check license details

    kcarectl --license-info
    

    Related Posts

    cloudlinux

    KernelCare Unknown Kernel

  • Restore MongoDB collection

    mongoimport allow you to restore mongodb backups.

    mongoimport --db DB_NAME --collection COLLECTION_NAME --file COLLECTION_BACKUP.json
    

    Example

    mongoimport --db direct_db --collection image_settings --file image_settings.json
    

    See MongoDB

  • Creating CentOS 8 Virtual Machine with Vagrant

    Creating CentOS 8 Virtual Machine with Vagrant

    Create a directory for Vagrant project

    mkdir -p ~/vagrant/centos8
    cd ~/vagrant/centos8
    vagrant init generic/centos8
    

    This will create a file with name “Vagrantfile” on current folder. To start the CentOS 8 VM, run

    vagrant up
    

    CentOS 8  vagrant

    To SSH into CentOS 8 virtual machine

    vagrant ssh
    

    To stop a VM, run

    vagrant halt
    

    See Vagrant

  • CentOS 8 disable Activate the web console message

    When login to CentOS 8 using SSH, you get a message asking you to enable web console.

    Activate the web console with: systemctl enable --now cockpit.socket
    

    centos 8 cockpit

    You can uninstall cockpit with command

    yum remove cockpit*
    

    If you just need to disable the message, delete the file

    rm -f /etc/motd.d/cockpit
    

    This is actually a symlink to file /run/cockpit/motd

    See CentOS 8

  • Install NextCloud Desktop client on Ubuntu

    Install NextCloud Desktop client on Ubuntu

    To install NextCloud desktop client on Ubuntu, add PPA

    sudo add-apt-repository ppa:nextcloud-devs/client
    sudo apt-get update
    

    Now run

    sudo apt install nextcloud-client
    

    After install, start nextcloud client, you will be able to login with nextcloud server URL, user and password.

    NextCloud ubuntu client

  • dnf – Package manager for CentOS/RHEL 8

    dnf is package manager for RHEL/CentOS 8. This is improved version of yum.

    To search for a package, use

    dnf search PACKAGE_NAME
    

    To install a package, use

    dnf install PACKAGE_NAME
    
  • Install CentOS 8 from Net boot ISO

    Install CentOS 8 from Net boot ISO

    CentOS 8 provide 2 type of ISO. One that ends with boot.iso, this is 534 MB. This only include essential files to get you started with installation. This installation method require internet connection as files needed to be downloaded from internet. Other ISO file is full install media, that is 6.6 GB in size. To install from boot.iso, download it from

    http://isoredirect.centos.org/centos/8/isos/x86_64/

    This page will list morrors near to you.

    CentOS download mirror

    Click on any of the morror from link, on next page, you will see ISO files. Download CentOS-8-x86_64-xxxx-boot.iso

    CentOS 8 download ISO

    Write this ISO file into a USB drive or DVD, then boot your computer with it. You will see following screen.

    CentOS 8 install

    Select first or second option. 2nd option test install media for any errors. If you use USB drive, you can just select option 1 as there is less chance of media corruption compared to DVD drives.

    centos 8 language

    Select language, click continue.

    CentOS 8 installation

    On this screen, you need to make several choices.

    Installation Destination

    Select the hard disk where you need CentOS 8 installed.

    CentOS 8 disk

    If you have an empty disk, all you need to do is click “Done”.

    If your disk have existing partitions, you may need to delete it before insalling CentOS 8. If you have any data on this hard disk, always take a backup before you installing new OS.

    Network & Host Name

    You need to configure your network. Most of the time all you need to do is click on ON/OFF toggle on right side of the network interface.

    CentOS 8 Network

    If you have DHCP on your network, you will see IP address assigned to your computer. If not, you need to manually configure networking. It is important as you will need internet to do CentOS 8 install using boot ISO file. Click Done to go back to previous screen.

    Installation Source

    On this page, you need to enter a CentOS mirror. You can use following URL

    http://mirror.centos.org/centos/8/BaseOS/x86_64/os/
    

    CentOS 8 installation source

    It is better to use a CentOS mirror near to you. This will make file downloads faster. In my case, i used

    http://centos.mirrors.estointernet.in/8.0.1905/BaseOS/x86_64/os/
    

    There is option to select mirror near you on this screen. But for some reason, this option did not work for me.

    Software Slection

    On this screen, you need to select software to install.

    CentOS 8 software selection

    You can select if you need to install GUI or just minimal CentOS install. I selected minimal install as everything else can be installed later as needed.

    Click “Done”, will take you to previous screen. Now you will see “Begin Installation” button enabled. Click on it to continue installation.

    On next screen, you get option to set password. Set password for user root. You can also create a new user if required.

    Installation take 15 to 30 minutes depending on your download speed. Once installation completed, you will be asked to reboot.

    CentOS 8 use Kernel 4.18

    [root@192 ~]# hostnamectl 
       Static hostname: localhost.localdomain
    Transient hostname: 192.168.1.5
             Icon name: computer-vm
               Chassis: vm
            Machine ID: 7ad955dffb89464a96918974be28795b
               Boot ID: 77cd4c012cbe4b6f9c33ab7dae5ecc33
        Virtualization: oracle
      Operating System: CentOS Linux 8 (Core)
           CPE OS Name: cpe:/o:centos:centos:8
                Kernel: Linux 4.18.0-80.7.1.el8_0.x86_64
          Architecture: x86-64
    [root@192 ~]# 
    

    You can use both yum and dnf for installing software.

  • CentOS 8

    CentOS 8 is a short-lived Linux distribution based on Red Hat Enterprise Linux (RHEL). Due to a change in policy, CentOS 8 had an early end of life on December 31, 2021.

    If you are using CentOS 8, you can easily migrate to other RHEL based distributions like Alma Linux, RockyLinux or Oracle Linux.

    CentOS will now provide CentOS 8 Stream, which is a rolling release Linux distribution. CentOS 8 Stream will position itself in the middle of Fedora and RHEL. It won’t be a copy of RHEL, instead, it will be used as a testing ground for RHEL. Newer versions of the software get released on CentOS 8 Stream, once it becomes stable, it will be included in RHEL.

  • Run Apache from command line

    To start Apache from command line with out using a systemd service file or init script, run

    /usr/sbin/httpd -DFOREGROUND
    

    To stop Apache, press CTRL+C.

    You can keep it running by running it inside screen or tmux.

    See Apache

  • ulimit

    ulimit command allow you to view or set user limits.

    boby@sok-01:~$ ulimit -a
    core file size          (blocks, -c) 0
    data seg size           (kbytes, -d) unlimited
    scheduling priority             (-e) 0
    file size               (blocks, -f) unlimited
    pending signals                 (-i) 31482
    max locked memory       (kbytes, -l) 16384
    max memory size         (kbytes, -m) unlimited
    open files                      (-n) 1024
    pipe size            (512 bytes, -p) 8
    POSIX message queues     (bytes, -q) 819200
    real-time priority              (-r) 0
    stack size              (kbytes, -s) 8192
    cpu time               (seconds, -t) unlimited
    max user processes              (-u) 31482
    virtual memory          (kbytes, -v) unlimited
    file locks                      (-x) unlimited
    boby@sok-01:~$ 
    

    To increase limits for a user, edit file

    vi /etc/security/limits.conf
    

    Add

    USER_NAME_HERE        hard nofile 20480
    USER_NAME_HERE        soft nofile 10240
    
  • ImageMagick

    To install ImageMagick on CentOS, run

    yum install ImageMagick
    

    To install on Ubuntu/Debian, run

    apt install -y imagemagick
    

    How to check if ImageMagick is installed?