Tag: yum

  • Install PHP APC Cache on CentOS 7 using yum

    Install PHP APC Cache on CentOS 7 using yum

    To install APC cache on CentOS 7, run

    yum install php-pecl-apcu
    

    After that, you need to restart the Apache webserver.

    systemctl restart httpd
    

    in phpinfo() page, you will see

    php APC cache in phpinfo

    Files in the packages are

    [root@localhost ~]# rpm -q --filesbypkg  php-pecl-apcu
    php-pecl-apcu             /etc/php-zts.d/40-apcu.ini
    php-pecl-apcu             /etc/php.d/40-apcu.ini
    php-pecl-apcu             /usr/lib64/php-zts/modules/apcu.so
    php-pecl-apcu             /usr/lib64/php/modules/apcu.so
    php-pecl-apcu             /usr/share/doc/pecl/apcu
    php-pecl-apcu             /usr/share/doc/pecl/apcu/NOTICE
    php-pecl-apcu             /usr/share/doc/pecl/apcu/README.md
    php-pecl-apcu             /usr/share/doc/pecl/apcu/TECHNOTES.txt
    php-pecl-apcu             /usr/share/licenses/php-pecl-apcu-5.1.21
    php-pecl-apcu             /usr/share/licenses/php-pecl-apcu-5.1.21/LICENSE
    php-pecl-apcu             /var/lib/pear/pkgxml/php-pecl-apcu.xml
    [root@localhost ~]# 
    

    Config file located at

    /etc/php.d/40-apcu.ini
    

    Some configuration settings

    apc.shm_size – default is 64M, it is better increase this value to 128M

    apc.stat – default 1, set it to 0 to increase performance. Setting it to 0 means APC won’t look for code change. When you change code, you will need to restart web server.

    apc.num_files_hint – Tell APC how many PHP files it needs to cache. Set it to 10000

  • 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

  • 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

  • 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"

  • rpmdb DB_RUNRECOVERY: Fatal error, run database recovery

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

    [root@ip-172-30-0-39 ~]# yum update
    error: rpmdb: BDB0113 Thread/process 12797/46913889995840 failed: BDB1507 Thread died in Berkeley DB library
    error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
    error: cannot open Packages index using db5 -  (-30973)
    error: cannot open Packages database in /var/lib/rpm
    CRITICAL:yum.main:
    
    Error: rpmdb open failed
    [root@ip-172-30-0-39 ~]#
    

    To fix it, run

    rm -f /var/lib/rpm/__db.00*
    
  • yum-config-manager

    yum-config-manager allows you to manage yum repositories.

    To add a repo, run

    yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
    

    Disable a repository

    yum-config-manager --disable rpmfusion-free-updates
    

    See yum

  • Yum disable a repository

    To disable a repository, run

    yum-config-manager --disable REPO_NAME_HERE
    

    To list all enabled repository, run

    yum repolist
    
  • Fix yum duplicate packages

    On a CentOS server, when running

    yum update
    

    It failed with following error

    acl-2.2.51-14.el7.x86_64 is a duplicate with acl-2.2.51-12.el7.x86_64
    alt-libcurlssl-7.60.0-1.el7.x86_64 is a duplicate with alt-libcurlssl-7.54.0-8.el7.cloudlinux.x86_64
    alt-php-config-1-29.1.el7.noarch is a duplicate with alt-php-config-1-27.el7.noarch
    alt-php44-4.4.9-88.el7.x86_64 is a duplicate with alt-php44-4.4.9-81.el7.x86_64
    alt-php44-bcmath-4.4.9-88.el7.x86_64 is a duplicate with alt-php44-bcmath-4.4.9-81.el7.x86_64
    

    https://gist.github.com/serverok/c0853120baff8848054cfb598e389c3a

    This is because previous “yum update” failed for some reason after package install. So no cleanup was done.

    To fix, you need to use package-cleanup command.

    yum install yum-utils
    

    To list all duplicate packages, run

    package-cleanup --dupes
    

    To remove all duplicate packages, run

    package-cleanup --cleandupes
    

    Now do a yum update

    yum update
    

    This will update your system and install any missing packages.

    To verify if there any problem, run

    package-cleanup --problems
    

    If this does not fix, try yum fix duplicate package error

    See yum

  • yum repolist

    List all Repositories

    yum repolist
    

    List packages from a specific repo

    Following command disable all repos and enable EPEL repo.

    yum list available  --disablerepo=* --enablerepo=epel
    

    See yum

  • yum

    Some useful yum commands when installation fails or stopped halfway

    yum-complete-transaction
    yum-complete-transaction --cleanup-only
    yum history redo last

    Red Hat Software Collections (RHSCL)

    yum install rh-php56
    scl enable rh-php56 bash

    Selectively enable yum repos

    yum update -v --disablerepo=* --enablerepo=cl*

    yum commands
    Maybe run: yum groups mark install
    yum reinstall a package
    yum repolist
    Yum disable a repository
    rpm
    yum-config-manager
    Download RPM package from yum repository
    yum list all available packages in a repo

    yum errors

  • Maybe run: yum groups mark install

    When installing CloudLinux alt-php group, i get error.

    [root@titan ~]# yum groupinstall alt-php
    Loaded plugins: fastestmirror, rhnplugin, universal-hooks
    This system is receiving updates from CLN.
    Loading mirror speeds from cached hostfile
    * EA4: 169.255.59.74
    * cpanel-addons-production-feed: 169.255.59.74
    * cloudlinux-x86_64-server-7: cl-mirror.fr.planethoster.net
    Maybe run: yum groups mark install (see man yum)
    No packages in any requested group available to install or update
    [root@titan ~]#
    

    This error is fixed by running

    yum groups mark remove alt-php
    yum groupinstall alt-php 
    

    See yum