Saturday, January 31, 2015

Redhat7 new features regarding Kernel


Dynamic kernel Patching

Red Hat Enterprise Linux 7 introduces kpatch, a dynamic "kernel patching utility", as a Technology Preview. kpatch allows users to manage a collection of binary kernel patches which can be used to dynamically patch the kernel without rebooting. Note that kpatch is supported to run on AMD64 and Intel 64 architectures only.

Swap Memory Compression

Red Hat Enterprise Linux 7 introduces a new feature, swap memory compression. Swap compression is performed through zswap, a thin back end for frontswap. Utilizing the swap memory compression technology ensures a significant I/O reduction and performance gains.

NUMA-Aware Scheduling and Memory Allocation

In Red Hat Enterprise Linux 7, the kernel automatically relocates processes and memory between NUMA nodes in the same system, in order to improve performance on systems with non-uniform memory access (NUMA).

XFS default filesystem for Redhat7

XFS  default filesystem for Redhat7

Introduction to Systemd

Introduction to Systemd

How to set up autofs


Plan:
a. First find your nfs share for your host.
# showmount -e nfs-server

b. Decide your mount mount point
/opt/nfs

============ Detail =================
1. Add enttry to /etc/auto.master file for your autofs

# cat /etc/auto.master
# /opt/nfs        /etc/auto.kuldeep

/opt /etc/auto.kuldeep

/opt/nfs  ==> // where are you going to mount - parent dir
/etc/auto.kuldeep ==>> define your child mount point and nfs share information

2. Define your nfs and nfs stuff
# cat /etc/auto.kuldeep
# archive         192.168.0.113:/opt/archive
nfs         192.168.0.113:/opt/archive

