Tag: CentOS

  • Update Cpanel License Key

    To update cpanel server license, run

    /usr/local/cpanel/cpkeyclt

    Example

    [root@pbcp-22-01 ~]# /usr/local/cpanel/cpkeyclt
    Updating cPanel license...Done. Update succeeded.
    Building global cache for cpanel...Done
    [root@pbcp-22-01 ~]# 

    Back to Cpanel Server

  • Install PHP 5.6 on CentOS 7

    To install PHP 5.6 on CentOS 7, enable EPEL repo and remi repo

    yum install epel-release -y
    rpm -ivh https://rpms.remirepo.net/enterprise/remi-release-7.rpm
    

    Install yum-utils and enable remi-php56 repo

    yum install yum-utils
    yum-config-manager --enable remi-php56
    

    Install PHP 5.6 with

    yum install -y php php-bcmath php-cli php-common php-devel php-gd \
        php-imap php-intl php-json php-ldap php-lz4 php-mbstring php-mysqlnd \
        php-soap php-intl php-opcache php-xml php-pdo
    
  • yum commands

    Install a software with yum

    yum install PKG_NAME
    

    Uninstall a software

    yum remove 
    

    Example for installing php and GD

    yum install php php-gd
    

    When you need to update all install software, run

    yum update
    

    List all available software

    yum list available
    yum list available "software-name"
    

    List all installed software

    yum list installed
    

    See yum

  • EPEL – Extra Packages for Enterprise Linux

    EPEL (Extra Packages for Enterprise Linux) provide additional software for CentOS and RHEL.

    You can find more information about EPEL at

    http://fedoraproject.org/wiki/EPEL

    On CentOS 7/8, you can enable EPEP repo with command

    yum instal epel-release
    

    Or just download rpm package from the site and install.

    RHEL/CentOS 6:

    yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
    

    RHEL/CentOS 7:

    yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    

    RHEL/CentOS 8:

    yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
    

    See CentOS, yum

  • yum [Errno 5] [Errno 2] No such file or directory

    When running yum update on CentOS 7 server, i get following error

    [root@server2 yum.repos.d]# yum update curl
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    Resolving Dependencies
    --> Running transaction check
    ---> Package curl.x86_64 0:7.29.0-54.el7 will be updated
    ---> Package curl.x86_64 0:7.29.0-57.el7_8.1 will be an update
    --> Processing Dependency: libcurl = 7.29.0-57.el7_8.1 for package: curl-7.29.0-57.el7_8.1.x86_64
    --> Running transaction check
    ---> Package libcurl.x86_64 0:7.29.0-54.el7 will be updated
    --> Processing Dependency: libcurl = 7.29.0-54.el7 for package: libcurl-devel-7.29.0-54.el7.x86_64
    ---> Package libcurl.x86_64 0:7.29.0-57.el7_8.1 will be an update
    --> Running transaction check
    ---> Package libcurl-devel.x86_64 0:7.29.0-54.el7 will be updated
    ---> Package libcurl-devel.x86_64 0:7.29.0-57.el7_8.1 will be an update
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ============================================================================================================================================================================================================
     Package                                            Arch                                        Version                                                  Repository                                    Size
    ============================================================================================================================================================================================================
    Updating:
     curl                                               x86_64                                      7.29.0-57.el7_8.1                                        updates                                      271 k
    Updating for dependencies:
     libcurl                                            x86_64                                      7.29.0-57.el7_8.1                                        updates                                      223 k
     libcurl-devel                                      x86_64                                      7.29.0-57.el7_8.1                                        updates                                      303 k
    
    Transaction Summary
    ============================================================================================================================================================================================================
    Upgrade  1 Package (+2 Dependent packages)
    
    Total download size: 796 k
    Is this ok [y/d/N]: y
    Downloading packages:
    No Presto metadata available for updates
    
    
    Error downloading packages:
      libcurl-7.29.0-57.el7_8.1.x86_64: [Errno 5] [Errno 2] No such file or directory
      libcurl-devel-7.29.0-57.el7_8.1.x86_64: [Errno 5] [Errno 2] No such file or directory
      curl-7.29.0-57.el7_8.1.x86_64: [Errno 5] [Errno 2] No such file or directory
    
    [root@server2 yum.repos.d]#
    

    Someone had tried to install differnt version of python on this server. That caused this problem.

    When i run urlgrabber-ext-down, i get error saying python missing.

    [root@server2 ~]# /usr/libexec/urlgrabber-ext-down
    -bash: /usr/libexec/urlgrabber-ext-down: /usr/bin/python: bad interpreter: No such file or directory
    [root@server2 ~]#
    

    Problem fixed by creating symlink

    ln -s /usr/bin/python2.7 /usr/bin/python
    

    See yum

  • Install Vagrant on CentOS

    To install Vagrant on CentOS, go to

    https://www.vagrantup.com/downloads

    Get link to latest version, then run “rpm -ivh URL_TO_RPM_FILE”.

    At time of writing this post, latest Vagrant version is 2.2.9, to install Vagrant 2.2.9, run

    rpm -ivh https://releases.hashicorp.com/vagrant/2.2.9/vagrant_2.2.9_x86_64.rpm
    

    install vagrant on centos

    To check Vagrant version

    vagrant --version
    

    See Vagrant

  • Install bind in CentOS 7

    bind is a DNS server. To install bind on CentOS 7, run

    yum install bind bind-utils -y
    

    Enable bind to start on boot

    systemctl enable named
    

    Start bind

    systemctl start named
    

    You can see status with

    systemctl status named
    

    Setup firewall

    You need to allow DNS ports UDP/TCP 53 in firewall. On CentOS 7, you can run

    firewall-cmd --zone=public --permanent --add-service=dns
    firewall-cmd --reload
    

    Configure bind

    By default bind only listens to local IP, to make it accessable from outside, you need to edit named.conf

    vi /etc/named.conf
    

    Find

            listen-on port 53 { 127.0.0.1; };
            listen-on-v6 port 53 { ::1; };
    

    Comment out those two lines by adding # at start of the lines.

            #listen-on port 53 { 127.0.0.1; };
            #listen-on-v6 port 53 { ::1; };
    

    We need our DNS server access query from anyone on internet. For this, find

            allow-query     { localhost; };
    

    Replace with

            allow-query     { any; };
    

    Since we only want our DNS server resolve domains hosted on our server, disable recursion.

    Find

            recursion yes;
    

    Replace with

            recursion no;
    

    Now restart bind with

    systemctl restart bind
    

    Adding Domain to bind

    To server a domain, you need to add the domain to bind. For this edit file

    vi /etc/named.conf
    

    at end of the file, add

    zone "DOMAIN.EXTN" IN {
       type master;
       file "/var/named/DOMAIN.EXTN.zone";
       allow-update { none; };
    };
    

    Now create zone file

    vi /var/named/DOMAIN.EXTN.zone
    

    Add following

    $TTL            86400
    @                 IN SOA            DOMAIN.EXT.  admin.DOMAIN.EXT. (
    100     ; serial
    1H      ; refresh
    1M      ; retry
    1W      ; expiry
    1D )    ; minimum
    @                   IN NS             ns1.DOMAIN.EXT.
    @                   IN A                 YOUR_IP_ADDR_HERE
    ns1                 IN A                 YOUR_IP_ADDR_HERE
    @                   IN MX   10      mail.DOMAIN.EXT.
    mail                IN A                 YOUR_IP_ADDR_HERE
    www                 IN A                 YOUR_IP_ADDR_HERE
    

    Restart bind

    vi /var/named/DOMAIN.EXTN.zone
    

    You can verify domain is resolving with command

    nslookup DOMAIN.EXT SERVER_IP_HERE
    

    See bind

  • yum list all available packages in a repo

    To list all packages available on a specific repo, run

    yum  --disablerepo="*" --enablerepo="REPO_NAME_HERE" list available
    
    
    You can get list of all available repos with command
    
    
    yum repolist
    

    Example:

    yum list available

    yum  --disablerepo="*" --enablerepo="litespeed" list available
    

    This command list all packages available in repo "litespeed"

  • Install PHP 7 on CentOS VestaCP

    To install PHP 7. you need to first enable epel and remi repo.

    yum install -y epel-release
    rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    

    Remove existing PHP

    yum -y remove php
    

    Install PHP 7.3

    yum --enablerepo=remi-php73 install php73-php php73-php-mbstring php73-php-mysqlnd php73-php-gd php73-php-fpm php73-php-intl php73-php-cli php73-php-xml php73-php-opcache php73-php-pdo php73-php-gmp php73-php-process php73-php-pecl-imagick php73-php-devel
    

    start php-fpm

    service php-fpm stop
    service php73-php-fpm start
    

    Set php 7.3 as default PHP for cli

    rm /usr/bin/php
    ln -s /usr/bin/php73 /usr/bin/php
    

    Restart apache

    service httpd restart
    
  • rpm verify packages

    To verify a package installed on system, you can use

    rpm -V PKG_NAME

    Example

    [root@hello-1 curl-curl-7_69_0]# rpm -V bind
    S.5....T.  c /etc/named.conf
    [root@hello-1 curl-curl-7_69_0]# 

    Here bind package have /etc/named.conf file modified.

    To verify all packages on system, run

    rpm -Va

    Back to rpm

  • CentOS 7 resolv.conf make changes permanent

    On rebooting the CentOS 7 server, changes made to resolv.conf is lost. This is because one of the network interface is configured to use DNS server.

    [root@server ~]# grep DNS /etc/sysconfig/network-scripts/ifcfg-*
    /etc/sysconfig/network-scripts/ifcfg-eno1:DNS1="127.0.0.1"
    [root@server ~]# 

    To fix, edit

    vi /etc/sysconfig/network-scripts/ifcfg-eno1

    Remove the line

    DNS1="127.0.0.1"

    Now NetworkManager will not modify /etc/resolv.conf file on boot.

    Or you can set valid DNS servers in network config file like

    [root@server ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno1 | grep DNS
    DNS1="1.1.1.1"
    DNS2="8.8.8.8"
    [root@server ~]# 

    If your network configuration use DHCP, set set PEERDNS=no.

    BOOTPROTO=dhcp
    PEERDNS=no

    Another solution is to make file immutable with

    chattr +i /etc/resolv.conf

    Related Posts

    Domain Resolver

  • Install clamav Antivirus on CentOS 7

    ClamAV is provided by the EPEL repo. Install epel repo

    yum install -y epel-release
    

    Install ClamAV with

    yum install clamav
    

    Back to ClamAV