Minggu, 24 Maret 2019

How to Install and Configure Nagios on CentOS


Nagios is one of the most popular open source monitoring systems. Nagios keeps an inventory of your entire IT infrastructure and ensures your networks, servers, applications, services, and processes are up and running. In case of failure or suboptimal performance Nagios will send notification alerts via various methods.

This tutorial describes how to install and configure Nagios Core on a CentOS 6 and CentOS 7 server.

Prerequisites

Disable SELinux or set in permissive mode as instructed here.

# sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
# setenforce 0

Update your CentOS system and install Apache, PHP and all the packages necessary to download and compile the Nagios main application and Nagios plugins:

# yum update
# yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp openssl-devel wget
# yum install make gettext autoconf net-snmp-utils epel-release perl-Net-SNMP postfix unzip automake


Installing Nagios on CentOS

Perform the following steps to install the latest version of Nagios Core from source.

  1. Downloading Nagios

    We’ll download Nagios source in the /usr/src directory which is the common location to place source files.

    Navigate to the directory with:

    # cd /usr/src/

    Download the latest version of Nagios from the project Github repository using the following wget command:

    # wget -O nagioscore.tar.gz https://github.com/NagiosEnterprises/nagioscore/archive/nagios-4.4.3.tar.gz
    # tar xzf nagioscore.tar.gz

    Before continuing with the next steps, make sure you change to the Nagios source directory by typing:

    # cd nagioscore-nagios-4.4.3/


  2. Compiling Nagios

    To start the build process run the configure script which will perform a number of checks to make sure all of the dependencies on your system are present:

    # ./configure
    # make all


  3. Creating Nagios User And Group

    Create a new system nagios user and group by issuing:

    # make install-groups-users

    Add the Apache apache user to the nagios group:

    # usermod -a -G nagios apache


  4. Installing Nagios Binaries

    Run the following command to install Nagios binary files, CGIs, and HTML files:

    # make install


  5. Creating External Command Directory

    Nagios can process commands from external applications. Create the external command directory and set the proper permissions by typing:

    # make install-commandmode


  6. Install Nagios Configuration Files

    Install the sample Nagios configuration files with:

    # make install-config


  7. Install Apache Configuration Files

    Run the command below to install the Apache web server configuration files:

    # make install-webconf


  8. Creating Service and Daemon httpd

    ===== CentOS 6.x | RHEL 6.x | Oracle Linux 6.x =====

    # make install-daemoninit
    # chkconfig --level 2345 httpd on

    ===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====

    # make install-daemoninit
    # systemctl enable httpd.service


  9. Creating User Account

    To be able to access the Nagios web interface wel’ll create an admin user called nagiosadmin, Run the following htpasswd command to create a user called nagiosadmin

    # htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

    You will be prompted to enter and confirm the user’s password.

    Restart the Apache service for changes to take effect :

    ===== CentOS 6.x | RHEL 6.x | Oracle Linux 6.x =====

    # service httpd restart

    ===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====

    # systemctl restart httpd


  10. Configuring Firewall

    The firewall will secure your server against unwanted traffic.

    You need to allow port 80 inbound traffic on the local firewall so you can reach the Nagios Core web interface.

    ===== CentOS 6.x | RHEL 6.x | Oracle Linux 6.x =====

    # iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT
    # service iptables save
    # ip6tables -I INPUT -p tcp --destination-port 80 -j ACCEPT
    # service ip6tables save

    ===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====

    # firewall-cmd --zone=public --add-port=80/tcp
    # firewall-cmd --zone=public --add-port=80/tcp --permanent


Installing Nagios Plugins

Switch back to the /usr/src directory:

# cd /usr/src/

Download the latest version of the Nagios Plugins from the project Github repository:

# wget -O nagios-plugins.tar.gz http://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz

When the download is complete extract the tar file:

# tar zxf nagios-plugins.tar.gz

Change to the plugins source directory:

# cd nagios-plugins-2.2.1

Run the following commands one by one to compile and install the Nagios plugins:

# ./configure
# make
# make install


Starting Nagios

Now that both Nagios and its plugins are installed, start the Nagios service with:

===== CentOS 6.x | RHEL 6.x | Oracle Linux 6.x =====

# service nagios start
# chkconfig --level 2345 nagios on

===== CentOS 7.x | RHEL 7.x | Oracle Linux 7.x =====