# check if its mounted
# df -h /opt/nfs/archive
df: `/opt/nfs/archive': No such file or directory

3. Restart autofs
# service autofs reload
Reloading maps

4. Verify the mount
#  df -hP /opt/nfs/archive
Filesystem                  Size  Used Avail Use% Mounted on
192.168.0.113:/opt/archive   18G   13G  3.7G  78% /opt/nfs/archive

Friday, January 30, 2015

What group you have access to on, check on windows machine

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
X:\>net users ramsing /domain
The request will be processed at a domain controller for domain fhlmc.com.
User name                    ramsing
Full Name                    Sing, Ram
Comment                      2013-03-12
User's comment
Country code                 000 (System Default)
Account active               Yes
Account expires              Never
Password last set            12/1/2014 2:02:56 PM
Password expires             3/1/2015 2:02:56 PM
Password changeable          12/3/2014 2:02:56 PM
Password required            Yes
User may change password     Yes
Workstations allowed         All
Logon script
User profile
Home directory               \\SENTVP212\Home\ramsing
Last logon                   1/28/2015 1:59:22 PM
Logon hours allowed          All
Local Group Memberships
Global Group memberships     *TS-RDS_LAN-ALL       *MMDP_SOFTPHONE_TT
                             *ILO_LINUX_TT         *APP_RD_UNIX_ADMIN_DEV
                             *RNDP_USER_PROD_TT    *ScreenSaver_rti_TN
                             *Domain Users         *LINUX_SERVICES_RD
                             *sysadmin             *RREN_WIN7P_USERS_RE
                             *RDNM_CYGWIN_TG       *APP_TL_UNIX_ADMIN_CE
                             *ROB_sysadmin_TG      *MMOS_FIREFOX_TE
                             *NTT_ITG_USA          *RSMP_BLTRIX_ONEERP
                             *lnxp_virtual_provisio*cw_pallg
The command completed successfully.

X:\>

General overview of the server retirement process:


General overview of the server retirement process:
==> Database retirement if present
==> Middleware retirement if present
==> Any third party software or process retirement
==> Server retirement
==> Update Remedy of Server status (Assett record updated)
==> Backup of server retirement (stop backup of the server)
==> Security and monitoring tools retirement. [ E-health, eTrust (InfoSec), best1 )
==> Storage SAN of server recovery
==> Firewall rules of server retirement
==> Facility (datacenter:- Physical and Virtual servers) retirement/removal
==> DNS retirement/update of  server:  remove the hosts only from DNS Names, IP Addresses, and switchport assignments

========== Retirement process for Unix_Admin ==============

1. Before you shutting down the server, send email notification to all concern stakeholders.
Sub: CRQ00000000001 : Server retiring today 01/16/2014
Following servers listed below are retiring Today
Server1
server2
server3
Notify NOC, monitoging team that the server is no longer available and all

2. Change the status of the asset record that server is end of life (Possibly Remedy asset record)
You may want to open a ticket to asset management team to change the status.

3. Record following information
Change ticket #
hostname
Date
ip address
storage used on the system
Remove from Mornitoring tood
HW type
Add comment if any

4. On the retirement date, shut down the server into ok prompt/Single usermode or halt for linux servers.
Plan on keeping the server in this state for around 2 weeks for non-prod and 1 months for prod.
 

Tuesday, January 27, 2015

Step by step to set up Docker on Centos 7

Playing with Docker and its fun !!!

1. Update your system up to the current patch level
# yum -y update

2. Install ducker package.
# yum -y install docker docker-registry

3. Start Docker and enable it to run upon reboot
# systemctl enable docker.service
ln -s '/usr/lib/systemd/system/docker.service' '/etc/systemd/system/multi-user.target.wants/docker.service'

# systemctl start docker.service

4. Verify that the docket service is starting
# systemctl status docker.service
docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
   Active: active (running) since Tue 2015-01-27 21:59:53 EST; 37s ago
     Docs: http://docs.docker.com

Note: you can add local user to use docket.

# id jay
uid=1001(jay) gid=1001(jay) groups=1001(jay)
# getent group docker
docker:x:990:

# usermod -aG docker jay
# id jay
uid=1001(jay) gid=1001(jay) groups=1001(jay),990(docker)

5. Download the docker container from Docker Index
# docker pull centos
Pulling repository centos
8efe422e6104: Download complete
511136ea3c5a: Download complete
5b12ef8fd570: Download complete
Status: Downloaded newer image for centos:latest

6. Verify that the images have been fetched locally.
# docker images centos
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos              centos7             8efe422e6104        3 weeks ago         224 MB
centos              latest              8efe422e6104        3 weeks ago         224 MB
centos              7                   8efe422e6104        3 weeks ago         224 MB

7. Run a basic cat command using the docker.
# docker run centos:centos7 cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core)

8. Run the docker container
[root@localhost ~]# docker run -i -t centos /bin/bash
Note: -i attaches stdin and stdout, -t allocates a tty
[root@b01e2e6f2688 /]# pwd
/
[root@b01e2e6f2688 /]# ls
bin  etc   lib    lost+found  mnt  proc  run   selinux  sys  usr
dev  home  lib64  media       opt  root  sbin  srv      tmp  var
[root@b01e2e6f2688 /]# pwd
/
[root@b01e2e6f2688 /]# cat >/test.file
This is created under docker centos
[root@b01e2e6f2688 /]#

To get out off the container ( To disconnect, or detach, from the shell )
use escape sequence Ctrl-p + Ctrl-q.

[root@b01e2e6f2688 /]#
type ctrl +p and ctrl q to exit out off the docker. or you can use the exit command

[root@localhost ~]# cat /test.file
cat: /test.file: No such file or directory
[root@localhost ~]#

9. To search the docker available, use the docker search command.

[root@localhost ~]# docker search centos
NAME                                    DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
centos                                  The official build of CentOS.                   768       [OK]


[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS                     PORTS               NAMES
b01e2e6f2688        centos:7            "/bin/bash"            7 minutes ago       Up 7 minutes                                   sad_elion
a7ce8ce380b8        centos:7            "cat /etc/centos-rel   9 minutes ago       Exited (0) 9 minutes ago                       clever_brattain


Attach a docker container

[root@localhost ~]# docker attach b01e2e6f2688

[root@b01e2e6f2688 /]#

Install git on the server
[root@b01e2e6f2688 /]# yum install git

Complete!
[root@b01e2e6f2688 /]# git --version
git version 1.8.3.1

[root@b01e2e6f2688 /]# git config --global user.name "jay"
[root@b01e2e6f2688 /]# git config --global user.email "jay@sama.expanor.local"
[root@b01e2e6f2688 /]#

[root@b01e2e6f2688 /]# cd /opt
[root@b01e2e6f2688 opt]# cd
[root@b01e2e6f2688 ~]# cat .gitconfig
[user]
        name = jay
        email = jay@sama.expanor.local
[root@b01e2e6f2688 ~]#

or
[root@b01e2e6f2688 ~]# git config --list
user.name=jay
user.email=jay@sama.expanor.local

Disconnect, or detach, from the Docker shell

CTRL+p; CTRL+q

Commit changes to Docker

[root@localhost ~]# docker commit b01e2e6f2688 my-centos-with-git
2dd94bb41bf4b96d569aed1cc5f353282e7c40bbea3948146c841c4dddeb2df7


Check the logs on the dockers
[root@localhost ~]# docker logs b01e2e6f2688  | more

Search other available dockers.
[root@localhost ~]# docker search ubuntu

[root@localhost ~]# docker pull ubuntu
Pulling repository ubuntu
b39b81afc8ca: Download complete
511136ea3c5a: Download complete
53f858aaaf03: Download complete
837339b91538: Download complete
615c102e2290: Download complete
Status: Downloaded newer image for ubuntu:latest
[root@localhost ~]#

root@localhost ~]# docker pull fedora
Pulling repository fedora
834629358fe2: Download complete
511136ea3c5a: Download complete
00a0c78eeb6d: Download complete
Status: Downloaded newer image for fedora:latest
[root@localhost ~]#


[root@localhost ~]# docker images fedora
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
fedora              21                  834629358fe2        3 weeks ago         250.2 MB
fedora              latest              834629358fe2        3 weeks ago         250.2 MB
[root@localhost ~]#


[root@localhost ~]# docker images ubuntu
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
ubuntu              14.04               b39b81afc8ca        11 days ago         192.7 MB
ubuntu              14.04.1             b39b81afc8ca        11 days ago         192.7 MB
ubuntu              latest              b39b81afc8ca        11 days ago         192.7 MB
ubuntu              trusty              b39b81afc8ca        11 days ago         192.7 MB
[root@localhost ~]#


Login to UbuntU docker.

[root@localhost ~]# docker run -i -t ubuntu /bin/bash
root@0303170b0c59:/# pwd
/
root@0303170b0c59:/# cat >/test.me
This is docker UbuntU
root@0303170b0c59:/# df -h .
Filesystem                                                                                         Size  Used Avail Use% Mounted on
/dev/mapper/docker-253:1-3149016-0303170b0c59d20c65b4babfc755be19bb42809a932fd848790cfacfbde1590c  9.8G  245M  9.0G   3% /
root@0303170b0c59:/#

[root@localhost ~]# cat /test.me
cat: /test.me: No such file or directory
[root@localhost ~]#


[root@localhost ~]# su - jay
[jay@localhost ~]$ docker ps -l
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                          PORTS               NAMES
0303170b0c59        ubuntu:14.04        "/bin/bash"         2 minutes ago       Exited (0) About a minute ago                       stoic_wozniak
[jay@localhost ~]$


Sunday, January 25, 2015

nfs and CIFS

On server
1. export your share to other hosts
# cat >/etc/exports
/opt/share *(rw,sync)
# service nfs reload
# exportfs -->> verify your share is exported to other hosts

On client
1. Get the share for this system from remote server
# showmmount -e nfsserver
2. Create mount point
# mkdir /mynfs
3. Mount your remote share
# mount nfsserver:/sharename /mnt

=====================
CIFS
On your windows machine
1. Create a directory and share it

On your linux Machine
1. Install samba client
2. List the windows share
[root@localhost html]# smbclient -U admin -L 192.168.0.144
Enter admin's password:
session request to 192.168.0.144 failed (Called name not present)
Domain=[ADMIN-HP] OS=[Windows 7 Professional 7601 Service Pack 1] Server=[Windows 7 Professional 6.1]
 Sharename       Type      Comment
 Users           Disk     
3. Mount the share
# mount -o username=admin //192.168.0.144/Users /mnt
 

Monday, January 19, 2015

Unable To Disable Windows 8 Proxy Setting

Unable To Disable Windows 8 Proxy Setting
Some how my PC virus and had pretty hard time to remove it. Finally I removed it but it set up a proxy which force to go to internet through proxy. I had very hard time not being able to remove proxy setting on my Windows 8 machine. Once I tried removing proxy setting, from Internet setting tools -> Internet Options ->> Connection -->> LAN setting and unchecking the proxy setting; it didn't help me at all. But new line on the Internet properties windows, I see, some settings are managed by your system administrator. I am login as administrator and I felt that option should not be there.

internet explorer didn't allow me to go to internet. I use crom and it also uses the system (IE ) proxy setting and could not by pass. But the good part is that Firefox has advance setting which allow to by pass the system proxy.

After some googling, I found a post here who also had same problem and it fixed my issue.

http://fixedit.itxpress.biz/2014/10/08/unable-to-disable-windows-proxy-setting/
open your regiestry file and change the value of the proxy setting as follow.
click on start ->> run and type regedit -->> and go to following location.
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\
CurrentVersion\Internet Settings
Once you click on Internet settings,  you will see ProxySettingsPerUser on the right Pane.
Double click on ProxySettingsPerUser and you will see a value on 0. Change the value to 1. You don't have to save or anything.
At the same time, open your internet explorer or crom and try to access the websites, yo should be able to access it.
Now, go back to your registry editor and save your current setting so that if you have any issue in the future, you can restore it.
click on file ->> export and specify the location where you want to same your registry back up file. save it with name_today's_date .
have fun !!!

Monday, January 12, 2015

How to upload file (such as ISO image file) to datastore

1. Login to the VMware vSphere web client.

2. Go to the datastore cluster.

3. Select the datastore where you want to upload the file.

4. Click on the file then upload what you want to upload into datastore.

Friday, January 9, 2015

Step by step guide to install Centos 7 on VMware ESXI


Step by step guide to install Centos 7 on VMware ESXI

1. Download the netInstaller and centos 7 from centos.org.
Please select x86_64 version
2. Copy the your OS image and mount it to your webserver. copy all the contents to your web server.
3. Start your ESXI host and open y our VMware Vsphere client and login.
4. Create your VM using your VMware client
5. Boot the host and

Thursday, January 8, 2015

playing with esxi server


~ # vifp --help
-sh: vifp: not found
~ # vi
vi       vim-cmd
~ # vi --help
BusyBox v1.20.2 (2012-12-11 11:54:28 PST) multi-call binary.

Usage: vi [OPTIONS] [FILE]...

Edit FILE

        -c      Initial command to run ($EXINIT also available)
        -R      Read-only
        -H      Short help regarding available features

~ # vim-cmd --help
Invalid option specified '--help'.  Only single options are supported.
Usage: vim-cmd [options]... command [cmd_arg1] [cmd_arg2] ...
Options:
   -h                Display this help message and exit
   -v                Display version information and exit
   -H <host>         Host name to connect
   -O <port>         Port number to connect
   -t <thumbprint>   Expected thumbprint of the specified host
   -U <user>         User name to use for login
   -P <pass>         Password to use for login
   -d <level>        Show verbose debug output. (info, verbose, trivia)

Use the help command to get information on the commands available.

   vim-cmd help [command]
~ # vim-cmd -help
Invalid option specified '-help'.  Only single options are supported.
Usage: vim-cmd [options]... command [cmd_arg1] [cmd_arg2] ...
Options:
   -h                Display this help message and exit
   -v                Display version information and exit
   -H <host>         Host name to connect
   -O <port>         Port number to connect
   -t <thumbprint>   Expected thumbprint of the specified host
   -U <user>         User name to use for login
   -P <pass>         Password to use for login
   -d <level>        Show verbose debug output. (info, verbose, trivia)

Use the help command to get information on the commands available.

   vim-cmd help [command]
~ # vi -h
BusyBox v1.20.2 (2012-12-11 11:54:28 PST) multi-call binary.

Usage: vi [OPTIONS] [FILE]...

Edit FILE

        -c      Initial command to run ($EXINIT also available)
        -R      Read-only
        -H      Short help regarding available features

~ # esxcli
Usage: esxcli [options] {namespace}+ {cmd} [cmd options]

Options:
  --formatter=FORMATTER
                        Override the formatter to use for a given command. Available formatter: xml, csv, keyvalue
  --debug               Enable debug or internal use options
  --version             Display version information for the script
  -?, --help            Display usage information for the script

Available Namespaces:
  device                Device manager commands
  esxcli                Commands that operate on the esxcli system itself allowing users to get additional
                        information.
  fcoe                  VMware FCOE commands.
  graphics              VMware graphics commands.
  hardware              VMKernel hardware properties and commands for configuring hardware.
  iscsi                 VMware iSCSI commands.
  network               Operations that pertain to the maintenance of networking on an ESX host. This includes a
                        wide variety of commands to manipulate virtual networking components (vswitch, portgroup,
                        etc) as well as local host IP, DNS and general host networking settings.
  sched                 VMKernel system properties and commands for configuring scheduling related functionality.
  software              Manage the ESXi software image and packages
  storage               VMware storage commands.
  system                VMKernel system properties and commands for configuring properties of the kernel core
                        system.
  vm                    A small number of operations that allow a user to Control Virtual Machine operations.
  vsan                  VMware VSAN commands.

~ # esxcli network nic list
Name    PCI Device     Driver  Link  Speed  Duplex  MAC Address         MTU  Description                            
------  -------------  ------  ----  -----  ------  -----------------  ----  ---------------------------------------------------------------------------
vmnic0  0000:003:00.0  bnx2    Up      100  Full    00:1c:c4:aa:33:48  1500  Broadcom Corporation NC373i Integrated Multifunction Gigabit Server Adapter
vmnic1  0000:014:01.0  e1000   Down      0  Full    00:04:23:b3:c8:74  1500  Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)
vmnic2  0000:014:01.1  e1000   Down      0  Full    00:04:23:b3:c8:75  1500  Intel Corporation 82546EB Gigabit Ethernet Controller (Copper)
~ # esxcli hardware cpu list
CPU:0
   Id: 0
   Package Id: 0
   Family: 6
   Model: 15
   Type: 0
   Stepping: 11
   Brand: GenuineIntel
   Core Speed: 2000070797
   Bus Speed: 333345078
   APIC ID: 0x0
   Node: 0
   L2 Cache Size: 4194304
   L2 Cache Associativity: 16
   L2 Cache Line Size: 64
   L2 Cache CPU Count: 2
   L3 Cache Size: -1
   L3 Cache Associativity: -1
   L3 Cache Line Size: -1
   L3 Cache CPU Count: 2

CPU:1
   Id: 1
   Package Id: 0
   Family: 6
   Model: 15
   Type: 0
   Stepping: 11
   Brand: GenuineIntel
   Core Speed: 2000070797
   Bus Speed: 333345078
   APIC ID: 0x1
   Node: 0
   L2 Cache Size: 4194304
   L2 Cache Associativity: 16
   L2 Cache Line Size: 64
   L2 Cache CPU Count: 2
   L3 Cache Size: -1
   L3 Cache Associativity: -1
   L3 Cache Line Size: -1
   L3 Cache CPU Count: 2

CPU:2
   Id: 2
   Package Id: 0
   Family: 6
   Model: 15
   Type: 0
   Stepping: 11
   Brand: GenuineIntel
   Core Speed: 2000070797
   Bus Speed: 333345078
   APIC ID: 0x2
   Node: 0
   L2 Cache Size: 4194304
   L2 Cache Associativity: 16
   L2 Cache Line Size: 64
   L2 Cache CPU Count: 2
   L3 Cache Size: -1
   L3 Cache Associativity: -1
   L3 Cache Line Size: -1
   L3 Cache CPU Count: 2

CPU:3
   Id: 3
   Package Id: 0
   Family: 6
   Model: 15
   Type: 0
   Stepping: 11
   Brand: GenuineIntel
   Core Speed: 2000070797
   Bus Speed: 333345078
   APIC ID: 0x3
   Node: 0
   L2 Cache Size: 4194304
   L2 Cache Associativity: 16
   L2 Cache Line Size: 64
   L2 Cache CPU Count: 2
   L3 Cache Size: -1
   L3 Cache Associativity: -1
   L3 Cache Line Size: -1
   L3 Cache CPU Count: 2
~ # esxcli hardware memory get
   Physical Memory: 17177657344 Bytes
   Reliable Memory: 0 Bytes
   NUMA Node Count: 1
~ # esxcli hardware platform get
Platform Information
   UUID: 0x34 0x37 0x30 0x30 0x36 0x34 0x4d 0x58 0x51 0x37 0x34 0x32 0x30 0x30 0x55 0x38
   Product Name: ProLiant ML350 G5
   Vendor Name: HP
   Serial Number: MXQ74200U8
   IPMI Supported: true
~ # esxcli hardware clock get
2008-01-13T19:52:17Z
~ # esxcli system version get
   Product: VMware ESXi
   Version: 5.5.0
   Build: Releasebuild-1623387
   Update: 1
~ # esxcli system boot device get
   Boot Filesystem UUID: e86ae075-6b0df33b-00f3-8b9966c0bf2e
   Boot NIC:
   Stateless Boot NIC:
~ # esxcli vm process list
~ #


Tuesday, January 6, 2015

Playing around with MariaDB

[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 ~]#





[root@localhost ~]# mysql --user=jay mysql
ERROR 1045 (28000): Access denied for user 'jay'@'localhost' (using password: NO)
[root@localhost ~]# mysql --user=root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)


[root@localhost ~]# mysqladmin -u root password abc1234
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
[root@localhost ~]# /etc/init.d/mysql stop
-bash: /etc/init.d/mysql: No such file or directory


[root@localhost ~]# systemctl stop mariadb
[root@localhost ~]# mysqld
mysqld_multi   mysqld_safe    mysqldump      mysqldumpslow
[root@localhost ~]# mysqld_safe --skip-grant-tables &
[1] 14614
[root@localhost ~]# 150106 23:37:14 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
150106 23:37:14 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[root@localhost ~]# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.40-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

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

MariaDB [(none)]>

MariaDB [(none)]> UPDATE mysql.user SET Password=PASSWORD('peacesoul') WHERE User='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 3  Changed: 0  Warnings: 0

MariaDB [(none)]>


[root@localhost ~]# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.40-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

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

MariaDB [(none)]> UPDATE mysql.user SET Password=PASSWORD('peacesoul') WHERE User='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 3  Changed: 0  Warnings: 0

MariaDB [(none)]> use test
Database changed
MariaDB [test]> create database sama_data
    -> ;
Query OK, 1 row affected (0.01 sec)

MariaDB [test]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sama_data          |
| test               |
+--------------------+
5 rows in set (0.00 sec)

MariaDB [test]> use mysql
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
MariaDB [mysql]> create database suvidb
    -> ;
Query OK, 1 row affected (0.00 sec)

MariaDB [mysql]> show datbases;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'datbases' at line 1
MariaDB [mysql]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sama_data          |
| suvidb             |
| test               |
+--------------------+
6 rows in set (0.00 sec)

MariaDB [mysql]>


[root@localhost ~]# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.40-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

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

MariaDB [(none)]> UPDATE mysql.user SET Password=PASSWORD('peacesoul') WHERE User='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 3  Changed: 0  Warnings: 0

MariaDB [(none)]> use test
Database changed
MariaDB [test]> create database sama_data
    -> ;
Query OK, 1 row affected (0.01 sec)

MariaDB [test]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sama_data          |
| test               |
+--------------------+
5 rows in set (0.00 sec)

MariaDB [test]> use mysql
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
MariaDB [mysql]> create database suvidb
    -> ;
Query OK, 1 row affected (0.00 sec)

MariaDB [mysql]> show datbases;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'datbases' at line 1
MariaDB [mysql]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sama_data          |
| suvidb             |
| test               |
+--------------------+
6 rows in set (0.00 sec)

MariaDB [mysql]>




[root@localhost ~]# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.40-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

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

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sama_data          |
| suvidb             |
| test               |
+--------------------+
6 rows in set (0.00 sec)

MariaDB [(none)]> use suvidb
Database changed
MariaDB [suvidb]> create table employee (
    -> tid bigint not null auto_increment,
    -> fname varchar(100) not null,
    -> lname varchar(100) not null,
    -> city text not null,
    -> primary key(tid),
    -> index ix_fname_tid (fname, tid)
    -> ) ENGINE=InnoDB;
Query OK, 0 rows affected (0.10 sec)

MariaDB [suvidb]> show create table employee;
+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table    | Create Table                                                                                                                                                                                                                                                       |
+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| employee | CREATE TABLE `employee` (
  `tid` bigint(20) NOT NULL AUTO_INCREMENT,
  `fname` varchar(100) NOT NULL,
  `lname` varchar(100) NOT NULL,
  `city` text NOT NULL,
  PRIMARY KEY (`tid`),
  KEY `ix_fname_tid` (`fname`,`tid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

