Install MySQL on CentOS using DBdeployer

Install MySQL on CentOS using DBdeployer

Install MySQL on CentOS using DBdeployer

1. Here It is assumed You will have a CentOS system/VM. If not, then please find my this blog post link where you will get instruction about, how you can create CentOS virtual machine using the vagrant. 

2. Connect to CentOS VM
abhinavs-MacBook-Air:centos7-test-vm agupta$ pwd
/Users/agupta/vagrant_box/centos7-test-vm

abhinavs-MacBook-Air:centos7-test-vm agupta$ vagrant ssh 

[vagrant@centos7-test-vm ~]$ sudo su -

[root@centos7-test-vm ~]#

3. Run below command to install the latest DBdeployer package 
[root@centos7-test-vm ~]# yum -y install wget

[root@centos7-test-vm ~]# VERSION=1.30.0

[root@centos7-test-vm ~]# OS=linux

[root@centos7-test-vm ~]# origin=https://github.com/datacharmer/dbdeployer/releases/download/v$VERSION

[root@centos7-test-vm ~]# wget $origin/dbdeployer-$VERSION.$OS.tar.gz

[root@centos7-test-vm ~]# tar -xzf dbdeployer-$VERSION.$OS.tar.gz

[root@centos7-test-vm ~]# chmod +x dbdeployer-$VERSION.$OS

[root@centos7-test-vm ~]# sudo mv dbdeployer-$VERSION.$OS /usr/local/bin/dbdeployer 
Note: Once writing these steps, we had the latest Dbdeployer version released 1.30.0. You make sure to check the latest version released on below page and make accordingly value of "VERSION=XX.XX.XX" above in 2nd command. 

- Verify the installed dbdeployer version. 
[root@centos7-test-vm ~]# dbdeployer --version
dbdeployer version 1.30.0
[root@centos7-test-vm ~]# 

4. Download the latest Percona Server 5.7 binary tarball package from below link under section "Linux-Generic."


Note: Here if you are confused which SSL package tar bar you should download, then please check my this blog post.
[root@centos7-test-vm ~]# wget https://www.percona.com/downloads/Percona-Server-5.7/Percona-Server-5.7.25-28/binary/tarball/Percona-Server-5.7.25-28-Linux.x86_64.ssl101.tar.gz

5. Unpack the tarball package using the DBdeployer. 
[root@centos7-test-vm ~]# pwd
/root

[root@centos7-test-vm ~]# ls -lth Percona*tar.gz
-rw-r--r--. 1 root root 408M May 22 00:14 Percona-Server-5.7.25-28-Linux.x86_64.ssl101.tar.gz

[root@centos7-test-vm ~]# mkdir -p /root/opt/mysql

[root@centos7-test-vm ~]# dbdeployer unpack --prefix=ps Percona-Server-5.7.25-28-Linux.x86_64.ssl101.tar.gz 
Note: Above I have used "--prefix=ps" to explicitly mention with a binary directory that it is the Percona Server (PS) tarball packages. It is useful to use --prefix like Maria/Oracle/PS to distinguish between the multiple tarball packages installed on the system with different package providers. 

Using below command, you can check the list of installed/available tarball binary packages for dbdeployer. 
[root@centos7-test-vm ~]# dbdeployer versions
Basedir: /root/opt/mysql
ps5.7.25
[root@centos7-test-vm ~]# 

Here you can see we have Percona Server 5.7.25 binary packages available for DBdeployer. 

6. Create a single MySQL instance using the Percona Server 5.7.25 binary package. 

[root@centos7-test-vm ~]# dbdeployer deploy single ps5.7.25
Creating directory /root/sandboxes
Database installed in $HOME/sandboxes/msb_ps5_7_25
run 'dbdeployer usage single' for basic instructions'
.. sandbox server started
[root@centos7-test-vm ~]# 

7. To access the MySQL, go to the installed directory which is "/root/sandboxes/msb_ps5_7_25" and then runs below command. 
[root@centos7-test-vm msb_ps5_7_25]# pwd
/root/sandboxes/msb_ps5_7_25

[root@centos7-test-vm msb_ps5_7_25]# sh use
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.25-28 Percona Server (GPL), Release 28, Revision c335905

Copyright (c) 2009-2019 Percona LLC and/or its affiliates
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 [localhost:5725] {msandbox} ((none)) > \s
--------------
/root/opt/mysql/ps5.7.25/bin/mysql  Ver 14.14 Distrib 5.7.25-28, for Linux (x86_64) using  6.2

Connection id:        3
Current database:
Current user:        msandbox@localhost
SSL:            Not in use
Current pager:        stdout
Using outfile:        ''
Using delimiter:    ;
Server version:        5.7.25-28 Percona Server (GPL), Release 28, Revision c335905
Protocol version:    10
Connection:        Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:        /tmp/mysql_sandbox5725.sock
Uptime:            3 min 42 sec

Threads: 1  Questions: 26  Slow queries: 0  Opens: 111  Flush tables: 1  Open tables: 104  Queries per second avg: 0.117
--------------

mysql [localhost:5725] {msandbox} ((none)) > 

8. Here below are a couple of useful commands to play with your MySQL instance. 
[root@centos7-test-vm msb_ps5_7_25]# sh status
msb_ps5_7_25 on

[root@centos7-test-vm msb_ps5_7_25]# sh stop
stop /root/sandboxes/msb_ps5_7_25

[root@centos7-test-vm msb_ps5_7_25]# sh start
. sandbox server started

[root@centos7-test-vm msb_ps5_7_25]# sh restart
stop /root/sandboxes/msb_ps5_7_25
. sandbox server started 





Comments

Popular

SLEEP thread causing "Waiting for table metadata lock"

MySQL Memory Calculator

errno: 24 - Too many open files

How to create CentOS VM using Vagrant

How to properly shutdown MySQL before any maintenance activity

set --server-id to enable either a master or a slave

ERROR 1040 (HY000): Too many connections

GTID Replication (Skip Transaction using empty transaction)

Master has purged binary logs containing GTIDs that the slave requires

How to Prepare for MySQL Certification Exam