# systemctl start nagios.service
# systemctl enable nagios.service


Accessing the Nagios Web Interface

To access the Nagios web interface open your favorite browser and type your server’s domain name or public IP address followed by /nagios:

http(s)://your_domain_or_ip_address/nagios

Enter the nagiosadmin user login credentials and you will be redirected to the default Nagios home page as shown on the image below:


Conclusion

You have successfully installed the latest Nagios version from source on your CentOS system.


Kamis, 21 Maret 2019

How to Install Golang 1.12.1 on CentOS 7


Golang is a programming language developed by Google. Thanks to its versatility, simplicity and reliability, Golang has become one of the most popular programming languages in the open source community.

In this article, I will show you how to install the latest stable release of Golang on 64-bit Linux operating systems, in CentOS 7. At the time I wrote this article, the latest stable release of Golang was Golang 1.12.1

Step 1: Download and decompress the Golang 1.12.1 archive

if you are using a 64-bit Linux operating system, in CentOS 7 x64, you need to download the 64-bit version of Golang as below:

# cd
# wget https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz
# tar -zxvf go1.12.1.linux-amd64.tar.gz -C /usr/local

Note: You can always find the download link to the latest release of Golang on the  golang official download page


Step 2: Setup GOROOT and PATH environment variables:

# echo 'export GOPATH=~/.go' | tee -a /etc/profile
# echo 'export GOROOT=/usr/local/go' | tee -a /etc/profile
# echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' | tee -a /etc/profile
# source /etc/profile


Step 3: Test the installation

# go version
# go env

In addition, you can write a simple Golang program and give it a shot:

# cd
# mkdir -p src/hello
# cd
# vi hello.go

Populate the file ~/src/hello/hello.go with the following code segment:

package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}

Save and quit:

:wq!

Finally, run your first Golang program as follows:

# go run hello.go

If everything was done correctly, you will see the output:

hello world

This concludes my tutorial. Thanks for reading.

Jumat, 15 Maret 2019

How to Configure MySQL 8.0 Master Slave Replication on Centos 7.x

This guide to help you Configure MySQL 8.0 Master-Slave Replication on Centos 7.x

This setup will use below Server details:

Master MySQL Server: 10.0.0.98
Slave MySQL Server:  10.0.0.99

Setup Prerequisites:

You need to have MySQL Server installed on all servers before you can continue, refer to the following guides for installation of MySQL Server:

How to Install MySQL 8 Community on CentOS 7


Step 1: Configure the Master Server

The first configuration change to make is setting Server ID for the master database:

# vim /etc/my.cnf

Add the line below under [mysqld] section. Note that the number set needs to be unique, it can not be re-used on any node in the cluster.

server-id = 1

Set  log_bin location, this is where all replication information is located. All the changes made on the master are written to this file. All slaves will copy data from it.

log-bin=mysql-bin.log
binlog_do_db=exampledb
server-id=1
sync_binlog=1
user=mysql
symbolic-links=0
tmpdir = /tmp
binlog_format = ROW
max_binlog_size = 500
expire-logs-days = 7
slow_query_log

A complete simple configuration looks like below:

[mysqld]
log-bin=mysql-bin.log
binlog_do_db=exampledb
server-id=1
sync_binlog=1
user=mysql
symbolic-links=0
tmpdir = /tmp
binlog_format = ROW
max_binlog_size = 500
expire-logs-days = 7
slow_query_log

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[innodb]
innodb_flush_log_at_trx_commit=1

binlog_do_db=exampledb: this is the database that will be replicated

Restart mysql service for changes to take effect:

# systemctl restart mysql


Step 2: Create Replication user on Master database server

We now need to create a database user to be used by slaves when connecting. Login to MySQL database as root user and create the user:

[root@master etc]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.15 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create user 'sync'@'10.0.0.99' identified by 'sync1234';
Query OK, 0 rows affected (0.01 sec)

Grant the user REPLICATION SLAVE privileges:

mysql> grant replication slave on *.* to 'sync'@'10.0.0.99';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

Confirm grants for created user:

mysql> show grants for 'sync'@'10.0.0.99';
+------------------------------------------------------+
| Grants for sync@10.0.0.99                            |
+------------------------------------------------------+
| GRANT REPLICATION SLAVE ON *.* TO `sync`@`10.0.0.99` |
+------------------------------------------------------+
1 row in set (0.00 sec)