MariaDB [suvidb]> desc employee;
+-------+--------------+------+-----+---------+----------------+
| Field | Type         | Null | Key | Default | Extra          |
+-------+--------------+------+-----+---------+----------------+
| tid   | bigint(20)   | NO   | PRI | NULL    | auto_increment |
| fname | varchar(100) | NO   | MUL | NULL    |                |
| lname | varchar(100) | NO   |     | NULL    |                |
| city  | text         | NO   |     | NULL    |                |
+-------+--------------+------+-----+---------+----------------+
4 rows in set (0.03 sec)

MariaDB [suvidb]> create table test1 (field1 int, field2 enum('red', 'green'));
Query OK, 0 rows affected (0.00 sec)

MariaDB [suvidb]> desc test1
    -> ;
+--------+---------------------+------+-----+---------+-------+
| Field  | Type                | Null | Key | Default | Extra |
+--------+---------------------+------+-----+---------+-------+
| field1 | int(11)             | YES  |     | NULL    |       |
| field2 | enum('red','green') | YES  |     | NULL    |       |
+--------+---------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

MariaDB [suvidb]> alter online table test1 modify field2 enum('red','green','blue');
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [suvidb]> alter online table test1 add field3 int;
ERROR 1915 (HY000): Can't execute the given 'ALTER' command as online
MariaDB [suvidb]>



