Tuesday, January 6, 2015

Installing MariaDB on CentOS7

[root@localhost opt]# mkdir OS_Image
[root@localhost opt]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   18G  3.4G   15G  20% /
devtmpfs                 487M     0  487M   0% /dev
tmpfs                    496M   92K  496M   1% /dev/shm
tmpfs                    496M  7.1M  489M   2% /run
tmpfs                    496M     0  496M   0% /sys/fs/cgroup
/dev/sda1                497M  134M  363M  27% /boot
/dev/sr0                 3.9G  3.9G     0 100% /run/media/devi/CentOS 7 x86_64
[root@localhost opt]# pwd
/opt
[root@localhost opt]# cd OS_Image/
[root@localhost OS_Image]# cd /run/media/devi/CentOS\ 7\ x86_64/
[root@localhost CentOS 7 x86_64]# ls
CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7
EULA             isolinux  repodata  TRANS.TBL
[root@localhost CentOS 7 x86_64]# cp -rp * /opt/OS_Image/
[root@localhost CentOS 7 x86_64]# pwd
/run/media/devi/CentOS 7 x86_64
[root@localhost CentOS 7 x86_64]# vi /etc/yum.repos.d/file.repo^C
[root@localhost CentOS 7 x86_64]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Sources.repo  CentOS-Vault.repo
[root@localhost yum.repos.d]# vi file.repo
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, langpacks
RHEL7                                                               | 3.6 kB  00:00:00    
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
RHEL7/primary_db                                                    | 2.7 MB  00:00:00    
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
repo id                                  repo name                                   status
RHEL7                                    Centos 7 repo                               3,538
base/7/x86_64                            CentOS-7 - Base                                 0
extras/7/x86_64                          CentOS-7 - Extras                               0
updates/7/x86_64                         CentOS-7 - Updates                              0
repolist: 3,538
[root@localhost yum.repos.d]# ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether 00:0c:29:3d:f8:fa  txqueuelen 1000  (Ethernet)
        RX packets 199  bytes 18834 (18.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 658  bytes 57212 (55.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 658  bytes 57212 (55.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost yum.repos.d]# service network status
Configured devices:
lo ens33
Currently active devices:
lo ens33
[root@localhost yum.repos.d]# ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.10.43  netmask 255.255.255.0  broadcast 192.168.10.255
        inet6 fe80::20c:29ff:fe3d:f8fa  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:3d:f8:fa  txqueuelen 1000  (Ethernet)
        RX packets 272  bytes 27076 (26.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 56  bytes 6948 (6.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 0  (Local Loopback)
        RX packets 662  bytes 57632 (56.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 662  bytes 57632 (56.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@localhost yum.repos.d]#




[root@localhost ~]# yum search mariadb

Install db packages

[root@localhost ~]# yum install mariadb mariadb-server

enable to available upon reboot

[root@localhost ~]# systemctl enable mariadb
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'
[root@localhost ~]# ls -l /usr/lib/systemd/system/mariadb.service /etc/systemd/system/multi-user.target.wants/mariadb.service
lrwxrwxrwx. 1 root root   39 Jan  6 22:58 /etc/systemd/system/multi-user.target.wants/mariadb.service -> /usr/lib/systemd/system/mariadb.service
-rw-r--r--. 1 root root 1697 Nov 17 07:28 /usr/lib/systemd/system/mariadb.service
[root@localhost ~]#

[root@localhost ~]# systemctl status mariadb
mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
   Active: inactive (dead)

[root@localhost ~]#

[root@localhost ~]# systemctl start mariadb
[root@localhost ~]# systemctl status mariadb
mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
   Active: active (running) since Tue 2015-01-06 23:00:46 EST; 4s ago



[root@localhost ~]# mysql_secure_installation
/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@localhost ~]# firewall-c
firewall-cmd     firewall-config
[root@localhost ~]# firewall-cmd --permanent --add-service==mysql
Error: INVALID_SERVICE: =mysql
[root@localhost ~]# firewall-cmd --permanent --add-service=mysql
success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]#









No comments:

Post a Comment