Tag: Oracle Linux

  • How to Install MySQL 5.7 on Oracle Linux 7

    How to Install MySQL 5.7 on Oracle Linux 7

    Oracle Linux 7 comes with MySQL yum repository pre-installed. By Default MySQL 8 repository is enabled. You can disable MySQL 8 repository and enable MySQL 5.7 repository to install MySQL 5.7.

    You can find enabled repositories with command

    yum repolist all |  grep -i mysql
    

    Example

    [root@sql2 ~]# yum repolist all |  grep -i mysql
    ol7_MySQL55/x86_64                      MySQL 5.5 for Oracle Lin disabled
    ol7_MySQL56/x86_64                      MySQL 5.6 for Oracle Lin disabled
    ol7_MySQL57/x86_64                      MySQL 5.7 for Oracle Lin disabled
    ol7_MySQL80/x86_64                      MySQL 8.0 for Oracle Lin enabled:    281
    ol7_MySQL80_connectors_community/x86_64 MySQL 8.0 Connectors Com enabled:     56
    ol7_MySQL80_tools_community/x86_64      MySQL 8.0 Tools Communit enabled:     15
    [root@sql2 ~]#
    

    Let’s disable MySQL 8 repo and enable MySQL 5.7 repository.

    yum install -y yum-utils
    yum-config-manager --disable ol7_MySQL80 ol7_MySQL80_connectors_community ol7_MySQL80_tools_community
    yum-config-manager --enable ol7_MySQL57
    

    Before you can install MySQL 5.7, if your server has any MySQL 8 related packages installed, you need to uninstall them.

    On my server, I had the following packages installed.

    [root@mysql1 ~]# rpm -qa | grep mysql
    mysql-community-client-plugins-8.0.26-1.el7.x86_64
    mysql-community-common-8.0.26-1.el7.x86_64
    mysql-community-libs-8.0.26-1.el7.x86_64
    mysql-release-el7-1.0-5.el7.x86_64
    mysql-community-libs-compat-8.0.26-1.el7.x86_64
    [root@mysql1 ~]# 
    

    These are installed as dependency for the postfix mail server, so if you remove the packages with yum, postfix also get removed, so I removed it with command

    rpm -e --nodeps mysql-community-client-plugins-8.0.26-1.el7.x86_64
    rpm -e --nodeps mysql-community-common-8.0.26-1.el7.x86_64
    rpm -e --nodeps mysql-community-libs-8.0.26-1.el7.x86_64
    rpm -e --nodeps mysql-community-libs-compat-8.0.26-1.el7.x86_64
    

    –nodeps option will remove packages without removing dependent packages. Make sure you don’t remove the package mysql-release-el7-1.0-5.

    Now you can install MySQL server with command

    yum install mysql-community-server
    

    Enable and start MySQL server

    systemctl enable mysqld --now
    

    To find MySQL initial password, use

    grep 'temporary password' /var/log/mysqld.log
    

    Login to MySQL server using the temporary password and set a password

    mysql -u root -p
    

    Enter the MySQL server temporary password, then execute the following SQL to change the MySQL root password.

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEW_MYSQL_ROOT_PW';
    

    NEW_MYSQL_ROOT_PW – replace with your new secure MySQL root password.

    You can secure MySQL installation by running

    mysql_secure_installation
    
  • How to Migrate CentOS to Oracle Linux

    How to Migrate CentOS to Oracle Linux

    Oracle Linux is Free 100% binary-compatible with Red Hat Enterprise Linux, same as CentOS. Unlike RHEL, Oracle Linux is free even for commercial use. Oracle only charges if you need support.

    Oracle provides a script to convert CentOS to Oracle Linux

    https://github.com/oracle/centos2ol

    This script support CentOS 6, CentOS 7 and CentOS 8.

    Before you can run the convert script, make sure you have updated the system to the latest version with yum or dnf and take a backup in case anything goes wrong.

    yum update
    

    Download update centos2ol script

    wget https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh
    

    Convert your CentOS installation to Oracle Linux with the command

    bash centos2ol.sh -V
    

    Reboot the server

    reboot
    
  • How to Install PHP 5.6 on Oracle Linux 7

    How to Install PHP 5.6 on Oracle Linux 7

    Oracle Linux is a free RHEL based Linux distro. We will install PHP 5.6 on an Oracle Linux 7 server.

    First, enable EPEL repo

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

    Enable Remi repo

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

    Install yum-utils package

    yum install yum-utils
    

    Enable remi-php56

    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
    

    This will only install the CLI version of PHP 5.6. To make Apache work with PHP 5.6, install

    yum install php-pecl-http.x86_64
    

    This will create file /etc/httpd/conf.d/php.conf, that enable PHP module in Apache.

    Restart apache webserver

    systemctl restart httpd
    

    Now Apache will be able to serve PHP files.

  • Updating Kernel on Oracle Linux with Ksplice

    Updating Kernel on Oracle Linux with Ksplice

    Oracle Linux come with Ksplice, it allow you to upgrade Kernel with out rebooting.

    To update kernel, run

    uptrack-upgrade
    

    Example

    Oracle Ksplice