MariaDB [suvidb]> alter online table test1 add field3 int;
ERROR 1915 (HY000): Can't execute the given 'ALTER' command as online
MariaDB [suvidb]> alter table test1 add created datetime not null;
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [suvidb]> alter table test1 add index ix_created (created);
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [suvidb]> desc test1;
+---------+----------------------------+------+-----+---------+-------+
| Field   | Type                       | Null | Key | Default | Extra |
+---------+----------------------------+------+-----+---------+-------+
| field1  | int(11)                    | YES  |     | NULL    |       |
| field2  | enum('red','green','blue') | YES  |     | NULL    |       |
| created | datetime                   | NO   | MUL | NULL    |       |
+---------+----------------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

MariaDB [suvidb]>


MariaDB [suvidb]> create table tab_test (
    -> fd1 int not null,
    -> fd2 varchar(50),
    -> primary key(fd1)) engine=innodb;
Query OK, 0 rows affected (0.01 sec)

MariaDB [suvidb]> insert into tab_test (fd1, fd2) values (1, 'John');
Query OK, 1 row affected (0.00 sec)

MariaDB [suvidb]> insert into tab_test values (2, 'Mark');
Query OK, 1 row affected (0.01 sec)

MariaDB [suvidb]> insert into tab_test(fd1, fd2)
    -> values (3, 'Bill') on duplicate key update fd2='Bill';