Step 3: Create Database and table on Master database server

We now need to create a database and table for example Replication:

mysql> create database exampledb;
Query OK, 1 row affected (0.04 sec)

mysql> use exampledb;
Database changed
mysql> CREATE TABLE exampletb ( id smallint unsigned not null auto_increment, name varchar(20) not null, constraint pk_example primary     key (id) );
Query OK, 0 rows affected (0.02 sec)

mysql> GRANT ALL PRIVILEGES ON exampledb.* to 'sync'@'10.0.0.99';
Query OK, 0 rows affected (0.01 sec)


Step 4: Backup database

From shell terminal :

[root@master ~]# mysqldump -uroot -p --opt exampledb > exampledb.sql
Enter password:

Copy to slave  database server

[root@master ~]# scp exampledb.sql root@10.0.0.98:/root/
root@10.0.0.98's password:
exampledb.sql                                 100% 1875     2.1MB/s   00:00   


Step 5: Install and Configure Slave Server

Install MySQL Server 8.0 on Slave server in a similar process used for the Master server. You can follow steps in the guide How to Install MySQL 8.0 on CentOS 7

When done with the installation, configure slave by editing the file:

[mysqld]
server-id=2
relay-log=mysql-relay-bin.log
log_bin=mysql-bin.log
binlog_do_db=exampledb
user=mysql
symbolic-links=0
read_only = 1
tmpdir = /tmp
binlog_format = ROW
max_binlog_size = 500
expire-logs-days = 7
slow_query_log

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[innodb]
innodb_flush_log_at_trx_commit=1

read_only = 1: This sets the slave to read-only mode. Only users with the SUPER privilege and the replication slave thread will be able to modify data on it. This ensures there are no applications that can accidentally modify data on the slave instead of master.

log_bin = mysql-bin.log:  This enables binary logging. This is required for acting as a MASTER in a replication configuration. You also need the binary log if you need the ability to do point in time recovery from your latest backup.

Restart mysql server after you’ve finished making changes:

# systemctl restart mysqld


Step 6: Restore database

First login to mysql with root privilege create database exampledb:

