标签:
一、安装前提(准备数据文件、安装其他依赖的软件)
1、准备数据存放的目录
[root@localhost ~]# fdisk /dev/sdb (fdisk /dev/sdb 创建一个逻辑分区/dev/sdb1)
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xa592b386.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won‘t be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It‘s strongly recommended to
switch off the mode (command ‘c‘) and change display units to
sectors (command ‘u‘).
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-652, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652): +2G
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks
[root@localhost ~]# fdisk -l
Disk /dev/sda: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000bd13b
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 1959 15215616 8e Linux LVM
Disk /dev/sdb: 5368 MB, 5368709120 bytes
255 heads, 63 sectors/track, 652 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa592b386
Device Boot Start End Blocks Id System
/dev/sdb1 1 262 2104483+ 83 Linux
Disk /dev/mapper/VolGroup-lv_root: 14.0 GB, 13967032320 bytes
255 heads, 63 sectors/track, 1698 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/VolGroup-lv_swap: 1610 MB, 1610612736 bytes
255 heads, 63 sectors/track, 195 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal):
[root@localhost ~]# pvcreate /dev/sdb1(创建逻辑卷)
Physical volume "/dev/sdb1" successfully created
[root@localhost ~]# vgcreate myng /dev/sdb1
Volume group "myng" successfully created
[root@localhost ~]# lvcreate -L 1G -n mydata /dev/myng
Logical volume "mydata" created.
[root@localhost ~]# mke2fs -t ext4 /dev/myng/mydata (格式化逻辑卷)
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
13107 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
正在写入inode表: 完成
Creating journal (8192 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost ~]# mkdir -pv /mydata/data
mkdir: 已创建目录 "/mydata"
mkdir: 已创建目录 "/mydata/data"
[root@localhost ~]# mkdir -pv /mydata/data (创建数据目录)
mkdir: 已创建目录 "/mydata"
mkdir: 已创建目录 "/mydata/data"
[root@localhost ~]# vim /etc/fstab (挂载逻辑卷到数据目录,并添加到开机自动挂载)
#
# /etc/fstab
# Created by anaconda on Thu Dec 31 06:00:39 2015
#
# Accessible filesystems, by reference, are maintained under ‘/dev/disk‘
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1
UUID=8da37a95-1c26-48ab-8f4c-216c4eab8c18 /boot ext4 defaults 1 2
/dev/mapper/VolGroup-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/myng/mydata /mydata/data ext4 defaults 0 0
2、安装依赖的软件包
[root@localhost ~]# yum -y install readline-devel zlib-devel openssl-devel cmake gcc-c++ gcc boost boost-devel bison bison-devel
二、编译安装mariadb
1、软件下载
[root@localhost ~]# wget http://archive.mariadb.org//mariadb-5.5.45/source/mariadb-5.5.45.tar.gz
2、如何查看maridb编译的参数
[root@localhost ~]# tar xf mariadb-5.5.45.tar.gz
[root@localhost ~]# cd mariadb-5.5.45
[root@localhost mariadb-5.5.45]# cmake . -LH
常见的编译参数如下:
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql
[root@localhost mariadb-5.5.45]# make && make install
三、配置maridb服务
1、创建mysql用户与组
[root@localhost ~]#groupadd -r mysql 创建mysql组
Linux命令行输入命令执行后报“bash:....:command not found”这是由于系统PATH设置问题,PATH没有设置对,系统就无法找到精确命令了。
标签:
原文地址:http://www.cnblogs.com/louis2008/p/mariadb.html