Query OK, 1 row affected (0.00 sec)

MariaDB [suvidb]> insert into tab_test(fd1, fd2)
    -> values (3, 'RamSing') on duplicate key update fd2='RamSing';
Query OK, 2 rows affected (0.00 sec)

MariaDB [suvidb]> select * from tab_test;
+-----+---------+
| fd1 | fd2     |
+-----+---------+
|   1 | John    |
|   2 | Mark    |
|   3 | RamSing |
+-----+---------+
3 rows in set (0.00 sec)

MariaDB [suvidb]>


MariaDB [suvidb]> select * from tab_test\G;
*************************** 1. row ***************************
fd1: 1
fd2: John
*************************** 2. row ***************************
fd1: 2
fd2: Mark
*************************** 3. row ***************************
fd1: 3
fd2: RamSing
3 rows in set (0.00 sec)

ERROR: No query specified

MariaDB [suvidb]>


MariaDB [suvidb]> update tab_test set fd2='Brian' where fd1=1;
Query OK, 1 row affected (0.03 sec)
Rows matched: 1  Changed: 1  Warnings: 0

MariaDB [suvidb]> select * from tab_test where fd1=1;
+-----+-------+
| fd1 | fd2   |
+-----+-------+
|   1 | Brian |
+-----+-------+
1 row in set (0.02 sec)