[root@slave ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 8.0.15 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> create database exampledb;
Query OK, 1 row affected (0.01 sec)

from shell terminal

[root@slave ~]# mysql -uroot -p exampledb < exampledb.sql
Enter password:


Step 7: Initialize Replication process

We should be ready to start Replication process on the slave server. Start by checking Status on the master databse server:

mysql> show master status\G
*************************** 1. row ***************************
             File: mysql-bin.000030
         Position: 155
     Binlog_Do_DB: exampledb
 Binlog_Ignore_DB:
Executed_Gtid_Set:
1 row in set (0.00 sec)

Take a note of current Master log file and position. Then configure Slave server with details obtained from the master status command:

[root@slave etc]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.15 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CHANGE MASTER TO MASTER_HOST='10.0.0.98',
    -> MASTER_USER='sync',
    -> MASTER_PASSWORD='sync1234',
    -> MASTER_LOG_FILE='mysql-bin.000030',
    -> MASTER_LOG_POS=155;
Query OK, 0 rows affected, 2 warnings (0.02 sec)

Then start replication on the slave:

mysql> start slave;
Query OK, 0 rows affected (0.01 sec)

To check slave status, use:

mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.0.0.98
                  Master_User: sync
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000030
          Read_Master_Log_Pos: 155
               Relay_Log_File: mysql-relay-bin.000002
                Relay_Log_Pos: 322
        Relay_Master_Log_File: mysql-bin.000030
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 155
              Relay_Log_Space: 530
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
                  Master_UUID: d144000b-3b07-11e9-a246-0800274a8d27
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind:
      Last_IO_Error_Timestamp:
     Last_SQL_Error_Timestamp:
               Master_SSL_Crl:
           Master_SSL_Crlpath:
           Retrieved_Gtid_Set:
            Executed_Gtid_Set:
                Auto_Position: 0
         Replicate_Rewrite_DB:
                 Channel_Name:
           Master_TLS_Version:
       Master_public_key_path:
        Get_master_public_key: 0
1 row in set (0.00 sec)

Slave IO and SQL should indicate running state:

             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes

Test transaction replication

on master database server:

[root@master ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 8.0.15 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use exampledb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> show tables;
+---------------------+
| Tables_in_exampledb |
+---------------------+
| exampletb           |
+---------------------+
1 row in set (0.00 sec)

mysql> INSERT INTO exampletb ( id, name ) VALUES ( null, 'uu' );
Query OK, 1 row affected (0.03 sec)

mysql> select * from exampletb;
+----+------+
| id | name |
+----+------+
|  1 | uu   |
+----+------+
1 row in set (0.00 sec)

on slave database server:

[root@slave ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 25
Server version: 8.0.15 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use exampledb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> select * from exampletb;
+----+------+
| id | name |
+----+------+
|  1 | uu   |
+----+------+
1 row in set (0.00 sec)


Rabu, 13 Maret 2019

Installing MySQL Server 8.0 Community Edition on CentOS 7

This guide is to help you with Installing MySQL 8.0 Community Edition Server on CentOS 7

To start installing MySQL server on CentOS 7, you need to add the official MySQL community repository to your system. Run below commands to add it,

# cd
# wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
# yum localinstall mysql80-community-release-el7-1.noarch.rpm

Install MySQL 8 on CentOS

Now that repo is added, you can install MysQL 8 without editing repository content since repo for 8 is enabled by default.

# yum --enablerepo=mysql80-community install mysql-community-server

Start MySQL Service

For CentOS 7, use systemd to start mysql service:

# systemctl enable  mysqld
# systemctl start mysqld

Harden MySQL Server / Set MySQL root password

Installation of MySQL on CentOS 7 generates a temporary password for you. You can get it by running:

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

It will look like below:

temporary password is generated for root@localhost: si=R&3t#Buy7

Change mysql root user password and Harden MySQL

# mysql_secure_installation

You will be given the choice to change the MySQL root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes to these options.

Configure Firewall

Firewalld:

# firewall-cmd --add-service mysql --permanent
# firewall-cmd --reload

Test your settings:

[root@webapps3 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 173142
Server version: 8.0.15 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Selasa, 12 Maret 2019

Create a New MySQL User and Database


Creating users and databases

The standard tool for interacting with MySQL is the mysql client which installs with the mysql-server package. The MySQL client is used through a terminal.

To create a MySQL database and user, follow these steps:

  1. At the command line, log in to MySQL as the root user: 

    # mysql -u root -p

  2. Type the MySQL root password, and then press Enter. 

  3. To create a database user, type the following command. Replace username with the user you want to create, and replace password with the user's password:

    mysql> create database testdb;
    mysql> create user 'testuser'@'localhost' identified by 'password';
    mysql> grant all privileges on testdb.* to 'testuser' identified by 'password';

    You can shorten this process by creating the user while assigning database permissions:

    mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';

    Information This command grants the user all permissions. However, you can grant specific permissions to maintain precise control over database access. For example, to explicitly grant the SELECT permission, you would use the following command:

        GRANT SELECT ON *.* TO 'username'@'localhost';

    For more information about setting MySQL database permissions, please visit https://dev.mysql.com/doc/refman/8.0/en/grant.html.

  4. Type \q or exit to exit the mysql program.

  5. To log in to MySQL as the user you just created, type the following command. Replace username with the name of the user you created in step 3:

    mysql> mysql -u username -p

  6. Type the user's password, and then press Enter.

  7. To create a database, type the following command. Replace dbname with the name of the database that you want to create:

    mysql> CREATE DATABASE dbname;

  8. To work with the new database, type the following command. Replace dbname with the name of the database you created in step 7:

  9. You can now work with the database. For example, the following commands demonstrate how to create a basic table named example, and how to insert some data into it:

    mysql> CREATE TABLE example ( id smallint unsigned not null auto_increment, name varchar(20) not null, constraint pk_example primary key (id) );
    mysql>  INSERT INTO example ( id, name ) VALUES ( null, 'Sample data' );


Deleting tables and databases

To delete a table, type the following command from the mysql> prompt. Replace tablename with the name of the table that you want to delete:

mysql>  DROP TABLE tablename;

Information This command assumes that you have already selected a database by using the USE statement.

Similarly, to delete an entire database, type the following command from the mysql> prompt. Replace dbname with the name of the database that you want to delete:

mysql>  DROP DATABASE dbname;

Warning The mysql program does not ask for confirmation when you use this command. As soon as you press Enter, MySQL deletes the database and all of the data it contains..

Deleting users

To view a list of all users, type the following command from the mysql> prompt:

mysql>  SELECT user FROM mysql.user GROUP BY user;

To delete a specific user, type the following command from the mysql> prompt. Replace username with the name of the user that you want to delete:

mysql>  DELETE FROM mysql.user WHERE user = 'username';


Selasa, 05 Maret 2019

How do I turn off the mysql passowrd validation or Your Password does not Satisfy the Current Policy Requirements


Whenever the user tried to set any password in MySQL, he faced following error:

mysql> create user 'testuser'@'localhost' identified by 'password';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

After a while, he really got frustrated by this Current Policy Requirements for a password.
You can check the current variables related to validating password by running the following command:

mysql> show global variables like 'validate%';
+---------------------------------------+-------------+
| Variable_name                         | Value       |
+---------------------------------------+-------------+
| validate_password.check_user_name     | ON          |
| validate_password.dictionary_file     |             |
| validate_password.length              | 8           |
| validate_password.mixed_case_count    | 1           |
| validate_password.number_count        | 1           |
| validate_password.policy              | MEDIUM      |
| validate_password.special_char_count  | 1           |
+---------------------------------------+-------------+
7 rows in set (0.01 sec)

Now let us see how we can resolve our error.

Method 1: Let us see how we can set the password_policy to low login to mysql as root:

mysql> SET GLOBAL validate_password.policy=LOW;
mysql> SET GLOBAL validate_password.length=6;

Method 2: You can also set the same variable in my.cnf file as well edit my.cnd like this.

[mysqld]
validate_password.policy=LOW
validate_password.length=6

Method 3: Uninstall Plugin which validates password if you use MySQL Ver 5.7 below
Run the following sql command:

mysql> uninstall plugin validate_password;

Senin, 04 Maret 2019

How to Install Percona Server for MySQL on CentOS 7


  1. Download the packages of the desired series for your architecture from the download page. The easiest way is to download bundle which contains all the packages. Following example will download Percona Server for MySQL 8.0.13-4 release packages for CentOS 7:

  2. # wget https://www.percona.com/downloads/Percona-Server-8.0/Percona-Server-8.0.13-4/binary/redhat/7/x86_64/Percona-Server-8.0.13-4-rf0a32b8-el7-x86_64-bundle.tar

  3. You should then unpack the bundle to get the packages:

  4. # tar xvf Percona-Server-8.0.13-4-rf0a32b8-el7-x86_64-bundle.tar

    After you unpack the bundle you should see the following packages when running

    # ls *.rpm
    percona-mysql-router-8.0.13-4.1.el7.x86_64.rpm
    percona-server-client-8.0.13-4.1.el7.x86_64.rpm
    percona-server-debuginfo-8.0.13-4.1.el7.x86_64.rpm
    percona-server-devel-8.0.13-4.1.el7.x86_64.rpm
    percona-server-rocksdb-8.0.13-4.1.el7.x86_64.rpm
    percona-server-server-8.0.13-4.1.el7.x86_64.rpm
    percona-server-shared-8.0.13-4.1.el7.x86_64.rpm
    percona-server-shared-compat-8.0.13-4.1.el7.x86_64.rpm
    percona-server-test-8.0.13-4.1.el7.x86_64.rpm
    percona-server-tokudb-8.0.13-4.1.el7.x86_64.rpm

  5. Now you can install Percona Server for MySQL 8.0 by running :

  6. # rpm -ivh percona-server-server-80-8.0.13-4-rf0a32b8.el7.x86_64.rpm \
       percona-server-client-80-8.0.13-4.1.el7.x86_64.rpm \
       percona-server-shared-80-8.0.13-4.1.el7.x86_64.rpm \
       percona-server-shared-compat-80-8.0.13-4.1.el7.x86_64.rpm

    # systemctl start mysqld
    # systemctl enable mysqld

Harden MySQL Server

  1. Run the mysql_secure_installation script to address several security concerns in a default MySQL installation.

  2. # mysql_secure_installation

    You will be given the choice to change the MySQL root password, remove anonymous user accounts, disable root logins outside of localhost, and remove test databases. It is recommended that you answer yes to these options.

    NOTE
     If MySQL 5.7 was installed, you will need the temporary password that was created during installation. This password is notated in the /var/log/mysql.log file, and can be quickly found using the following command.

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