MariaDB [suvidb]> select * from tab_test where fd1=1
    -> ;
+-----+-------+
| fd1 | fd2   |
+-----+-------+
|   1 | Brian |
+-----+-------+
1 row in set (0.00 sec)

MariaDB [suvidb]> update tab_test set fd2='brian';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

MariaDB [suvidb]> select * from tab_test;
+-----+-------+
| fd1 | fd2   |
+-----+-------+
|   1 | brian |
|   2 | brian |
|   3 | brian |
+-----+-------+
3 rows in set (0.00 sec)

MariaDB [suvidb]> replace tab_test set fd1=1, fd2='Matt';
Query OK, 2 rows affected (0.00 sec)

MariaDB [suvidb]> select * from tab_test where fd1=1;
+-----+------+
| fd1 | fd2  |
+-----+------+
|   1 | Matt |
+-----+------+
1 row in set (0.00 sec)

MariaDB [suvidb]> delete from tab_test where fd1=1;
Query OK, 1 row affected (0.00 sec)

MariaDB [suvidb]> select * from tab_test;
+-----+-------+
| fd1 | fd2   |
+-----+-------+
|   2 | brian |
|   3 | brian |
+-----+-------+
2 rows in set (0.00 sec)

MariaDB [suvidb]>

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 ~]#









Saturday, January 3, 2015

How to wipe out disk on Solaris OE?

How to wipe out Solaris disks?
#!/usr/bin/ksh
 # wipeall.sh
 ## The purpose of this script is for mass disk erasing.
 # It is designed to wipe ALL disks attached to the server, except for
 # the boot disks (/dev/rdsk/c0*). If you are booting from a different
 # controller, be sure to set the BOOT variable below!
 #
 # wipeall.sh uses dd to copy /dev/zero to the entire raw disk device.
 # ################################################################################
 BOOT=c0
 LOG="tee -a wipelog.txt"
 if [ -e wipelog.txt ]; then
 echo Found old wipelog.txt, clearing log. | $LOG
 rm -f wipelog.txt
 touch wipelog.txt
 fi
 echo -n Standby while cleaning up device links... |$LOG
 #/usr/sbin/devfsadm -C -v | $LOG
 echo OK |tee -a wipelog.txt
 DISKS=`find /dev/rdsk -name \*d0s2 -exec basename {} \; |grep -v $BOOT`
 # Did we actually find any disks? If not lets stop now.
 if [ -z "$DISKS" ]; then
 echo "Whoops! NO Disks Found (besides the boot disks)!" |$LOG
 echo "Aborting." | $LOG
 exit 1;
 fi
 echo "Found the following disks (minus boot array disks):" |$LOG
 echo "$DISKS" | $LOG
 echo -n "Do you wish to proceed with erasing these disks? (Y/N) " |$LOG
 read continue
 if ( [ "$continue" == "Y" ] || [ "$continue" == "y" ] ); then
 echo "" | $LOG
 echo `date` Proceeding to wipe all disks. | $LOG
 for DISK in $DISKS
 do
 echo "-----------------------------------------------------------" | $LOG
 echo Starting wipe of /dev/rdsk/$DISK at: `date` | $LOG
 dd bs=128k if=/dev/zero of=/dev/rdsk/$DISK 2>&1 |$LOG
 echo Completed wipe at: `date` | $LOG
 done
 echo "============================================================" | $LOG
 echo `date` All disks wiped. | $LOG
 /usr/bin/mailx -s "Disk Wipe Report" sysadmin@yourdomain.com
 else
 echo “User aborted.” | $LOG
 exit
 fi

source: unknown

find and scp file to another host

$ ls -laih  file.outernet.log
22806


$ find . -inum 22806 -exec scp {} jay@192.168.10.110:/opt/apps/ \;
$ find $DIR -type f -mtime +$DAYS -exec scp -r -p -P52900 {} jay@192.168.10.110:/opt/data/ \; &

tcpdump info

tcpdump info

Commands for hardware info on Redhat

Hardware info on Linux host.

$ lspci
$ lspci -v
$ multipath -ll
$ systool –c fc_host
$ smartctl -a /dev/had
$ ethtool
$ mii-tool; mii-diag
$ free
$ cat /proc/meminfo
$ cat /proc/cpuinfo

# dmidecode
# fdisk -l

How to probe HBA on redhat?

How to probe Linux HBA ?

#!/bin/ksh
for i in `systool -c fc_host | grep "^    Device =" | awk '{print $3}' |awk -F\" '{print $2}'`
do
echo "echo \"- - -\" > /sys/class/scsi_host/$i/scan"
done

for i in `systool -c fc_host | grep "^    Device =" | awk '{print $3}' |awk -F\" '{print $2}'`; do echo "echo \"- - -\" > /sys/class/scsi_host/$i/scan"; done

LVM disk striping

Add newly added luns to /etc/multipath.conf file to make MD devices...
# vgcreate -s 128M SANvg11 /dev/mapper/MDDISK05p1 /dev/mapper/MDDISK06p1 /dev/mapper/MDDISK07p1 /dev/mapper/MDDISK08p1
# lvcreate -i4 -I128 -L402G -n DATA11 SANvg11 /dev/mapper/MDDISK05p1 /dev/mapper/MDDISK06p1 /dev/mapper/MDDISK07p1 /dev/mapper/MDDISK08p1
# mkfs.ext4 /dev/SANvg11/DATA11

Add entry to fstab
# mount -a
# chown obdata:obgrp  /opt/data11

# ls -ld   /opt/data11
# lvs -a -o +devices | grep SANvg
# vgdisplay SANvg11 

Linux system performance ..

# systool -c scsi_host -v | grep -v npiv |egrep "Class Device =|info|lpfc_drvr_version"

Disk size on Redhat

fdisk -l 2>/dev/null| grep Disk | awk '{sum+=$3}END{print sum"GB"}'

fdisk -l 2>/dev/null| grep Disk | grep -v "MB" |awk '{sum+=$3}END{print sum"GB"}'

Multipath

#!/bin/ksh
for i in `ls -l /dev/mapper | grep 3600 |awk '{print $10}'`;
do
echo -ne "$i : \c";
echo -ne "LUN: `multipath -ll $i| grep -A 3 $i| grep sd | awk '{print $2}' | awk -F: '{print $4}'` :\c";
echo -ne "WWID: \c"
/sbin/scsi_id -gus /block/`multipath -ll $i | grep -A 3 dm- | grep sd | awk '{print $3}'`
done