Linux 716 数据库迁移

发布于:2025-07-17 ⋅ 阅读:(13) ⋅ 点赞:(0)
root@192.168.235.20's password:
     ┌────────────────────────────────────────────────────────────────────┐
     │                        • MobaXterm 20.0 •                          │
     │            (SSH client, X-server and networking tools)             │
     │                                                                    │
     │ ➤ SSH session to root@192.168.235.20                               │
     │   • SSH compression : ✘                                            │
     │   • SSH-browser     : ✔                                            │
     │   • X11-forwarding  :(remote display is forwarded through SSH) │
     │   • DISPLAY         :(automatically set on remote server)      │
     │                                                                    │
     │ ➤ For more info, ctrl+click on help or visit our website           │
     └────────────────────────────────────────────────────────────────────┘

Last login: Tue Jul 15 19:01:41 2025 from 192.168.235.1
[root@web ~]# hostname
web.cn
[root@web ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part /u01
├─sdb2            8:18   0    1G  0 part /u2
├─sdb3            8:19   0    1G  0 part /u05/test
├─sdb4            8:20   0    1K  0 part
├─sdb5            8:21   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm  /u06
├─sdb6            8:22   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm  /u06
├─sdb7            8:23   0    1G  0 part
│ ├─vg01-lv01   253:2    0  3.1G  0 lvm  /u06
│ ├─vg01-lv02   253:3    0  120M  0 lvm
│ └─vg01-lv03   253:4    0   36M  0 lvm
├─sdb8            8:24   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm  /u06
└─sdb9            8:25   0  900M  0 part
sr0              11:0    1  4.4G  0 rom  /mnt
您在 /var/spool/mail/root 中有新邮件
[root@web ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  centos   1   2   0 wz--n- <19.00g      0
  vg01     4   3   0 wz--n-   3.98g 764.00m
[root@web ~]# pvs
  PV         VG     Fmt  Attr PSize    PFree
  /dev/sda2  centos lvm2 a--   <19.00g      0
  /dev/sdb5  vg01   lvm2 a--  1020.00m 724.00m
  /dev/sdb6  vg01   lvm2 a--  1020.00m      0
  /dev/sdb7  vg01   lvm2 a--  1020.00m  40.00m
  /dev/sdb8  vg01   lvm2 a--  1020.00m      0
[root@web ~]# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- <17.00g
  swap centos -wi-ao----   2.00g
  lv01 vg01   -wi-ao----  <3.09g
  lv02 vg01   -wi-a----- 120.00m
  lv03 vg01   -wi-a-----  36.00m
[root@web ~]#
[root@web ~]# reboot

MySQL数据迁移

新建磁盘

在这里插入图片描述

磁盘分区

fdisk /dev/sdbc

[root@web ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part
├─sdb2            8:18   0    1G  0 part /u2
├─sdb3            8:19   0    1G  0 part
├─sdb4            8:20   0    1K  0 part
├─sdb5            8:21   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb6            8:22   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb7            8:23   0    1G  0 part
│ ├─vg01-lv01   253:2    0  3.1G  0 lvm
│ ├─vg01-lv02   253:3    0  120M  0 lvm
│ └─vg01-lv03   253:4    0   36M  0 lvm
├─sdb8            8:24   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
└─sdb9            8:25   0  900M  0 part
sdc               8:32   0   10G  0 disk
sr0              11:0    1  4.4G  0 rom  /mnt
您在 /var/spool/mail/root 中有新邮件
[root@web ~]# fdisk -l

磁盘 /dev/sdb:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x4f05a8ca

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     2099199     1048576   83  Linux
/dev/sdb2         2099200     4196351     1048576   83  Linux
/dev/sdb3         4196352     6293503     1048576   83  Linux
/dev/sdb4         6293504    16779263     5242880    5  Extended
/dev/sdb5         6295552     8392703     1048576   83  Linux
/dev/sdb6         8394752    10491903     1048576   83  Linux
/dev/sdb7        10493952    12591103     1048576   83  Linux
/dev/sdb8        12593152    14690303     1048576   83  Linux
/dev/sdb9        14692352    16535551      921600   83  Linux

磁盘 /dev/sda:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x0009cef4

   设备 Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    41943039    19921920   8e  Linux LVM

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/centos-root:18.2 GB, 18249416704 字节,35643392 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/vg01-lv01:3313 MB, 3313500160 字节,6471680 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/vg01-lv02:125 MB, 125829120 字节,245760 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/vg01-lv03:37 MB, 37748736 字节,73728 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节

[root@web ~]# fdisk /dev/sdc
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0x14965c09 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-20971519,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-20971519,默认为 20971519):+2G
分区 1 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
分区号 (2-4,默认 2):
起始 扇区 (4196352-20971519,默认为 4196352):
将使用默认值 4196352
Last 扇区, +扇区 or +size{K,M,G} (4196352-20971519,默认为 20971519):+2G
分区 2 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x14965c09

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x14965c09

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux

命令(输入 m 获取帮助):N
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): E
分区号 (3,4,默认 3):
起始 扇区 (8390656-20971519,默认为 8390656):
将使用默认值 8390656
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+7G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6H
不支持的后缀:“H”。
支持:10^N: KB (千字节), MB (兆字节), GB (吉字节)
            2^N: K  (约千字节), M  (约兆字节), G  (约吉字节)
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+7G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):^C
您在 /var/spool/mail/root 中有邮件
[root@web ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part
├─sdb2            8:18   0    1G  0 part /u2
├─sdb3            8:19   0    1G  0 part
├─sdb4            8:20   0    1K  0 part
├─sdb5            8:21   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb6            8:22   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb7            8:23   0    1G  0 part
│ ├─vg01-lv01   253:2    0  3.1G  0 lvm
│ ├─vg01-lv02   253:3    0  120M  0 lvm
│ └─vg01-lv03   253:4    0   36M  0 lvm
├─sdb8            8:24   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
└─sdb9            8:25   0  900M  0 part
sdc               8:32   0   10G  0 disk
sr0              11:0    1  4.4G  0 rom  /mnt
[root@web ~]# fdisk /dev/sdc
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0xc48e4d33 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):m
命令操作
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

命令(输入 m 获取帮助):l

 0  空              24  NEC DOS         81  Minix / 旧 Linu bf  Solaris
 1  FAT12           27  隐藏的 NTFS Win 82  Linux 交换 / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 隐藏的 C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux 扩展      c7  Syrinx
 5  扩展            41  PPC PReP Boot   86  NTFS 卷集       da  非文件系统数据
 6  FAT16           42  SFS             87  NTFS 卷集       db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux 纯文本    de  Dell 工具
 8  AIX             4e  QNX4.x 第2部分  8e  Linux LVM       df  BootIt
 9  AIX 可启动      4f  QNX4.x 第3部分  93  Amoeba          e1  DOS 访问
 a  OS/2 启动管理器 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad 休 eb  BeOS fs
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT
 f  W95 扩展 (LBA)  54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC
11  隐藏的 FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor
12  Compaq 诊断     5c  Priam Edisk     a9  NetBSD          f4  SpeedStor
14  隐藏的 FAT16 <3 61  SpeedStor       ab  Darwin 启动     f2  DOS 次要
16  隐藏的 FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS
17  隐藏的 HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST 智能睡眠    65  Novell Netware  b8  BSDI swap       fd  Linux raid 自动
1b  隐藏的 W95 FAT3 70  DiskSecure 多启 bb  Boot Wizard 隐  fe  LANstep
1c  隐藏的 W95 FAT3 75  PC/IX           be  Solaris 启动    ff  BBT
1e  隐藏的 W95 FAT1 80  旧 Minix

命令(输入 m 获取帮助):p

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System

命令(输入 m 获取帮助):n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-20971519,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-20971519,默认为 20971519):+2G
分区 1 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):N
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): P
分区号 (2-4,默认 2):
起始 扇区 (4196352-20971519,默认为 4196352):
将使用默认值 4196352
Last 扇区, +扇区 or +size{K,M,G} (4196352-20971519,默认为 20971519):+2G
分区 2 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):p

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux

命令(输入 m 获取帮助):n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): e
分区号 (3,4,默认 3):
起始 扇区 (8390656-20971519,默认为 8390656):
将使用默认值 8390656
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6g
不支持的后缀:“g”。
支持:10^N: KB (千字节), MB (兆字节), GB (吉字节)
            2^N: K  (约千字节), M  (约兆字节), G  (约吉字节)
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+5.9G
不支持的后缀:“.9G”。
支持:10^N: KB (千字节), MB (兆字节), GB (吉字节)
            2^N: K  (约千字节), M  (约兆字节), G  (约吉字节)
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+5.6G
不支持的后缀:“.6G”。
支持:10^N: KB (千字节), MB (兆字节), GB (吉字节)
            2^N: K  (约千字节), M  (约兆字节), G  (约吉字节)
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+5G
分区 3 已设置为 Extended 类型,大小设为 5 GiB

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux
/dev/sdc3         8390656    18876415     5242880    5  Extended

命令(输入 m 获取帮助):N
Partition type:
   p   primary (2 primary, 1 extended, 1 free)
   l   logical (numbered from 5)
Select (default p): L
添加逻辑分区 5
起始 扇区 (8392704-18876415,默认为 8392704):
将使用默认值 8392704
Last 扇区, +扇区 or +size{K,M,G} (8392704-18876415,默认为 18876415):+2G
分区 5 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux
/dev/sdc3         8390656    18876415     5242880    5  Extended
/dev/sdc5         8392704    12587007     2097152   83  Linux

命令(输入 m 获取帮助):N
Partition type:
   p   primary (2 primary, 1 extended, 1 free)
   l   logical (numbered from 5)
Select (default p): L
添加逻辑分区 6
起始 扇区 (12589056-18876415,默认为 12589056):+2G
值超出范围。
起始 扇区 (12589056-18876415,默认为 12589056):P
起始 扇区 (12589056-18876415,默认为 12589056):
将使用默认值 12589056
Last 扇区, +扇区 or +size{K,M,G} (12589056-18876415,默认为 18876415):+2G
分区 6 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux
/dev/sdc3         8390656    18876415     5242880    5  Extended
/dev/sdc5         8392704    12587007     2097152   83  Linux
/dev/sdc6        12589056    16783359     2097152   83  Linux

命令(输入 m 获取帮助):N
Partition type:
   p   primary (2 primary, 1 extended, 1 free)
   l   logical (numbered from 5)
Select (default p): L
添加逻辑分区 7
起始 扇区 (16785408-18876415,默认为 16785408):
将使用默认值 16785408
Last 扇区, +扇区 or +size{K,M,G} (16785408-18876415,默认为 18876415):+900M
分区 7 已设置为 Linux 类型,大小设为 900 MiB

命令(输入 m 获取帮助):L

 0  空              24  NEC DOS         81  Minix / 旧 Linu bf  Solaris
 1  FAT12           27  隐藏的 NTFS Win 82  Linux 交换 / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 隐藏的 C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux 扩展      c7  Syrinx
 5  扩展            41  PPC PReP Boot   86  NTFS 卷集       da  非文件系统数据
 6  FAT16           42  SFS             87  NTFS 卷集       db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux 纯文本    de  Dell 工具
 8  AIX             4e  QNX4.x 第2部分  8e  Linux LVM       df  BootIt
 9  AIX 可启动      4f  QNX4.x 第3部分  93  Amoeba          e1  DOS 访问
 a  OS/2 启动管理器 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad 休 eb  BeOS fs
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT
 f  W95 扩展 (LBA)  54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC
11  隐藏的 FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor
12  Compaq 诊断     5c  Priam Edisk     a9  NetBSD          f4  SpeedStor
14  隐藏的 FAT16 <3 61  SpeedStor       ab  Darwin 启动     f2  DOS 次要
16  隐藏的 FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS
17  隐藏的 HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST 智能睡眠    65  Novell Netware  b8  BSDI swap       fd  Linux raid 自动
1b  隐藏的 W95 FAT3 70  DiskSecure 多启 bb  Boot Wizard 隐  fe  LANstep
1c  隐藏的 W95 FAT3 75  PC/IX           be  Solaris 启动    ff  BBT
1e  隐藏的 W95 FAT1 80  旧 Minix

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux
/dev/sdc3         8390656    18876415     5242880    5  Extended
/dev/sdc5         8392704    12587007     2097152   83  Linux
/dev/sdc6        12589056    16783359     2097152   83  Linux
/dev/sdc7        16785408    18628607      921600   83  Linux

命令(输入 m 获取帮助):M
命令操作
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

命令(输入 m 获取帮助):W
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
您在 /var/spool/mail/root 中有邮件
[root@web ~]# LSBLK
bash: LSBLK: 未找到命令...
相似命令是: 'lsblk'
[root@web ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part
├─sdb2            8:18   0    1G  0 part /u2
├─sdb3            8:19   0    1G  0 part
├─sdb4            8:20   0    1K  0 part
├─sdb5            8:21   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb6            8:22   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb7            8:23   0    1G  0 part
│ ├─vg01-lv01   253:2    0  3.1G  0 lvm
│ ├─vg01-lv02   253:3    0  120M  0 lvm
│ └─vg01-lv03   253:4    0   36M  0 lvm
├─sdb8            8:24   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
└─sdb9            8:25   0  900M  0 part
sdc               8:32   0   10G  0 disk
├─sdc1            8:33   0    2G  0 part
├─sdc2            8:34   0    2G  0 part
├─sdc3            8:35   0    1K  0 part
├─sdc5            8:37   0    2G  0 part
├─sdc6            8:38   0    2G  0 part
└─sdc7            8:39   0  900M  0 part
sr0              11:0    1  4.4G  0 rom  /mnt

刷新

partx -a /dev/sdc

[root@web ~]# partx -a /dev/sdc
partx: /dev/sdc: error adding partitions 1-3
partx: /dev/sdc: error adding partitions 5-7
您在 /var/spool/mail/root 中有邮件
[root@web ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part
├─sdb2            8:18   0    1G  0 part /u2
├─sdb3            8:19   0    1G  0 part
├─sdb4            8:20   0    1K  0 part
├─sdb5            8:21   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb6            8:22   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb7            8:23   0    1G  0 part
│ ├─vg01-lv01   253:2    0  3.1G  0 lvm
│ ├─vg01-lv02   253:3    0  120M  0 lvm
│ └─vg01-lv03   253:4    0   36M  0 lvm
├─sdb8            8:24   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
└─sdb9            8:25   0  900M  0 part
sdc               8:32   0   10G  0 disk
├─sdc1            8:33   0    2G  0 part
├─sdc2            8:34   0    2G  0 part
├─sdc3            8:35   0    1K  0 part
├─sdc5            8:37   0    2G  0 part
├─sdc6            8:38   0    2G  0 part
└─sdc7            8:39   0  900M  0 part
sr0              11:0    1  4.4G  0 rom  /mnt

在这里插入图片描述

创建物理卷pv

pvcreate /dev/sdc[12567]

创造卷组vg

vgcreate vg_mysql /dev/sdc[12567]

创造逻辑卷lv

lvcreate -n lv_mysql -L 8G vg_mysql
lvs lv_mysql

[root@web ~]# pvcreate /dev/sdc[12567]
  Physical volume "/dev/sdc1" successfully created.
  Physical volume "/dev/sdc2" successfully created.
  Physical volume "/dev/sdc5" successfully created.
  Physical volume "/dev/sdc6" successfully created.
  Physical volume "/dev/sdc7" successfully created.
您在 /var/spool/mail/root 中有邮件
[root@web ~]# vgs vg_mysql
  Volume group "vg_mysql" not found
  Cannot process volume group vg_mysql
您在 /var/spool/mail/root 中有邮件
[root@web ~]# vgcreate vg_mysql /dev/sdc[12567]
  Volume group "vg_mysql" successfully created
您在 /var/spool/mail/root 中有邮件
[root@web ~]# vgs vg_mysql
  VG       #PV #LV #SN Attr   VSize  VFree
  vg_mysql   5   0   0 wz--n- <8.86g <8.86g
[root@web ~]# lvcreate -n lv_mysql -L 8G vg_mysql
  Logical volume "lv_mysql" created.
您在 /var/spool/mail/root 中有邮件
[root@web ~]# lvs /dev/vg_mysql/lv_mysql
  LV       VG       Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_mysql vg_mysql -wi-a----- 8.00g

格式化ext4

mfks.ext4 /dev/vg_mysql/lv_mysql

[root@web ~]# mkfs.ext4 /dev/vg_mysql/lv_mysql
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
524288 inodes, 2097152 blocks
104857 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2147483648
64 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

挂载

mkdir /u1

mount /dev/vg_mysql/lv_mysql /u1

[root@web ~]# ls /
1.java  35.txt  5.java  bin      code  dev         home  lib64  oo .pcapng  rhome  samba  srv  u01  u07  var
2041    3.java  app     boot     data  etc         java  media  opt         root   sbin   sys  u03  u2   www
2.java  4.java  app1    cc.conf  date  file3.java  lib   mnt    proc        run    shop   tmp  u06  usr
[root@web ~]# mkdir /u1
您在 /var/spool/mail/root 中有邮件
[root@web ~]# mount /dev/vg_mysql/lv_mysql /u1
您在 /var/spool/mail/root 中有邮件

关闭apache

回顾LAMP

yum install cmake
yum install ncureses-devel
yum install libcurl-devel
yum install openssh-devel
yum install pcre-devel

安装mysql

useradd -r -s /sbin/nologin mysql
tar mysql
cd mysql
vim cmake.sh
安装位置、数据目录等

chmod +x cmake.sh
./cmake.sh
make && make install
chown -R mysql.mysql /etc/local/mysql
rm -rf /etc/my.cnf
cd /usr/local/mysql
./scripts/mysql_install_db --user=mysql
ll data
cp /support_files/mysql.server /etc/init.d/mysql
service mysql start

bin/mysqladmin -u root -password ‘123’

echo ‘export PATH=$PATH:/usr/local/mysql/bin’>> /etc/profile
source /etc/profile
mysql -uroot -p

[root@web ~]# useradd -r -s /sbin/nologin mysql
useradd:用户“mysql”已存在
您在 /var/spool/mail/root 中有邮件
[root@web ~]# cd /
[root@web /]# ls
1.java  35.txt  5.java  bin      code  dev         home  lib64  oo .pcapng  rhome  samba  srv  u01  u07  usr
2041    3.java  app     boot     data  etc         java  media  opt         root   sbin   sys  u03  u1   var
2.java  4.java  app1    cc.conf  date  file3.java  lib   mnt    proc        run    shop   tmp  u06  u2   www
[root@web /]# cd /root
[root@web ~]# ls
1828.txt         app                     axel-2.4.tar.gz  httpd-2.4.37               ok                 Steam.dll
1837.txt         apr-1.5.2               bb.conf          httpd-2.4.37.tar.bz2       okl                wordpress
2-1.java         apr-1.5.2.tar.bz2       cc.conf          initial-setup-ks.cfg       php-7.2.17         wordpress-4.7.3-zh_CN.tar.gz
2.java           apr-util-1.5.4          code             inotify-tools-3.13.tar.gz  php-7.2.17.tar.xz
alll1            apr-util-1.5.4.tar.bz2  file20.java      mysql-5.6.31               readme7
anaconda-ks.cfg  axel-2.4                file23.java      mysql-5.6.31.tar.gz        readme.txt
[root@web ~]# cd mysql-5.6.31/
[root@web mysql-5.6.31]# cat cmake.sh
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DMYSQL_USER=mysql

[root@web mysql-5.6.31]# ll cmake.sh
-rwxr-xr-x 1 root root 296 629 20:46 cmake.sh
您在 /var/spool/mail/root 中有邮件
[root@web mysql-5.6.31]# ls /usr/local/mysql
bin  COPYING  data  docs  include  lib  man  my.cnf  my-new.cnf  mysql-test  README  scripts  share  sql-bench  support-files
[root@web mysql-5.6.31]# ll -d /usr/local/mysql
drwxr-xr-x 13 mysql mysql 223 71 21:42 /usr/local/mysql
您在 /var/spool/mail/root 中有邮件
[root@web mysql-5.6.31]# chown -R mysql.mysql /usr/local/mysql
[root@web mysql-5.6.31]# cat /etc/my.cnf
cat: /etc/my.cnf: 没有那个文件或目录
[root@web mysql-5.6.31]# ls /etc/my.cnf
ls: 无法访问/etc/my.cnf: 没有那个文件或目录
您在 /var/spool/mail/root 中有邮件
[root@web mysql-5.6.31]# ls /etc
abrt                       dbus-1                      gss             mail.rc                   profile.d         speech-dispatcher
adjtime                    dconf                       gssproxy        makedumpfile.conf.sample  protocols         ssh
aliases                    default                     host.conf       man_db.conf               pulse             ssl
aliases.db                 depmod.d                    hostname        maven                     purple            sssd
alsa                       dhcp                        hosts           mime.types                python            statetab
alternatives               DIR_COLORS                  hosts.allow     mke2fs.conf               qemu-ga           statetab.d
anacrontab                 DIR_COLORS.256color         hosts.deny      modprobe.d                qemu-kvm          subgid
asound.conf                DIR_COLORS.lightbgcolor     hp              modules-load.d            radvd.conf        subgid-
at.deny                    dleyna-server-service.conf  idmapd.conf     motd                      rc0.d             subuid
audisp                     dnsmasq.conf                init.d          mtab                      rc1.d             subuid-
audit                      dnsmasq.d                   inittab         mtools.conf               rc2.d             subversion
autofs.conf                dracut.conf                 inputrc         multipath                 rc3.d             sudo.conf
autofs_ldap_auth.conf      dracut.conf.d               ipa             my.cnf.d                  rc4.d             sudoers
auto.master                e2fsck.conf                 iproute2        nanorc                    rc5.d             sudoers.d
auto.master.d              egl                         ipsec.conf      ndctl                     rc6.d             sudo-ldap.conf
auto.misc                  enscript.cfg                ipsec.d         netconfig                 rc.d              sysconfig
auto.net                   environment                 ipsec.secrets   NetworkManager            rc.local          sysctl.conf
auto.notes                 ethertypes                  iscsi           networks                  rdma              sysctl.d
auto.smb                   exports                     issue           nfs.conf                  redhat-release    systemd
auto.test                  exports.d                   issue.net       nfsmount.conf             request-key.conf  system-release
avahi                      favicon.png                 java            nsswitch.conf             request-key.d     system-release-cpe
bash_completion.d          fcoe                        jvm             nsswitch.conf.bak         resolv.conf       target
bashrc                     festival                    jvm-commmon     ntp                       resolv.conf.save  tcsd.conf
binfmt.d                   filesystems                 kdump.conf      ntp.conf                  rpc               terminfo
bluetooth                  firefox                     kernel          numad.conf                rpm               tmpfiles.d
brltty                     firewalld                   krb5.conf       oddjob                    rsyncd.conf       trusted-key.key
brltty.conf                flatpak                     krb5.conf.d     oddjobd.conf              rsyncd.secrets    tuned
centos-release             fonts                       ksmtuned.conf   oddjobd.conf.d            rsyslog.conf      udev
centos-release-upstream    fprintd.conf                ld.so.cache     openldap                  rsyslog.d         udisks2
certmonger                 fstab                       ld.so.conf      opt                       rwtab             unbound
cgconfig.conf              fuse.conf                   ld.so.conf.d    os-release                rwtab.d           updatedb.conf
cgconfig.d                 fwupd                       lftp.conf       PackageKit                samba             UPower
cgrules.conf               gconf                       libaudit.conf   pam.d                     sane.d            usb_modeswitch.conf
cgsnapshot_blacklist.conf  gcrypt                      libblockdev     papersize                 sasl2             vconsole.conf
chkconfig.d                gdbinit                     libibverbs.d    passwd                    scl               vimrc
chrony.conf                gdbinit.d                   libnl           passwd-                   securetty         virc
chrony.keys                gdm                         libpaper.d      pbm2ppa.conf              security          vmware-tools
cifs-utils                 geoclue                     libreport       pinforc                   selinux           vsftpd
cron.d                     GeoIP.conf                  libuser.conf    pkcs11                    services          wgetrc
cron.daily                 ghostscript                 libvirt         pki                       sestatus.conf     wpa_supplicant
cron.deny                  glvnd                       locale.conf     plymouth                  setroubleshoot    wvdial.conf
cron.hourly                gnupg                       localtime       pm                        setuptool.d       X11
cron.monthly               GREP_COLORS                 login.defs      pnm2ppa.conf              sgml              xdg
crontab                    groff                       logrotate.conf  polkit-1                  shadow            xinetd.conf
cron.weekly                group                       logrotate.d     popt.d                    shadow-           xinetd.d
crypttab                   group-                      lsm             postfix                   shells            xml
csh.cshrc                  grub2.cfg                   lvm             ppp                       skel              yum
csh.login                  grub.d                      machine-id      prelink.conf.d            smartmontools     yum.conf
cups                       gshadow                     magic           printcap                  smi.conf          yum.repos.d
cupshelpers                gshadow-                    mailcap         profile                   sos.conf          yum.repos.d.backup
[root@web mysql-5.6.31]# find /etc -name my.cnf
您在 /var/spool/mail/root 中有邮件
[root@web mysql-5.6.31]# find /etc -name my.cnf
[root@web mysql-5.6.31]# rm -f /etc/my.cnf\
> ^C
[root@web mysql-5.6.31]# cd /usr/local/mysql/
[root@web mysql]# ./scripts/mysql_install_db --user=mysql
Installing MySQL system tables...2025-07-16 20:38:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2025-07-16 20:38:59 0 [Note] ./bin/mysqld (mysqld 5.6.31) starting as process 26925 ...
2025-07-16 20:38:59 26925 [Note] InnoDB: Using atomics to ref count buffer pool pages
2025-07-16 20:38:59 26925 [Note] InnoDB: The InnoDB memory heap is disabled
2025-07-16 20:38:59 26925 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2025-07-16 20:38:59 26925 [Note] InnoDB: Memory barrier is not used
2025-07-16 20:38:59 26925 [Note] InnoDB: Compressed tables use zlib 1.2.3
2025-07-16 20:38:59 26925 [Note] InnoDB: Using CPU crc32 instructions
2025-07-16 20:38:59 26925 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2025-07-16 20:38:59 26925 [Note] InnoDB: Completed initialization of buffer pool
2025-07-16 20:38:59 26925 [Note] InnoDB: Highest supported file format is Barracuda.
2025-07-16 20:38:59 26925 [Note] InnoDB: The log sequence numbers 1626017 and 1626017 in ibdata files do not match the log sequence number 2548967 in the ib_logfiles!
2025-07-16 20:38:59 26925 [Note] InnoDB: Database was not shutdown normally!
2025-07-16 20:38:59 26925 [Note] InnoDB: Starting crash recovery.
2025-07-16 20:38:59 26925 [Note] InnoDB: Reading tablespace information from the .ibd files...
2025-07-16 20:38:59 26925 [Note] InnoDB: Restoring possible half-written data pages
2025-07-16 20:38:59 26925 [Note] InnoDB: from the doublewrite buffer...
2025-07-16 20:38:59 26925 [Note] InnoDB: 128 rollback segment(s) are active.
2025-07-16 20:38:59 26925 [Note] InnoDB: Waiting for purge to start
2025-07-16 20:38:59 26925 [Note] InnoDB: 5.6.31 started; log sequence number 2548967
2025-07-16 20:38:59 26925 [Note] Binlog end
2025-07-16 20:38:59 26925 [Note] InnoDB: FTS optimize thread exiting.
2025-07-16 20:38:59 26925 [Note] InnoDB: Starting shutdown...
2025-07-16 20:39:01 26925 [Note] InnoDB: Shutdown completed; log sequence number 2548977
OK

Filling help tables...2025-07-16 20:39:01 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2025-07-16 20:39:01 0 [Note] ./bin/mysqld (mysqld 5.6.31) starting as process 26961 ...
2025-07-16 20:39:01 26961 [Note] InnoDB: Using atomics to ref count buffer pool pages
2025-07-16 20:39:01 26961 [Note] InnoDB: The InnoDB memory heap is disabled
2025-07-16 20:39:01 26961 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2025-07-16 20:39:01 26961 [Note] InnoDB: Memory barrier is not used
2025-07-16 20:39:01 26961 [Note] InnoDB: Compressed tables use zlib 1.2.3
2025-07-16 20:39:01 26961 [Note] InnoDB: Using CPU crc32 instructions
2025-07-16 20:39:01 26961 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2025-07-16 20:39:01 26961 [Note] InnoDB: Completed initialization of buffer pool
2025-07-16 20:39:01 26961 [Note] InnoDB: Highest supported file format is Barracuda.
2025-07-16 20:39:01 26961 [Note] InnoDB: 128 rollback segment(s) are active.
2025-07-16 20:39:01 26961 [Note] InnoDB: Waiting for purge to start
2025-07-16 20:39:01 26961 [Note] InnoDB: 5.6.31 started; log sequence number 2548977
2025-07-16 20:39:01 26961 [Note] Binlog end
2025-07-16 20:39:01 26961 [Note] InnoDB: FTS optimize thread exiting.
2025-07-16 20:39:01 26961 [Note] InnoDB: Starting shutdown...
2025-07-16 20:39:02 26961 [Note] InnoDB: Shutdown completed; log sequence number 2548987
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  ./bin/mysqladmin -u root password 'new-password'
  ./bin/mysqladmin -u root -h web.cn password 'new-password'

Alternatively you can run:

  ./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

  cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file ./my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as ./my-new.cnf,
please compare it with your file and take the changes you need.

您在 /var/spool/mail/root 中有邮件
[root@web mysql]# ll data
总用量 176152
-rw-rw---- 1 mysql mysql       56 629 21:59 auto.cnf
drwx------ 2 mysql mysql     4096 71 23:53 blog
-rw-rw---- 1 mysql mysql 79691776 716 20:39 ibdata1
-rw-rw---- 1 mysql mysql 50331648 716 20:39 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 629 21:58 ib_logfile1
drwx------ 2 mysql mysql     4096 629 21:58 mysql
drwx------ 2 mysql mysql     4096 716 20:38 performance_schema
drwxr-xr-x 2 mysql mysql       20 629 21:02 test
-rw-r----- 1 mysql mysql     3946 71 21:49 web.cn.err
-rw-rw---- 1 mysql mysql        6 71 21:49 web.cn.pid
[root@web mysql]# cat /etc/init.d/mysql
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind

# MySQL daemon start/stop script.

# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.

# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 64 36
# description: A very fast and reliable SQL database engine.

# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $local_fs $network $remote_fs
# Should-Start: ypbind nscd ldap ntpd xntpd
# Required-Stop: $local_fs $network $remote_fs
# Default-Start:  2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO

# If you install MySQL on some other places than /usr/local/mysql, then you
# have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
#   [mysqld]
#   basedir=<path-to-mysql-installation-directory>
# - Add the above to any other configuration file (for example ~/.my.ini)
#   and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directory to the basedir variable
#   below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.

# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.

basedir=
datadir=

# Default value, in seconds, afterwhich the script should timeout waiting
# for server start.
# Value here is overriden by value in my.cnf.
# 0 means don't wait at all
# Negative numbers mean to wait indefinitely
service_startup_timeout=900

# Lock directory for RedHat / SuSE.
lockdir='/var/lock/subsys'
lock_file_path="$lockdir/mysql"

# The following variables are only set for letting mysql.server find things.

# Set some defaults
mysqld_pid_file_path=
if test -z "$basedir"
then
  basedir=/usr/local/mysql
  bindir=/usr/local/mysql/bin
  if test -z "$datadir"
  then
    datadir=/usr/local/mysql/data
  fi
  sbindir=/usr/local/mysql/bin
  libexecdir=/usr/local/mysql/bin
else
  bindir="$basedir/bin"
  if test -z "$datadir"
  then
    datadir="$basedir/data"
  fi
  sbindir="$basedir/sbin"
  libexecdir="$basedir/libexec"
fi

# datadir_set is used to determine if datadir was set (and so should be
# *not* set inside of the --basedir= handler.)
datadir_set=

#
# Use LSB init script functions for printing messages, if possible
#
lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then
  . $lsb_functions
else
  log_success_msg()
  {
    echo " SUCCESS! $@"
  }
  log_failure_msg()
  {
    echo " ERROR! $@"
  }
fi

PATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin"
export PATH

mode=$1    # start or stop

[ $# -ge 1 ] && shift


other_args="$*"   # uncommon, but needed when called from an RPM upgrade action
           # Expected: "--skip-networking --skip-grant-tables"
           # They are not checked here, intentionally, as it is the resposibility
           # of the "spec" file author to give correct arguments only.

case `echo "testing\c"`,`echo -n testing` in
    *c*,-n*) echo_n=   echo_c=     ;;
    *c*,*)   echo_n=-n echo_c=     ;;
    *)       echo_n=   echo_c='\c' ;;
esac

parse_server_arguments() {
  for arg do
    case "$arg" in
      --basedir=*)  basedir=`echo "$arg" | sed -e 's/^[^=]*=//'`
                    bindir="$basedir/bin"
                    if test -z "$datadir_set"; then
                      datadir="$basedir/data"
                    fi
                    sbindir="$basedir/sbin"
                    libexecdir="$basedir/libexec"
        ;;
      --datadir=*)  datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
                    datadir_set=1
        ;;
      --pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
      --service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
    esac
  done
}

wait_for_pid () {
  verb="$1"           # created | removed
  pid="$2"            # process ID of the program operating on the pid-file
  pid_file_path="$3" # path to the PID file.

  i=0
  avoid_race_condition="by checking again"

  while test $i -ne $service_startup_timeout ; do

    case "$verb" in
      'created')
        # wait for a PID-file to pop into existence.
        test -s "$pid_file_path" && i='' && break
        ;;
      'removed')
        # wait for this PID-file to disappear
        test ! -s "$pid_file_path" && i='' && break
        ;;
      *)
        echo "wait_for_pid () usage: wait_for_pid created|removed pid pid_file_path"
        exit 1
        ;;
    esac

    # if server isn't running, then pid-file will never be updated
    if test -n "$pid"; then
      if kill -0 "$pid" 2>/dev/null; then
        :  # the server still runs
      else
        # The server may have exited between the last pid-file check and now.
        if test -n "$avoid_race_condition"; then
          avoid_race_condition=""
          continue  # Check again.
        fi

        # there's nothing that will affect the file.
        log_failure_msg "The server quit without updating PID file ($pid_file_path)."
        return 1  # not waiting any more.
      fi
    fi

    echo $echo_n ".$echo_c"
    i=`expr $i + 1`
    sleep 1

  done

  if test -z "$i" ; then
    log_success_msg
    return 0
  else
    log_failure_msg
    return 1
  fi
}

# Get arguments from the my.cnf file,
# the only group, which is read from now on is [mysqld]
if test -x ./bin/my_print_defaults
then
  print_defaults="./bin/my_print_defaults"
elif test -x $bindir/my_print_defaults
then
  print_defaults="$bindir/my_print_defaults"
elif test -x $bindir/mysql_print_defaults
then
  print_defaults="$bindir/mysql_print_defaults"
else
  # Try to find basedir in /etc/my.cnf
  conf=/etc/my.cnf
  print_defaults=
  if test -r $conf
  then
    subpat='^[^=]*basedir[^=]*=\(.*\)$'
    dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
    for d in $dirs
    do
      d=`echo $d | sed -e 's/[  ]//g'`
      if test -x "$d/bin/my_print_defaults"
      then
        print_defaults="$d/bin/my_print_defaults"
        break
      fi
      if test -x "$d/bin/mysql_print_defaults"
      then
        print_defaults="$d/bin/mysql_print_defaults"
        break
      fi
    done
  fi

  # Hope it's in the PATH ... but I doubt it
  test -z "$print_defaults" && print_defaults="my_print_defaults"
fi

#
# Read defaults file from 'basedir'.   If there is no defaults file there
# check if it's in the old (depricated) place (datadir) and read it from there
#

extra_args=""
if test -r "$basedir/my.cnf"
then
  extra_args="-e $basedir/my.cnf"
else
  if test -r "$datadir/my.cnf"
  then
    extra_args="-e $datadir/my.cnf"
  fi
fi

parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`

#
# Set pid file if not given
#
if test -z "$mysqld_pid_file_path"
then
  mysqld_pid_file_path=$datadir/`hostname`.pid
else
  case "$mysqld_pid_file_path" in
    /* ) ;;
    * )  mysqld_pid_file_path="$datadir/$mysqld_pid_file_path" ;;
  esac
fi

case "$mode" in
  'start')
    # Start daemon

    # Safeguard (relative paths, core dumps..)
    cd $basedir

    echo $echo_n "Starting MySQL"
    if test -x $bindir/mysqld_safe
    then
      # Give extra arguments to mysqld with the my.cnf file. This script
      # may be overwritten at next upgrade.
      $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
      wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?

      # Make lock for RedHat / SuSE
      if test -w "$lockdir"
      then
        touch "$lock_file_path"
      fi

      exit $return_value
    else
      log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)"
    fi
    ;;

  'stop')
    # Stop daemon. We use a signal here to avoid having to know the
    # root password.

    if test -s "$mysqld_pid_file_path"
    then
      mysqld_pid=`cat "$mysqld_pid_file_path"`

      if (kill -0 $mysqld_pid 2>/dev/null)
      then
        echo $echo_n "Shutting down MySQL"
        kill $mysqld_pid
        # mysqld should remove the pid file when it exits, so wait for it.
        wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$?
      else
        log_failure_msg "MySQL server process #$mysqld_pid is not running!"
        rm "$mysqld_pid_file_path"
      fi

      # Delete lock for RedHat / SuSE
      if test -f "$lock_file_path"
      then
        rm -f "$lock_file_path"
      fi
      exit $return_value
    else
      log_failure_msg "MySQL server PID file could not be found!"
    fi
    ;;

  'restart')
    # Stop the service and regardless of whether it was
    # running or not, start it again.
    if $0 stop  $other_args; then
      $0 start $other_args
    else
      log_failure_msg "Failed to stop running server, so refusing to try to start."
      exit 1
    fi
    ;;

  'reload'|'force-reload')
    if test -s "$mysqld_pid_file_path" ; then
      read mysqld_pid <  "$mysqld_pid_file_path"
      kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
      touch "$mysqld_pid_file_path"
    else
      log_failure_msg "MySQL PID file could not be found!"
      exit 1
    fi
    ;;
  'status')
    # First, check to see if pid file exists
    if test -s "$mysqld_pid_file_path" ; then
      read mysqld_pid < "$mysqld_pid_file_path"
      if kill -0 $mysqld_pid 2>/dev/null ; then
        log_success_msg "MySQL running ($mysqld_pid)"
        exit 0
      else
        log_failure_msg "MySQL is not running, but PID file exists"
        exit 1
      fi
    else
      # Try to find appropriate mysqld process
      mysqld_pid=`pidof $libexecdir/mysqld`

      # test if multiple pids exist
      pid_count=`echo $mysqld_pid | wc -w`
      if test $pid_count -gt 1 ; then
        log_failure_msg "Multiple MySQL running but PID file could not be found ($mysqld_pid)"
        exit 5
      elif test -z $mysqld_pid ; then
        if test -f "$lock_file_path" ; then
          log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists"
          exit 2
        fi
        log_failure_msg "MySQL is not running"
        exit 3
      else
        log_failure_msg "MySQL is running but PID file could not be found"
        exit 4
      fi
    fi
    ;;
    *)
      # usage
      basename=`basename "$0"`
      echo "Usage: $basename  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]"
      exit 1
    ;;
esac

exit 0
[root@web mysql]# cd /etc/init.d/
您在 /var/spool/mail/root 中有邮件
[root@web init.d]# ls
functions  mysql  netconsole  network  README
[root@web init.d]# service mysql start
Starting MySQL SUCCESS!
[root@web init.d]# cd /usr/local/mysql/
[root@web mysql]# bin/mysqladmin -u root password '123'
bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
您在 /var/spool/mail/root 中有邮件
[root@web mysql]# bin/mysqladmin -u root password '123'
bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
您在 /var/spool/mail/root 中有邮件
[root@web mysql]# echo 'export PATH=$PATH:/usr/local/mysql/bin' >>/etc/profile
您在 /var/spool/mail/root 中有邮件
[root@web mysql]# cat /etc/profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}


if [ -x /usr/bin/id ]; then
    if [ -z "$EUID" ]; then
        # ksh workaround
        EUID=`/usr/bin/id -u`
        UID=`/usr/bin/id -ru`
    fi
    USER="`/usr/bin/id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
else
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
fi

HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then
            . "$i"
        else
            . "$i" >/dev/null
        fi
    fi
done

unset i
unset -f pathmunge
PATH=$PATH:/usr/local/mysql/bin
export PATH=$PATH:/usr/local/mysql/bin
[root@web mysql]# source /etc/profile
您在 /var/spool/mail/root 中有新邮件
[root@web mysql]# mysql -uroot -p
Enter password:

apache

tar xf apr
cd apr
tar xf apr_utils
cd apr_utils
tar xf httpd
cd httpd
vim apache.sh
chmod +x apache.sh
./apache.sh
make && make install
cd /usr/local/apache2
bin/apachectl

[root@web ~]# cd apr-1.5.2/
[root@web apr-1.5.2]# cd /root
[root@web ~]# cd apr-util-1.5.4/
[root@web apr-util-1.5.4]# cd /root
[root@web ~]# cd httpd-2.4.37/
您在 /var/spool/mail/root 中有邮件
[root@web httpd-2.4.37]# cat apache.sh
./configure \
--enable-modules=all \
--enable-mods-shared=all \
--enable-so \
--enable-rewrite \
--with-pcre \
--enable-ssl \
--with-mpm=prefork \
--with-apr=/usr/local/apr/bin/apr-1-config \
--with-apr-util=/usr/local/apr/bin/apu-1-config
[root@web httpd-2.4.37]# ls apache.sh
apache.sh
[root@web httpd-2.4.37]# ll apache.sh
-rwxr-xr-x 1 root dip 240 629 22:24 apache.sh
[root@web httpd-2.4.37]# ./apache.sh \
> ^C
您在 /var/spool/mail/root 中有邮件
[root@web httpd-2.4.37]#
[root@web httpd-2.4.37]# make && make install \
> ^C
[root@web httpd-2.4.37]# cd /usr/local/apache2/
[root@web apache2]# bin/apachectl
您在 /var/spool/mail/root 中有邮件

php

yum install libjpeg-devel
yum install libpng-devel
yum install freetype-devel
yum insatall libxml2-devel
tar xf php
cd php
vim php.sh
chmod +x php.sh
./php.sh
make && make insatll

[root@web apache2]# cd /root
[root@web ~]# cd php-7.2.17/
[root@web php-7.2.17]# cat php.sh
./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysqli \
--with-pdo-mysql \
--with-zlib \
--with-curl \
--enable-zip \
--with-gd \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-opcache \
--enable-mbstring \
--enable-mbregex \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-calendar \
--enable-bcmath
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# ll php.sh
-rwxr-xr-x 1 root root 441 630 19:49 php.sh
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# yum install libxml2-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 libxml2-devel-2.9.1-6.el7.5.x86_64 已安装并且是最新版本
无须任何处理
[root@web php-7.2.17]# yum install libjpeg-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 libjpeg-turbo-devel-1.2.90-8.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@web php-7.2.17]# yum install libpng-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 2:libpng-devel-1.5.13-8.el7.x86_64 已安装并且是最新版本
无须任何处理
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# yum install freetype-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 freetype-devel-2.8-14.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@web php-7.2.17]# ./php.sh \
> ^C
[root@web php-7.2.17]# make && make install \
> ^C
[root@web php-7.2.17]# ls /usr/local/apache2/modules/libphp7.so
/usr/local/apache2/modules/libphp7.so
您在 /var/spool/mail/root 中有邮件

其他
[root@web php-7.2.17]# cat /usr/local/apache2//conf/httpd.conf
#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
# will be interpreted as '/logs/access_log'.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/usr/local/apache2"

#
# Mutex: Allows you to set the mutex mechanism and mutex file directory
# for individual mutexes, or change the global defaults
#
# Uncomment and change the directory if mutexes are file-based and the default
# mutex file directory is not on a local disk or is not appropriate for some
# other reason.
#
# Mutex default:logs

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_form_module modules/mod_auth_form.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule allowmethods_module modules/mod_allowmethods.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cache_socache_module modules/mod_cache_socache.so
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
#LoadModule watchdog_module modules/mod_watchdog.so
#LoadModule macro_module modules/mod_macro.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule dumpio_module modules/mod_dumpio.so
#LoadModule echo_module modules/mod_echo.so
#LoadModule buffer_module modules/mod_buffer.so
#LoadModule data_module modules/mod_data.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule request_module modules/mod_request.so
#LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
#LoadModule reflector_module modules/mod_reflector.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
#LoadModule remoteip_module modules/mod_remoteip.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule dialup_module modules/mod_dialup.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule unixd_module modules/mod_unixd.so
#LoadModule heartbeat_module modules/mod_heartbeat.so
#LoadModule heartmonitor_module modules/mod_heartmonitor.so
#LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule asis_module modules/mod_asis.so
#LoadModule info_module modules/mod_info.so
#LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
#LoadModule actions_module modules/mod_actions.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php7_module modules/libphp7.so
AddHandler php7-script .php
AddType text/html .php
<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin you@example.com

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all granted
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/usr/local/apache2/htdocs"
<Directory "/usr/local/apache2/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
    Require all denied
</Files>

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "logs/access_log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock cgisock
</IfModule>

#
# "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule headers_module>
    #
    # Avoid passing HTTP_PROXY environment to CGI's on this or any proxied
    # backend servers which have lingering "httpoxy" defects.
    # 'Proxy' request header is undefined by the IETF, not listed by IANA
    #
    RequestHeader unset Proxy early
</IfModule>

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall may be used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
#EnableSendfile on

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

[root@web php-7.2.17]# vim /usr/local/apache2/conf/httpd.conf
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# vim /usr/local/apache2/conf/extra/httpd-languages.conf
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# cd /usr/local/apache2
[root@web apache2]# bin/apachectl -k restart
[root@web apache2]# cd /usr/local/apache2/htdocs/
[root@web htdocs]# ls
index.php
[root@web htdocs]# cat index.sh
cat: index.sh: 没有那个文件或目录
您在 /var/spool/mail/root 中有邮件
[root@web htdocs]# cat index.php
<?php
        phpinfo();
?>
[root@web htdocs]# ls /www/blog
index.php    wp-activate.php     wp-comments-post.php  wp-content   wp-links-opml.php  wp-mail.php      wp-trackback.php
license.txt  wp-admin            wp-config.php         wp-cron.php  wp-load.php        wp-settings.php  xmlrpc.php
readme.html  wp-blog-header.php  wp-config-sample.php  wp-includes  wp-login.php       wp-signup.php
[root@web htdocs]# ll -d /www/blog
drwxr-xr-x 5 daemon daemon 4096 71 23:53 /www/blog
您在 /var/spool/mail/root 中有邮件
[root@web htdocs]# chown -R deamon.deamon /www/blog
chown: 无效的用户: "deamon.deamon"
[root@web htdocs]# chown -R daemon.daemon /www/blog
您在 /var/spool/mail/root 中有邮件
[root@web htdocs]# vim /usr/local/apache2/conf/httpd.conf
您在 /var/spool/mail/root 中有邮件
[root@web htdocs]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
您在 /var/spool/mail/root 中有邮件
[root@web htdocs]# cat /usr/local/apache2/conf/extra/httpd-v
cat: /usr/local/apache2/conf/extra/httpd-v: 没有那个文件或目录
[root@web htdocs]# cat /usr/local/apache2/conf/extra/httpd-vhosts.conf
# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#

<VirtualHost *:80>
    DocumentRoot "/www/blog"
    ServerName www.blog.com
    ErrorLog "logs/blog-error_log"
    CustomLog "logs/blog-access_log" common
</VirtualHost>


[root@web htdocs]# cd /usr/local/apache2/
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# bin/apachectl -k restart
[root@web apache2]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.31 Source distribution

Copyright (c) 2000, 2016, 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 blog default charset utf8
    -> ;
ERROR 1007 (HY000): Can't create database 'blog'; database exists
mysql> Ctrl-C -- exit!
Aborted
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# cd /
[root@web /]# cd /root

service apache stop

[root@web ~]# service apache stop
Redirecting to /bin/systemctl stop apache.service
Failed to stop apache.service: Unit apache.service not loaded.
[root@web ~]# systemctl status apache2
Unit apache2.service could not be found.
您在 /var/spool/mail/root 中有邮件
[root@web ~]# systemctl status apache
Unit apache.service could not be found.
[root@web ~]# cd /usr/local/apache2/
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# bin/apachectl -k stop

service mysql stop

[root@web apache2]# service mysql stop
Shutting down MySQL. SUCCESS!

rsync -av /usr/local/mysql 192.168.235.200:/backup

[root@web apache2]# rsync -av /usr/local/mysql/ 192.168.235.200:/backup/
The authenticity of host '192.168.235.200 (192.168.235.200)' can't be established.
ECDSA key fingerprint is SHA256:khlI72dk6xtaBObBlZbZT4+Z+s+1c1tjmHg3nZVV8G4.
ECDSA key fingerprint is MD5:59:e9:91:40:a4:ca:21:a9:c2:92:39:b8:d4:7f:5f:2f.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# ssh 192.168.235.200
The authenticity of host '192.168.235.200 (192.168.235.200)' can't be established.
ECDSA key fingerprint is SHA256:khlI72dk6xtaBObBlZbZT4+Z+s+1c1tjmHg3nZVV8G4.
ECDSA key fingerprint is MD5:59:e9:91:40:a4:ca:21:a9:c2:92:39:b8:d4:7f:5f:2f.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# ssh 192.168.235.200
The authenticity of host '192.168.235.200 (192.168.235.200)' can't be established.
ECDSA key fingerprint is SHA256:khlI72dk6xtaBObBlZbZT4+Z+s+1c1tjmHg3nZVV8G4.
ECDSA key fingerprint is MD5:59:e9:91:40:a4:ca:21:a9:c2:92:39:b8:d4:7f:5f:2f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.235.200' (ECDSA) to the list of known hosts.
root@192.168.235.200's password:
Last login: Wed Jul 16 21:25:21 2025 from 192.168.235.200
[root@client ~]# ^C
[root@client ~]# exit
登出
Connection to 192.168.235.200 closed.
[root@web apache2]# rsync -av /usr/local/mysql/ 192.168.235.200:/backup
root@192.168.235.200's password:
sending incremental file list
./
COPYING
README
my-new.cnf
my.cnf
bin/

rsync -av /usr/local/mysql /u1

ls /u1

du -sh /u1

[root@web apache2]# ls /u1
bin  COPYING  data  docs  include  lib  lost+found  man  my.cnf  my-new.cnf  mysql-test  README  scripts  share  sql-bench  support-files
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# du -sh /u1
1.2G    /u1

umount /u1

rm -rf /usr/local/mysql/*

mount /dev/vg_mysql/lv_mysql /usr/local/mysql

vim /etc/rc.local

mount /dev/vg_mysql/lv_mysql /usr/local/mysql

[root@web apache2]# umount /u1
[root@web apache2]# rm -rf /usr/local/mysql/*
[root@web apache2]# mount /dev/vg_mysql/lv_mysql /usr/local/mysql
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# vim /etc/rc.local
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
mount -o ro /dev/sr0 /mnt
mount /dev/vg_mysql/lv_mysql /usr/local/mysql
[root@web apache2]# vim /etc/rc.local
[root@web apache2]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
mount -o ro /dev/sr0 /mnt
mount /dev/vg_mysql/lv_mysql /usr/local/mysql/
您在 /var/spool/mail/root 中有邮件

service mysql start

[root@web apache2]# service mysql start
Starting MySQL. SUCCESS!

service apache start

[root@web apache2]# service apache staet
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
[root@web apache2]# service apache start
Redirecting to /bin/systemctl start apache.service
Failed to start apache.service: Unit not found.

测试

在这里插入图片描述

记录

192.168.235.20

root@192.168.235.20's password:
     ┌────────────────────────────────────────────────────────────────────┐
     │                        • MobaXterm 20.0 •                          │
     │            (SSH client, X-server and networking tools)             │
     │                                                                    │
     │ ➤ SSH session to root@192.168.235.20                               │
     │   • SSH compression : ✘                                            │
     │   • SSH-browser     : ✔                                            │
     │   • X11-forwarding  : ✔  (remote display is forwarded through SSH) │
     │   • DISPLAY         : ✔  (automatically set on remote server)      │
     │                                                                    │
     │ ➤ For more info, ctrl+click on help or visit our website           │
     └────────────────────────────────────────────────────────────────────┘

Last login: Tue Jul 15 19:01:41 2025 from 192.168.235.1
[root@web ~]# hostname
web.cn
[root@web ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part /u01
├─sdb2            8:18   0    1G  0 part /u2
├─sdb3            8:19   0    1G  0 part /u05/test
├─sdb4            8:20   0    1K  0 part
├─sdb5            8:21   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm  /u06
├─sdb6            8:22   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm  /u06
├─sdb7            8:23   0    1G  0 part
│ ├─vg01-lv01   253:2    0  3.1G  0 lvm  /u06
│ ├─vg01-lv02   253:3    0  120M  0 lvm
│ └─vg01-lv03   253:4    0   36M  0 lvm
├─sdb8            8:24   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm  /u06
└─sdb9            8:25   0  900M  0 part
sr0              11:0    1  4.4G  0 rom  /mnt
您在 /var/spool/mail/root 中有新邮件
[root@web ~]# vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  centos   1   2   0 wz--n- <19.00g      0
  vg01     4   3   0 wz--n-   3.98g 764.00m
[root@web ~]# pvs
  PV         VG     Fmt  Attr PSize    PFree
  /dev/sda2  centos lvm2 a--   <19.00g      0
  /dev/sdb5  vg01   lvm2 a--  1020.00m 724.00m
  /dev/sdb6  vg01   lvm2 a--  1020.00m      0
  /dev/sdb7  vg01   lvm2 a--  1020.00m  40.00m
  /dev/sdb8  vg01   lvm2 a--  1020.00m      0
[root@web ~]# lvs
  LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- <17.00g
  swap centos -wi-ao----   2.00g
  lv01 vg01   -wi-ao----  <3.09g
  lv02 vg01   -wi-a----- 120.00m
  lv03 vg01   -wi-a-----  36.00m
[root@web ~]# reboot

Remote side unexpectedly closed network connection

───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Session stopped
    - Press <return> to exit tab
    - Press R to restart session
    - Press S to save terminal output to file
root@192.168.235.20's password:
▒▒▒ʱ▒▒ܾ▒
root@192.168.235.20's password:
     ┌────────────────────────────────────────────────────────────────────┐
     │                        • MobaXterm 20.0 •                          │
     │            (SSH client, X-server and networking tools)             │
     │                                                                    │
     │ ➤ SSH session to root@192.168.235.20                               │
     │   • SSH compression : ✘                                            │
     │   • SSH-browser     : ✔                                            │
     │   • X11-forwarding  : ✔  (remote display is forwarded through SSH) │
     │   • DISPLAY         : ✔  (automatically set on remote server)      │
     │                                                                    │
     │ ➤ For more info, ctrl+click on help or visit our website           │
     └────────────────────────────────────────────────────────────────────┘

Last failed login: Wed Jul 16 19:34:54 CST 2025 from 192.168.235.1 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Wed Jul 16 19:14:41 2025 from 192.168.235.1
[root@web ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part
├─sdb2            8:18   0    1G  0 part /u2
├─sdb3            8:19   0    1G  0 part
├─sdb4            8:20   0    1K  0 part
├─sdb5            8:21   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb6            8:22   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb7            8:23   0    1G  0 part
│ ├─vg01-lv01   253:2    0  3.1G  0 lvm
│ ├─vg01-lv02   253:3    0  120M  0 lvm
│ └─vg01-lv03   253:4    0   36M  0 lvm
├─sdb8            8:24   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
└─sdb9            8:25   0  900M  0 part
sdc               8:32   0   10G  0 disk
sr0              11:0    1  4.4G  0 rom  /mnt
您在 /var/spool/mail/root 中有新邮件
[root@web ~]# fdisk -l

磁盘 /dev/sdb:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x4f05a8ca

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     2099199     1048576   83  Linux
/dev/sdb2         2099200     4196351     1048576   83  Linux
/dev/sdb3         4196352     6293503     1048576   83  Linux
/dev/sdb4         6293504    16779263     5242880    5  Extended
/dev/sdb5         6295552     8392703     1048576   83  Linux
/dev/sdb6         8394752    10491903     1048576   83  Linux
/dev/sdb7        10493952    12591103     1048576   83  Linux
/dev/sdb8        12593152    14690303     1048576   83  Linux
/dev/sdb9        14692352    16535551      921600   83  Linux

磁盘 /dev/sda:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x0009cef4

   设备 Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    41943039    19921920   8e  Linux LVM

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/centos-root:18.2 GB, 18249416704 字节,35643392 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/vg01-lv01:3313 MB, 3313500160 字节,6471680 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/vg01-lv02:125 MB, 125829120 字节,245760 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/vg01-lv03:37 MB, 37748736 字节,73728 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节

您在 /var/spool/mail/root 中有邮件
[root@web ~]# fdisk /dev/sdc
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0x14965c09 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-20971519,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-20971519,默认为 20971519):+2G
分区 1 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
分区号 (2-4,默认 2):
起始 扇区 (4196352-20971519,默认为 4196352):
将使用默认值 4196352
Last 扇区, +扇区 or +size{K,M,G} (4196352-20971519,默认为 20971519):+2G
分区 2 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x14965c09

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x14965c09

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux

命令(输入 m 获取帮助):N
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): E
分区号 (3,4,默认 3):
起始 扇区 (8390656-20971519,默认为 8390656):
将使用默认值 8390656
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+7G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6H
不支持的后缀:“H”。
支持:10^N: KB (千字节), MB (兆字节), GB (吉字节)
            2^N: K  (约千字节), M  (约兆字节), G  (约吉字节)
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+7G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):^C
您在 /var/spool/mail/root 中有邮件
[root@web ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part
├─sdb2            8:18   0    1G  0 part /u2
├─sdb3            8:19   0    1G  0 part
├─sdb4            8:20   0    1K  0 part
├─sdb5            8:21   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb6            8:22   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb7            8:23   0    1G  0 part
│ ├─vg01-lv01   253:2    0  3.1G  0 lvm
│ ├─vg01-lv02   253:3    0  120M  0 lvm
│ └─vg01-lv03   253:4    0   36M  0 lvm
├─sdb8            8:24   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
└─sdb9            8:25   0  900M  0 part
sdc               8:32   0   10G  0 disk
sr0              11:0    1  4.4G  0 rom  /mnt
[root@web ~]# fdisk /dev/sdc
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

Device does not contain a recognized partition table
使用磁盘标识符 0xc48e4d33 创建新的 DOS 磁盘标签。

命令(输入 m 获取帮助):m
命令操作
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

命令(输入 m 获取帮助):l

 024  NEC DOS         81  Minix / 旧 Linu bf  Solaris
 1  FAT12           27  隐藏的 NTFS Win 82  Linux 交换 / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 隐藏的 C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux 扩展      c7  Syrinx
 5  扩展            41  PPC PReP Boot   86  NTFS 卷集       da  非文件系统数据
 6  FAT16           42  SFS             87  NTFS 卷集       db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux 纯文本    de  Dell 工具
 8  AIX             4e  QNX4.x 第2部分  8e  Linux LVM       df  BootIt
 9  AIX 可启动      4f  QNX4.x 第3部分  93  Amoeba          e1  DOS 访问
 a  OS/2 启动管理器 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad 休 eb  BeOS fs
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT
 f  W95 扩展 (LBA)  54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC
11  隐藏的 FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor
12  Compaq 诊断     5c  Priam Edisk     a9  NetBSD          f4  SpeedStor
14  隐藏的 FAT16 <3 61  SpeedStor       ab  Darwin 启动     f2  DOS 次要
16  隐藏的 FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS
17  隐藏的 HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST 智能睡眠    65  Novell Netware  b8  BSDI swap       fd  Linux raid 自动
1b  隐藏的 W95 FAT3 70  DiskSecure 多启 bb  Boot Wizard 隐  fe  LANstep
1c  隐藏的 W95 FAT3 75  PC/IX           be  Solaris 启动    ff  BBT
1e  隐藏的 W95 FAT1 80  旧 Minix

命令(输入 m 获取帮助):p

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System

命令(输入 m 获取帮助):n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-20971519,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-20971519,默认为 20971519):+2G
分区 1 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):N
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): P
分区号 (2-4,默认 2):
起始 扇区 (4196352-20971519,默认为 4196352):
将使用默认值 4196352
Last 扇区, +扇区 or +size{K,M,G} (4196352-20971519,默认为 20971519):+2G
分区 2 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):p

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux

命令(输入 m 获取帮助):n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): e
分区号 (3,4,默认 3):
起始 扇区 (8390656-20971519,默认为 8390656):
将使用默认值 8390656
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6g
不支持的后缀:“g”。
支持:10^N: KB (千字节), MB (兆字节), GB (吉字节)
            2^N: K  (约千字节), M  (约兆字节), G  (约吉字节)
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+5.9G
不支持的后缀:“.9G”。
支持:10^N: KB (千字节), MB (兆字节), GB (吉字节)
            2^N: K  (约千字节), M  (约兆字节), G  (约吉字节)
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+6G
值超出范围。
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+5.6G
不支持的后缀:“.6G”。
支持:10^N: KB (千字节), MB (兆字节), GB (吉字节)
            2^N: K  (约千字节), M  (约兆字节), G  (约吉字节)
Last 扇区, +扇区 or +size{K,M,G} (8390656-20971519,默认为 20971519):+5G
分区 3 已设置为 Extended 类型,大小设为 5 GiB

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux
/dev/sdc3         8390656    18876415     5242880    5  Extended

命令(输入 m 获取帮助):N
Partition type:
   p   primary (2 primary, 1 extended, 1 free)
   l   logical (numbered from 5)
Select (default p): L
添加逻辑分区 5
起始 扇区 (8392704-18876415,默认为 8392704):
将使用默认值 8392704
Last 扇区, +扇区 or +size{K,M,G} (8392704-18876415,默认为 18876415):+2G
分区 5 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux
/dev/sdc3         8390656    18876415     5242880    5  Extended
/dev/sdc5         8392704    12587007     2097152   83  Linux

命令(输入 m 获取帮助):N
Partition type:
   p   primary (2 primary, 1 extended, 1 free)
   l   logical (numbered from 5)
Select (default p): L
添加逻辑分区 6
起始 扇区 (12589056-18876415,默认为 12589056):+2G
值超出范围。
起始 扇区 (12589056-18876415,默认为 12589056):P
起始 扇区 (12589056-18876415,默认为 12589056):
将使用默认值 12589056
Last 扇区, +扇区 or +size{K,M,G} (12589056-18876415,默认为 18876415):+2G
分区 6 已设置为 Linux 类型,大小设为 2 GiB

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux
/dev/sdc3         8390656    18876415     5242880    5  Extended
/dev/sdc5         8392704    12587007     2097152   83  Linux
/dev/sdc6        12589056    16783359     2097152   83  Linux

命令(输入 m 获取帮助):N
Partition type:
   p   primary (2 primary, 1 extended, 1 free)
   l   logical (numbered from 5)
Select (default p): L
添加逻辑分区 7
起始 扇区 (16785408-18876415,默认为 16785408):
将使用默认值 16785408
Last 扇区, +扇区 or +size{K,M,G} (16785408-18876415,默认为 18876415):+900M
分区 7 已设置为 Linux 类型,大小设为 900 MiB

命令(输入 m 获取帮助):L

 024  NEC DOS         81  Minix / 旧 Linu bf  Solaris
 1  FAT12           27  隐藏的 NTFS Win 82  Linux 交换 / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 隐藏的 C:  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux 扩展      c7  Syrinx
 5  扩展            41  PPC PReP Boot   86  NTFS 卷集       da  非文件系统数据
 6  FAT16           42  SFS             87  NTFS 卷集       db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux 纯文本    de  Dell 工具
 8  AIX             4e  QNX4.x 第2部分  8e  Linux LVM       df  BootIt
 9  AIX 可启动      4f  QNX4.x 第3部分  93  Amoeba          e1  DOS 访问
 a  OS/2 启动管理器 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad 休 eb  BeOS fs
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT
 f  W95 扩展 (LBA)  54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC
11  隐藏的 FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor
12  Compaq 诊断     5c  Priam Edisk     a9  NetBSD          f4  SpeedStor
14  隐藏的 FAT16 <3 61  SpeedStor       ab  Darwin 启动     f2  DOS 次要
16  隐藏的 FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS
17  隐藏的 HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE
18  AST 智能睡眠    65  Novell Netware  b8  BSDI swap       fd  Linux raid 自动
1b  隐藏的 W95 FAT3 70  DiskSecure 多启 bb  Boot Wizard 隐  fe  LANstep
1c  隐藏的 W95 FAT3 75  PC/IX           be  Solaris 启动    ff  BBT
1e  隐藏的 W95 FAT1 80  旧 Minix

命令(输入 m 获取帮助):P

磁盘 /dev/sdc:10.7 GB, 10737418240 字节,20971520 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xc48e4d33

   设备 Boot      Start         End      Blocks   Id  System
/dev/sdc1            2048     4196351     2097152   83  Linux
/dev/sdc2         4196352     8390655     2097152   83  Linux
/dev/sdc3         8390656    18876415     5242880    5  Extended
/dev/sdc5         8392704    12587007     2097152   83  Linux
/dev/sdc6        12589056    16783359     2097152   83  Linux
/dev/sdc7        16785408    18628607      921600   83  Linux

命令(输入 m 获取帮助):M
命令操作
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

命令(输入 m 获取帮助):W
The partition table has been altered!

Calling ioctl() to re-read partition table.
正在同步磁盘。
您在 /var/spool/mail/root 中有邮件
[root@web ~]# LSBLK
bash: LSBLK: 未找到命令...
相似命令是: 'lsblk'
[root@web ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part
├─sdb2            8:18   0    1G  0 part /u2
├─sdb3            8:19   0    1G  0 part
├─sdb4            8:20   0    1K  0 part
├─sdb5            8:21   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb6            8:22   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb7            8:23   0    1G  0 part
│ ├─vg01-lv01   253:2    0  3.1G  0 lvm
│ ├─vg01-lv02   253:3    0  120M  0 lvm
│ └─vg01-lv03   253:4    0   36M  0 lvm
├─sdb8            8:24   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
└─sdb9            8:25   0  900M  0 part
sdc               8:32   0   10G  0 disk
├─sdc1            8:33   0    2G  0 part
├─sdc2            8:34   0    2G  0 part
├─sdc3            8:35   0    1K  0 part
├─sdc5            8:37   0    2G  0 part
├─sdc6            8:38   0    2G  0 part
└─sdc7            8:39   0  900M  0 part
sr0              11:0    1  4.4G  0 rom  /mnt
[root@web ~]# partx -a /dev/sdc
partx: /dev/sdc: error adding partitions 1-3
partx: /dev/sdc: error adding partitions 5-7
您在 /var/spool/mail/root 中有邮件
[root@web ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0   20G  0 disk
├─sda1            8:1    0    1G  0 part /boot
└─sda2            8:2    0   19G  0 part
  ├─centos-root 253:0    0   17G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sdb               8:16   0   10G  0 disk
├─sdb1            8:17   0    1G  0 part
├─sdb2            8:18   0    1G  0 part /u2
├─sdb3            8:19   0    1G  0 part
├─sdb4            8:20   0    1K  0 part
├─sdb5            8:21   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb6            8:22   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
├─sdb7            8:23   0    1G  0 part
│ ├─vg01-lv01   253:2    0  3.1G  0 lvm
│ ├─vg01-lv02   253:3    0  120M  0 lvm
│ └─vg01-lv03   253:4    0   36M  0 lvm
├─sdb8            8:24   0    1G  0 part
│ └─vg01-lv01   253:2    0  3.1G  0 lvm
└─sdb9            8:25   0  900M  0 part
sdc               8:32   0   10G  0 disk
├─sdc1            8:33   0    2G  0 part
├─sdc2            8:34   0    2G  0 part
├─sdc3            8:35   0    1K  0 part
├─sdc5            8:37   0    2G  0 part
├─sdc6            8:38   0    2G  0 part
└─sdc7            8:39   0  900M  0 part
sr0              11:0    1  4.4G  0 rom  /mnt
[root@web ~]# pvcreate /dev/sdc[12567]
  Physical volume "/dev/sdc1" successfully created.
  Physical volume "/dev/sdc2" successfully created.
  Physical volume "/dev/sdc5" successfully created.
  Physical volume "/dev/sdc6" successfully created.
  Physical volume "/dev/sdc7" successfully created.
您在 /var/spool/mail/root 中有邮件
[root@web ~]# vgs vg_mysql
  Volume group "vg_mysql" not found
  Cannot process volume group vg_mysql
您在 /var/spool/mail/root 中有邮件
[root@web ~]# vgcreate vg_mysql /dev/sdc[12567]
  Volume group "vg_mysql" successfully created
您在 /var/spool/mail/root 中有邮件
[root@web ~]# vgs vg_mysql
  VG       #PV #LV #SN Attr   VSize  VFree
  vg_mysql   5   0   0 wz--n- <8.86g <8.86g
[root@web ~]# lvcreate -n lv_mysql -L 8G vg_mysql
  Logical volume "lv_mysql" created.
您在 /var/spool/mail/root 中有邮件
[root@web ~]# lvs /dev/vg_mysql/lv_mysql
  LV       VG       Attr       LSize Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_mysql vg_mysql -wi-a----- 8.00g
您在 /var/spool/mail/root 中有邮件
[root@web ~]# mkfs.ext4 /dev/vg_mysql/lv_mysql
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
524288 inodes, 2097152 blocks
104857 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2147483648
64 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成

[root@web ~]# ls /
1.java  35.txt  5.java  bin      code  dev         home  lib64  oo .pcapng  rhome  samba  srv  u01  u07  var
2041    3.java  app     boot     data  etc         java  media  opt         root   sbin   sys  u03  u2   www
2.java  4.java  app1    cc.conf  date  file3.java  lib   mnt    proc        run    shop   tmp  u06  usr
[root@web ~]# mkdir /u1
您在 /var/spool/mail/root 中有邮件
[root@web ~]# mount /dev/vg_mysql/lv_mysql /u1
您在 /var/spool/mail/root 中有邮件
[root@web ~]# systemctl status apache
Unit apache.service could not be found.
[root@web ~]# rpm -ql apache
未安装软件包 apache
[root@web ~]# hostname
web.cn
您在 /var/spool/mail/root 中有邮件
[root@web ~]# yum install cmake
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 cmake-2.8.12.2-2.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@web ~]# systemctl status NetworkManager
● NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:NetworkManager(8)
[root@web ~]# setenforce 0
setenforce: SELinux is disabled
[root@web ~]# yum install pcre-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 pcre-devel-8.32-17.el7.x86_64 已安装并且是最新版本
无须任何处理
您在 /var/spool/mail/root 中有邮件
[root@web ~]# yum install ncurses-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 ncurses-devel-5.9-14.20130511.el7_4.x86_64 已安装并且是最新版本
无须任何处理
[root@web ~]# yum install openssl
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 1:openssl-1.0.2k-19.el7.x86_64 已安装并且是最新版本
无须任何处理
您在 /var/spool/mail/root 中有邮件
[root@web ~]# tail -5 /etc/passwd
OOO:x:1020:1020::/home/OOO:/bin/bash
jerry:x:1021:1229::/home/jerry:/bin/bash
kefu:x:1022:1022::/home/kefu:/bin/bash
kefu2:x:1023:1023::/home/kefu2:/bin/bash
user01:x:1024:1024::/home/user01:/bin/bash
[root@web ~]# useradd -r -s /sbin/nologin mysql
useradd:用户“mysql”已存在
您在 /var/spool/mail/root 中有邮件
[root@web ~]# cd /
[root@web /]# ls
1.java  35.txt  5.java  bin      code  dev         home  lib64  oo .pcapng  rhome  samba  srv  u01  u07  usr
2041    3.java  app     boot     data  etc         java  media  opt         root   sbin   sys  u03  u1   var
2.java  4.java  app1    cc.conf  date  file3.java  lib   mnt    proc        run    shop   tmp  u06  u2   www
[root@web /]# cd /root
[root@web ~]# ls
1828.txt         app                     axel-2.4.tar.gz  httpd-2.4.37               ok                 Steam.dll
1837.txt         apr-1.5.2               bb.conf          httpd-2.4.37.tar.bz2       okl                wordpress
2-1.java         apr-1.5.2.tar.bz2       cc.conf          initial-setup-ks.cfg       php-7.2.17         wordpress-4.7.3-zh_CN.tar.gz
2.java           apr-util-1.5.4          code             inotify-tools-3.13.tar.gz  php-7.2.17.tar.xz
alll1            apr-util-1.5.4.tar.bz2  file20.java      mysql-5.6.31               readme7
anaconda-ks.cfg  axel-2.4                file23.java      mysql-5.6.31.tar.gz        readme.txt
[root@web ~]# cd mysql-5.6.31/
[root@web mysql-5.6.31]# cat cmake.sh
cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DMYSQL_TCP_PORT=3306 \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DMYSQL_USER=mysql

[root@web mysql-5.6.31]# ll cmake.sh
-rwxr-xr-x 1 root root 296 6月  29 20:46 cmake.sh
您在 /var/spool/mail/root 中有邮件
[root@web mysql-5.6.31]# ls /usr/local/mysql
bin  COPYING  data  docs  include  lib  man  my.cnf  my-new.cnf  mysql-test  README  scripts  share  sql-bench  support-files
[root@web mysql-5.6.31]# ll -d /usr/local/mysql
drwxr-xr-x 13 mysql mysql 223 7月   1 21:42 /usr/local/mysql
您在 /var/spool/mail/root 中有邮件
[root@web mysql-5.6.31]# chown -R mysql.mysql /usr/local/mysql
[root@web mysql-5.6.31]# cat /etc/my.cnf
cat: /etc/my.cnf: 没有那个文件或目录
[root@web mysql-5.6.31]# ls /etc/my.cnf
ls: 无法访问/etc/my.cnf: 没有那个文件或目录
您在 /var/spool/mail/root 中有邮件
[root@web mysql-5.6.31]# ls /etc
abrt                       dbus-1                      gss             mail.rc                   profile.d         speech-dispatcher
adjtime                    dconf                       gssproxy        makedumpfile.conf.sample  protocols         ssh
aliases                    default                     host.conf       man_db.conf               pulse             ssl
aliases.db                 depmod.d                    hostname        maven                     purple            sssd
alsa                       dhcp                        hosts           mime.types                python            statetab
alternatives               DIR_COLORS                  hosts.allow     mke2fs.conf               qemu-ga           statetab.d
anacrontab                 DIR_COLORS.256color         hosts.deny      modprobe.d                qemu-kvm          subgid
asound.conf                DIR_COLORS.lightbgcolor     hp              modules-load.d            radvd.conf        subgid-
at.deny                    dleyna-server-service.conf  idmapd.conf     motd                      rc0.d             subuid
audisp                     dnsmasq.conf                init.d          mtab                      rc1.d             subuid-
audit                      dnsmasq.d                   inittab         mtools.conf               rc2.d             subversion
autofs.conf                dracut.conf                 inputrc         multipath                 rc3.d             sudo.conf
autofs_ldap_auth.conf      dracut.conf.d               ipa             my.cnf.d                  rc4.d             sudoers
auto.master                e2fsck.conf                 iproute2        nanorc                    rc5.d             sudoers.d
auto.master.d              egl                         ipsec.conf      ndctl                     rc6.d             sudo-ldap.conf
auto.misc                  enscript.cfg                ipsec.d         netconfig                 rc.d              sysconfig
auto.net                   environment                 ipsec.secrets   NetworkManager            rc.local          sysctl.conf
auto.notes                 ethertypes                  iscsi           networks                  rdma              sysctl.d
auto.smb                   exports                     issue           nfs.conf                  redhat-release    systemd
auto.test                  exports.d                   issue.net       nfsmount.conf             request-key.conf  system-release
avahi                      favicon.png                 java            nsswitch.conf             request-key.d     system-release-cpe
bash_completion.d          fcoe                        jvm             nsswitch.conf.bak         resolv.conf       target
bashrc                     festival                    jvm-commmon     ntp                       resolv.conf.save  tcsd.conf
binfmt.d                   filesystems                 kdump.conf      ntp.conf                  rpc               terminfo
bluetooth                  firefox                     kernel          numad.conf                rpm               tmpfiles.d
brltty                     firewalld                   krb5.conf       oddjob                    rsyncd.conf       trusted-key.key
brltty.conf                flatpak                     krb5.conf.d     oddjobd.conf              rsyncd.secrets    tuned
centos-release             fonts                       ksmtuned.conf   oddjobd.conf.d            rsyslog.conf      udev
centos-release-upstream    fprintd.conf                ld.so.cache     openldap                  rsyslog.d         udisks2
certmonger                 fstab                       ld.so.conf      opt                       rwtab             unbound
cgconfig.conf              fuse.conf                   ld.so.conf.d    os-release                rwtab.d           updatedb.conf
cgconfig.d                 fwupd                       lftp.conf       PackageKit                samba             UPower
cgrules.conf               gconf                       libaudit.conf   pam.d                     sane.d            usb_modeswitch.conf
cgsnapshot_blacklist.conf  gcrypt                      libblockdev     papersize                 sasl2             vconsole.conf
chkconfig.d                gdbinit                     libibverbs.d    passwd                    scl               vimrc
chrony.conf                gdbinit.d                   libnl           passwd-                   securetty         virc
chrony.keys                gdm                         libpaper.d      pbm2ppa.conf              security          vmware-tools
cifs-utils                 geoclue                     libreport       pinforc                   selinux           vsftpd
cron.d                     GeoIP.conf                  libuser.conf    pkcs11                    services          wgetrc
cron.daily                 ghostscript                 libvirt         pki                       sestatus.conf     wpa_supplicant
cron.deny                  glvnd                       locale.conf     plymouth                  setroubleshoot    wvdial.conf
cron.hourly                gnupg                       localtime       pm                        setuptool.d       X11
cron.monthly               GREP_COLORS                 login.defs      pnm2ppa.conf              sgml              xdg
crontab                    groff                       logrotate.conf  polkit-1                  shadow            xinetd.conf
cron.weekly                group                       logrotate.d     popt.d                    shadow-           xinetd.d
crypttab                   group-                      lsm             postfix                   shells            xml
csh.cshrc                  grub2.cfg                   lvm             ppp                       skel              yum
csh.login                  grub.d                      machine-id      prelink.conf.d            smartmontools     yum.conf
cups                       gshadow                     magic           printcap                  smi.conf          yum.repos.d
cupshelpers                gshadow-                    mailcap         profile                   sos.conf          yum.repos.d.backup
[root@web mysql-5.6.31]# find /etc -name my.cnf
您在 /var/spool/mail/root 中有邮件
[root@web mysql-5.6.31]# find /etc -name my.cnf
[root@web mysql-5.6.31]# rm -f /etc/my.cnf\
> ^C
[root@web mysql-5.6.31]# cd /usr/local/mysql/
[root@web mysql]# ./scripts/mysql_install_db --user=mysql
Installing MySQL system tables...2025-07-16 20:38:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2025-07-16 20:38:59 0 [Note] ./bin/mysqld (mysqld 5.6.31) starting as process 26925 ...
2025-07-16 20:38:59 26925 [Note] InnoDB: Using atomics to ref count buffer pool pages
2025-07-16 20:38:59 26925 [Note] InnoDB: The InnoDB memory heap is disabled
2025-07-16 20:38:59 26925 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2025-07-16 20:38:59 26925 [Note] InnoDB: Memory barrier is not used
2025-07-16 20:38:59 26925 [Note] InnoDB: Compressed tables use zlib 1.2.3
2025-07-16 20:38:59 26925 [Note] InnoDB: Using CPU crc32 instructions
2025-07-16 20:38:59 26925 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2025-07-16 20:38:59 26925 [Note] InnoDB: Completed initialization of buffer pool
2025-07-16 20:38:59 26925 [Note] InnoDB: Highest supported file format is Barracuda.
2025-07-16 20:38:59 26925 [Note] InnoDB: The log sequence numbers 1626017 and 1626017 in ibdata files do not match the log sequence number 2548967 in the ib_logfiles!
2025-07-16 20:38:59 26925 [Note] InnoDB: Database was not shutdown normally!
2025-07-16 20:38:59 26925 [Note] InnoDB: Starting crash recovery.
2025-07-16 20:38:59 26925 [Note] InnoDB: Reading tablespace information from the .ibd files...
2025-07-16 20:38:59 26925 [Note] InnoDB: Restoring possible half-written data pages
2025-07-16 20:38:59 26925 [Note] InnoDB: from the doublewrite buffer...
2025-07-16 20:38:59 26925 [Note] InnoDB: 128 rollback segment(s) are active.
2025-07-16 20:38:59 26925 [Note] InnoDB: Waiting for purge to start
2025-07-16 20:38:59 26925 [Note] InnoDB: 5.6.31 started; log sequence number 2548967
2025-07-16 20:38:59 26925 [Note] Binlog end
2025-07-16 20:38:59 26925 [Note] InnoDB: FTS optimize thread exiting.
2025-07-16 20:38:59 26925 [Note] InnoDB: Starting shutdown...
2025-07-16 20:39:01 26925 [Note] InnoDB: Shutdown completed; log sequence number 2548977
OK

Filling help tables...2025-07-16 20:39:01 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2025-07-16 20:39:01 0 [Note] ./bin/mysqld (mysqld 5.6.31) starting as process 26961 ...
2025-07-16 20:39:01 26961 [Note] InnoDB: Using atomics to ref count buffer pool pages
2025-07-16 20:39:01 26961 [Note] InnoDB: The InnoDB memory heap is disabled
2025-07-16 20:39:01 26961 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2025-07-16 20:39:01 26961 [Note] InnoDB: Memory barrier is not used
2025-07-16 20:39:01 26961 [Note] InnoDB: Compressed tables use zlib 1.2.3
2025-07-16 20:39:01 26961 [Note] InnoDB: Using CPU crc32 instructions
2025-07-16 20:39:01 26961 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2025-07-16 20:39:01 26961 [Note] InnoDB: Completed initialization of buffer pool
2025-07-16 20:39:01 26961 [Note] InnoDB: Highest supported file format is Barracuda.
2025-07-16 20:39:01 26961 [Note] InnoDB: 128 rollback segment(s) are active.
2025-07-16 20:39:01 26961 [Note] InnoDB: Waiting for purge to start
2025-07-16 20:39:01 26961 [Note] InnoDB: 5.6.31 started; log sequence number 2548977
2025-07-16 20:39:01 26961 [Note] Binlog end
2025-07-16 20:39:01 26961 [Note] InnoDB: FTS optimize thread exiting.
2025-07-16 20:39:01 26961 [Note] InnoDB: Starting shutdown...
2025-07-16 20:39:02 26961 [Note] InnoDB: Shutdown completed; log sequence number 2548987
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

  ./bin/mysqladmin -u root password 'new-password'
  ./bin/mysqladmin -u root -h web.cn password 'new-password'

Alternatively you can run:

  ./bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

  cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

  cd mysql-test ; perl mysql-test-run.pl

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

  http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

WARNING: Found existing config file ./my.cnf on the system.
Because this file might be in use, it was not replaced,
but was used in bootstrap (unless you used --defaults-file)
and when you later start the server.
The new default config file was created as ./my-new.cnf,
please compare it with your file and take the changes you need.

您在 /var/spool/mail/root 中有邮件
[root@web mysql]# ll data
总用量 176152
-rw-rw---- 1 mysql mysql       56 6月  29 21:59 auto.cnf
drwx------ 2 mysql mysql     4096 7月   1 23:53 blog
-rw-rw---- 1 mysql mysql 79691776 7月  16 20:39 ibdata1
-rw-rw---- 1 mysql mysql 50331648 7月  16 20:39 ib_logfile0
-rw-rw---- 1 mysql mysql 50331648 6月  29 21:58 ib_logfile1
drwx------ 2 mysql mysql     4096 6月  29 21:58 mysql
drwx------ 2 mysql mysql     4096 7月  16 20:38 performance_schema
drwxr-xr-x 2 mysql mysql       20 6月  29 21:02 test
-rw-r----- 1 mysql mysql     3946 7月   1 21:49 web.cn.err
-rw-rw---- 1 mysql mysql        6 7月   1 21:49 web.cn.pid
[root@web mysql]# cat /etc/init.d/mysql
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind

# MySQL daemon start/stop script.

# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.

# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 64 36
# description: A very fast and reliable SQL database engine.

# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $local_fs $network $remote_fs
# Should-Start: ypbind nscd ldap ntpd xntpd
# Required-Stop: $local_fs $network $remote_fs
# Default-Start:  2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO

# If you install MySQL on some other places than /usr/local/mysql, then you
# have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
#   [mysqld]
#   basedir=<path-to-mysql-installation-directory>
# - Add the above to any other configuration file (for example ~/.my.ini)
#   and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directory to the basedir variable
#   below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.

# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.

basedir=
datadir=

# Default value, in seconds, afterwhich the script should timeout waiting
# for server start.
# Value here is overriden by value in my.cnf.
# 0 means don't wait at all
# Negative numbers mean to wait indefinitely
service_startup_timeout=900

# Lock directory for RedHat / SuSE.
lockdir='/var/lock/subsys'
lock_file_path="$lockdir/mysql"

# The following variables are only set for letting mysql.server find things.

# Set some defaults
mysqld_pid_file_path=
if test -z "$basedir"
then
  basedir=/usr/local/mysql
  bindir=/usr/local/mysql/bin
  if test -z "$datadir"
  then
    datadir=/usr/local/mysql/data
  fi
  sbindir=/usr/local/mysql/bin
  libexecdir=/usr/local/mysql/bin
else
  bindir="$basedir/bin"
  if test -z "$datadir"
  then
    datadir="$basedir/data"
  fi
  sbindir="$basedir/sbin"
  libexecdir="$basedir/libexec"
fi

# datadir_set is used to determine if datadir was set (and so should be
# *not* set inside of the --basedir= handler.)
datadir_set=

#
# Use LSB init script functions for printing messages, if possible
#
lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then
  . $lsb_functions
else
  log_success_msg()
  {
    echo " SUCCESS! $@"
  }
  log_failure_msg()
  {
    echo " ERROR! $@"
  }
fi

PATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin"
export PATH

mode=$1    # start or stop

[ $# -ge 1 ] && shift


other_args="$*"   # uncommon, but needed when called from an RPM upgrade action
           # Expected: "--skip-networking --skip-grant-tables"
           # They are not checked here, intentionally, as it is the resposibility
           # of the "spec" file author to give correct arguments only.

case `echo "testing\c"`,`echo -n testing` in
    *c*,-n*) echo_n=   echo_c=     ;;
    *c*,*)   echo_n=-n echo_c=     ;;
    *)       echo_n=   echo_c='\c' ;;
esac

parse_server_arguments() {
  for arg do
    case "$arg" in
      --basedir=*)  basedir=`echo "$arg" | sed -e 's/^[^=]*=//'`
                    bindir="$basedir/bin"
                    if test -z "$datadir_set"; then
                      datadir="$basedir/data"
                    fi
                    sbindir="$basedir/sbin"
                    libexecdir="$basedir/libexec"
        ;;
      --datadir=*)  datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
                    datadir_set=1
        ;;
      --pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
      --service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
    esac
  done
}

wait_for_pid () {
  verb="$1"           # created | removed
  pid="$2"            # process ID of the program operating on the pid-file
  pid_file_path="$3" # path to the PID file.

  i=0
  avoid_race_condition="by checking again"

  while test $i -ne $service_startup_timeout ; do

    case "$verb" in
      'created')
        # wait for a PID-file to pop into existence.
        test -s "$pid_file_path" && i='' && break
        ;;
      'removed')
        # wait for this PID-file to disappear
        test ! -s "$pid_file_path" && i='' && break
        ;;
      *)
        echo "wait_for_pid () usage: wait_for_pid created|removed pid pid_file_path"
        exit 1
        ;;
    esac

    # if server isn't running, then pid-file will never be updated
    if test -n "$pid"; then
      if kill -0 "$pid" 2>/dev/null; then
        :  # the server still runs
      else
        # The server may have exited between the last pid-file check and now.
        if test -n "$avoid_race_condition"; then
          avoid_race_condition=""
          continue  # Check again.
        fi

        # there's nothing that will affect the file.
        log_failure_msg "The server quit without updating PID file ($pid_file_path)."
        return 1  # not waiting any more.
      fi
    fi

    echo $echo_n ".$echo_c"
    i=`expr $i + 1`
    sleep 1

  done

  if test -z "$i" ; then
    log_success_msg
    return 0
  else
    log_failure_msg
    return 1
  fi
}

# Get arguments from the my.cnf file,
# the only group, which is read from now on is [mysqld]
if test -x ./bin/my_print_defaults
then
  print_defaults="./bin/my_print_defaults"
elif test -x $bindir/my_print_defaults
then
  print_defaults="$bindir/my_print_defaults"
elif test -x $bindir/mysql_print_defaults
then
  print_defaults="$bindir/mysql_print_defaults"
else
  # Try to find basedir in /etc/my.cnf
  conf=/etc/my.cnf
  print_defaults=
  if test -r $conf
  then
    subpat='^[^=]*basedir[^=]*=\(.*\)$'
    dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
    for d in $dirs
    do
      d=`echo $d | sed -e 's/[  ]//g'`
      if test -x "$d/bin/my_print_defaults"
      then
        print_defaults="$d/bin/my_print_defaults"
        break
      fi
      if test -x "$d/bin/mysql_print_defaults"
      then
        print_defaults="$d/bin/mysql_print_defaults"
        break
      fi
    done
  fi

  # Hope it's in the PATH ... but I doubt it
  test -z "$print_defaults" && print_defaults="my_print_defaults"
fi

#
# Read defaults file from 'basedir'.   If there is no defaults file there
# check if it's in the old (depricated) place (datadir) and read it from there
#

extra_args=""
if test -r "$basedir/my.cnf"
then
  extra_args="-e $basedir/my.cnf"
else
  if test -r "$datadir/my.cnf"
  then
    extra_args="-e $datadir/my.cnf"
  fi
fi

parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`

#
# Set pid file if not given
#
if test -z "$mysqld_pid_file_path"
then
  mysqld_pid_file_path=$datadir/`hostname`.pid
else
  case "$mysqld_pid_file_path" in
    /* ) ;;
    * )  mysqld_pid_file_path="$datadir/$mysqld_pid_file_path" ;;
  esac
fi

case "$mode" in
  'start')
    # Start daemon

    # Safeguard (relative paths, core dumps..)
    cd $basedir

    echo $echo_n "Starting MySQL"
    if test -x $bindir/mysqld_safe
    then
      # Give extra arguments to mysqld with the my.cnf file. This script
      # may be overwritten at next upgrade.
      $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" $other_args >/dev/null 2>&1 &
      wait_for_pid created "$!" "$mysqld_pid_file_path"; return_value=$?

      # Make lock for RedHat / SuSE
      if test -w "$lockdir"
      then
        touch "$lock_file_path"
      fi

      exit $return_value
    else
      log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)"
    fi
    ;;

  'stop')
    # Stop daemon. We use a signal here to avoid having to know the
    # root password.

    if test -s "$mysqld_pid_file_path"
    then
      mysqld_pid=`cat "$mysqld_pid_file_path"`

      if (kill -0 $mysqld_pid 2>/dev/null)
      then
        echo $echo_n "Shutting down MySQL"
        kill $mysqld_pid
        # mysqld should remove the pid file when it exits, so wait for it.
        wait_for_pid removed "$mysqld_pid" "$mysqld_pid_file_path"; return_value=$?
      else
        log_failure_msg "MySQL server process #$mysqld_pid is not running!"
        rm "$mysqld_pid_file_path"
      fi

      # Delete lock for RedHat / SuSE
      if test -f "$lock_file_path"
      then
        rm -f "$lock_file_path"
      fi
      exit $return_value
    else
      log_failure_msg "MySQL server PID file could not be found!"
    fi
    ;;

  'restart')
    # Stop the service and regardless of whether it was
    # running or not, start it again.
    if $0 stop  $other_args; then
      $0 start $other_args
    else
      log_failure_msg "Failed to stop running server, so refusing to try to start."
      exit 1
    fi
    ;;

  'reload'|'force-reload')
    if test -s "$mysqld_pid_file_path" ; then
      read mysqld_pid <  "$mysqld_pid_file_path"
      kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
      touch "$mysqld_pid_file_path"
    else
      log_failure_msg "MySQL PID file could not be found!"
      exit 1
    fi
    ;;
  'status')
    # First, check to see if pid file exists
    if test -s "$mysqld_pid_file_path" ; then
      read mysqld_pid < "$mysqld_pid_file_path"
      if kill -0 $mysqld_pid 2>/dev/null ; then
        log_success_msg "MySQL running ($mysqld_pid)"
        exit 0
      else
        log_failure_msg "MySQL is not running, but PID file exists"
        exit 1
      fi
    else
      # Try to find appropriate mysqld process
      mysqld_pid=`pidof $libexecdir/mysqld`

      # test if multiple pids exist
      pid_count=`echo $mysqld_pid | wc -w`
      if test $pid_count -gt 1 ; then
        log_failure_msg "Multiple MySQL running but PID file could not be found ($mysqld_pid)"
        exit 5
      elif test -z $mysqld_pid ; then
        if test -f "$lock_file_path" ; then
          log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists"
          exit 2
        fi
        log_failure_msg "MySQL is not running"
        exit 3
      else
        log_failure_msg "MySQL is running but PID file could not be found"
        exit 4
      fi
    fi
    ;;
    *)
      # usage
      basename=`basename "$0"`
      echo "Usage: $basename  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]"
      exit 1
    ;;
esac

exit 0
[root@web mysql]# cd /etc/init.d/
您在 /var/spool/mail/root 中有邮件
[root@web init.d]# ls
functions  mysql  netconsole  network  README
[root@web init.d]# service mysql start
Starting MySQL SUCCESS!
[root@web init.d]# cd /usr/local/mysql/
[root@web mysql]# bin/mysqladmin -u root password '123'
bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
您在 /var/spool/mail/root 中有邮件
[root@web mysql]# bin/mysqladmin -u root password '123'
bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
您在 /var/spool/mail/root 中有邮件
[root@web mysql]# echo 'export PATH=$PATH:/usr/local/mysql/bin' >>/etc/profile
您在 /var/spool/mail/root 中有邮件
[root@web mysql]# cat /etc/profile
# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
    case ":${PATH}:" in
        *:"$1":*)
            ;;
        *)
            if [ "$2" = "after" ] ; then
                PATH=$PATH:$1
            else
                PATH=$1:$PATH
            fi
    esac
}


if [ -x /usr/bin/id ]; then
    if [ -z "$EUID" ]; then
        # ksh workaround
        EUID=`/usr/bin/id -u`
        UID=`/usr/bin/id -ru`
    fi
    USER="`/usr/bin/id -un`"
    LOGNAME=$USER
    MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
    pathmunge /usr/sbin
    pathmunge /usr/local/sbin
else
    pathmunge /usr/local/sbin after
    pathmunge /usr/sbin after
fi

HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
    export HISTCONTROL=ignoreboth
else
    export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
    if [ -r "$i" ]; then
        if [ "${-#*i}" != "$-" ]; then
            . "$i"
        else
            . "$i" >/dev/null
        fi
    fi
done

unset i
unset -f pathmunge
PATH=$PATH:/usr/local/mysql/bin
export PATH=$PATH:/usr/local/mysql/bin
[root@web mysql]# source /etc/profile
您在 /var/spool/mail/root 中有新邮件
[root@web mysql]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.31 Source distribution

Copyright (c) 2000, 2016, 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> Ctrl-C -- exit!
Aborted
[root@web mysql]# ls
bin  COPYING  data  docs  include  lib  man  my.cnf  my-new.cnf  mysql-test  README  scripts  share  sql-bench  support-files
您在 /var/spool/mail/root 中有邮件
[root@web mysql]# cd /root
[root@web ~]# ls
1828.txt         app                     axel-2.4.tar.gz  httpd-2.4.37               ok                 Steam.dll
1837.txt         apr-1.5.2               bb.conf          httpd-2.4.37.tar.bz2       okl                wordpress
2-1.java         apr-1.5.2.tar.bz2       cc.conf          initial-setup-ks.cfg       php-7.2.17         wordpress-4.7.3-zh_CN.tar.gz
2.java           apr-util-1.5.4          code             inotify-tools-3.13.tar.gz  php-7.2.17.tar.xz
alll1            apr-util-1.5.4.tar.bz2  file20.java      mysql-5.6.31               readme7
anaconda-ks.cfg  axel-2.4                file23.java      mysql-5.6.31.tar.gz        readme.txt
[root@web ~]# cd apr-1.5.2/
[root@web apr-1.5.2]# cd /root
[root@web ~]# cd apr-util-1.5.4/
[root@web apr-util-1.5.4]# cd /root
[root@web ~]# cd httpd-2.4.37/
您在 /var/spool/mail/root 中有邮件
[root@web httpd-2.4.37]# cat apache.sh
./configure \
--enable-modules=all \
--enable-mods-shared=all \
--enable-so \
--enable-rewrite \
--with-pcre \
--enable-ssl \
--with-mpm=prefork \
--with-apr=/usr/local/apr/bin/apr-1-config \
--with-apr-util=/usr/local/apr/bin/apu-1-config
[root@web httpd-2.4.37]# ls apache.sh
apache.sh
[root@web httpd-2.4.37]# ll apache.sh
-rwxr-xr-x 1 root dip 240 629 22:24 apache.sh
[root@web httpd-2.4.37]# ./apache.sh \
> ^C
您在 /var/spool/mail/root 中有邮件
[root@web httpd-2.4.37]#
[root@web httpd-2.4.37]# make && make install \
> ^C
[root@web httpd-2.4.37]# cd /usr/local/apache2/
[root@web apache2]# bin/apachectl
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# cd /root
[root@web ~]# cd php-7.2.17/
[root@web php-7.2.17]# cat php.sh
./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysqli \
--with-pdo-mysql \
--with-zlib \
--with-curl \
--enable-zip \
--with-gd \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-opcache \
--enable-mbstring \
--enable-mbregex \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-calendar \
--enable-bcmath
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# ll php.sh
-rwxr-xr-x 1 root root 441 630 19:49 php.sh
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# yum install libxml2-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 libxml2-devel-2.9.1-6.el7.5.x86_64 已安装并且是最新版本
无须任何处理
[root@web php-7.2.17]# yum install libjpeg-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 libjpeg-turbo-devel-1.2.90-8.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@web php-7.2.17]# yum install libpng-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 2:libpng-devel-1.5.13-8.el7.x86_64 已安装并且是最新版本
无须任何处理
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# yum install freetype-devel
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 freetype-devel-2.8-14.el7.x86_64 已安装并且是最新版本
无须任何处理
[root@web php-7.2.17]# ./php.sh \
> ^C
[root@web php-7.2.17]# make && make install \
> ^C
[root@web php-7.2.17]# ls /usr/local/apache2/modules/libphp7.so
/usr/local/apache2/modules/libphp7.so
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# cat /usr/local/apache2//conf/httpd.conf
#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "logs/access_log"
# with ServerRoot set to "/usr/local/apache2" will be interpreted by the
# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
# will be interpreted as '/logs/access_log'.

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to specify a local disk on the
# Mutex directive, if file-based mutexes are used.  If you wish to share the
# same ServerRoot for multiple httpd daemons, you will need to change at
# least PidFile.
#
ServerRoot "/usr/local/apache2"

#
# Mutex: Allows you to set the mutex mechanism and mutex file directory
# for individual mutexes, or change the global defaults
#
# Uncomment and change the directory if mutexes are file-based and the default
# mutex file directory is not on a local disk or is not appropriate for some
# other reason.
#
# Mutex default:logs

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
LoadModule authn_file_module modules/mod_authn_file.so
#LoadModule authn_dbm_module modules/mod_authn_dbm.so
#LoadModule authn_anon_module modules/mod_authn_anon.so
#LoadModule authn_dbd_module modules/mod_authn_dbd.so
#LoadModule authn_socache_module modules/mod_authn_socache.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
#LoadModule authz_dbm_module modules/mod_authz_dbm.so
#LoadModule authz_owner_module modules/mod_authz_owner.so
#LoadModule authz_dbd_module modules/mod_authz_dbd.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule auth_form_module modules/mod_auth_form.so
#LoadModule auth_digest_module modules/mod_auth_digest.so
#LoadModule allowmethods_module modules/mod_allowmethods.so
#LoadModule file_cache_module modules/mod_file_cache.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cache_socache_module modules/mod_cache_socache.so
#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
#LoadModule watchdog_module modules/mod_watchdog.so
#LoadModule macro_module modules/mod_macro.so
#LoadModule dbd_module modules/mod_dbd.so
#LoadModule dumpio_module modules/mod_dumpio.so
#LoadModule echo_module modules/mod_echo.so
#LoadModule buffer_module modules/mod_buffer.so
#LoadModule data_module modules/mod_data.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
#LoadModule ext_filter_module modules/mod_ext_filter.so
#LoadModule request_module modules/mod_request.so
#LoadModule include_module modules/mod_include.so
LoadModule filter_module modules/mod_filter.so
#LoadModule reflector_module modules/mod_reflector.so
#LoadModule substitute_module modules/mod_substitute.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule deflate_module modules/mod_deflate.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule log_forensic_module modules/mod_log_forensic.so
#LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
#LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
#LoadModule remoteip_module modules/mod_remoteip.so
#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
#LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
#LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
#LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
#LoadModule proxy_express_module modules/mod_proxy_express.so
#LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
#LoadModule session_module modules/mod_session.so
#LoadModule session_cookie_module modules/mod_session_cookie.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
#LoadModule ssl_module modules/mod_ssl.so
#LoadModule dialup_module modules/mod_dialup.so
#LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
#LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
#LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
#LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
LoadModule unixd_module modules/mod_unixd.so
#LoadModule heartbeat_module modules/mod_heartbeat.so
#LoadModule heartmonitor_module modules/mod_heartmonitor.so
#LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
#LoadModule asis_module modules/mod_asis.so
#LoadModule info_module modules/mod_info.so
#LoadModule cgi_module modules/mod_cgi.so
#LoadModule dav_fs_module modules/mod_dav_fs.so
#LoadModule dav_lock_module modules/mod_dav_lock.so
#LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
#LoadModule actions_module modules/mod_actions.so
#LoadModule speling_module modules/mod_speling.so
#LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
#LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php7_module modules/libphp7.so
AddHandler php7-script .php
AddType text/html .php
<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon

</IfModule>

# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition.  These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#

#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin you@example.com

#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all granted
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/usr/local/apache2/htdocs"
<Directory "/usr/local/apache2/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ".ht*">
    Require all denied
</Files>

#
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
ErrorLog "logs/error_log"

#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

<IfModule log_config_module>
    #
    # The following directives define some format nicknames for use with
    # a CustomLog directive (see below).
    #
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common

    <IfModule logio_module>
      # You need to enable mod_logio.c to use %I and %O
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>

    #
    # The location and format of the access logfile (Common Logfile Format).
    # If you do not define any access logfiles within a <VirtualHost>
    # container, they will be logged here.  Contrariwise, if you *do*
    # define per-<VirtualHost> access logfiles, transactions will be
    # logged therein and *not* in this file.
    #
    CustomLog "logs/access_log" common

    #
    # If you prefer a logfile with access, agent, and referer information
    # (Combined Logfile Format) you can use the following directive.
    #
    #CustomLog "logs/access_log" combined
</IfModule>

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.

    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

</IfModule>

<IfModule cgid_module>
    #
    # ScriptSock: On threaded servers, designate the path to the UNIX
    # socket used to communicate with the CGI daemon of mod_cgid.
    #
    #Scriptsock cgisock
</IfModule>

#
# "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

<IfModule headers_module>
    #
    # Avoid passing HTTP_PROXY environment to CGI's on this or any proxied
    # backend servers which have lingering "httpoxy" defects.
    # 'Proxy' request header is undefined by the IETF, not listed by IANA
    #
    RequestHeader unset Proxy early
</IfModule>

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
</IfModule>

#
# The mod_mime_magic module allows the server to use various hints from the
# contents of the file itself to determine its type.  The MIMEMagicFile
# directive tells the module where the hint definitions are located.
#
#MIMEMagicFile conf/magic

#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 "The server made a boo boo."
#ErrorDocument 404 /missing.html
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html
#

#
# MaxRanges: Maximum number of Ranges in a request before
# returning the entire resource, or one of the special
# values 'default', 'none' or 'unlimited'.
# Default setting is to accept 200 Ranges.
#MaxRanges unlimited

#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall may be used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
# Defaults: EnableMMAP On, EnableSendfile Off
#
#EnableMMAP off
#EnableSendfile on

# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.

# Server-pool management (MPM specific)
#Include conf/extra/httpd-mpm.conf

# Multi-language error messages
#Include conf/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

# Language settings
Include conf/extra/httpd-languages.conf

# User home directories
#Include conf/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include conf/extra/httpd-info.conf

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include conf/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include conf/extra/httpd-dav.conf

# Various default settings
#Include conf/extra/httpd-default.conf

# Configure mod_proxy_html to understand HTML4/XHTML1
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

# Secure (SSL/TLS) connections
#Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
#       starting without SSL on platforms with no /dev/random equivalent
#       but a statically compiled-in mod_ssl.
#
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>

[root@web php-7.2.17]# vim /usr/local/apache2/conf/httpd.conf
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# vim /usr/local/apache2/conf/extra/httpd-languages.conf
您在 /var/spool/mail/root 中有邮件
[root@web php-7.2.17]# cd /usr/local/apache2
[root@web apache2]# bin/apachectl -k restart
[root@web apache2]# cd /usr/local/apache2/htdocs/
[root@web htdocs]# ls
index.php
[root@web htdocs]# cat index.sh
cat: index.sh: 没有那个文件或目录
您在 /var/spool/mail/root 中有邮件
[root@web htdocs]# cat index.php
<?php
        phpinfo();
?>
[root@web htdocs]# ls /www/blog
index.php    wp-activate.php     wp-comments-post.php  wp-content   wp-links-opml.php  wp-mail.php      wp-trackback.php
license.txt  wp-admin            wp-config.php         wp-cron.php  wp-load.php        wp-settings.php  xmlrpc.php
readme.html  wp-blog-header.php  wp-config-sample.php  wp-includes  wp-login.php       wp-signup.php
[root@web htdocs]# ll -d /www/blog
drwxr-xr-x 5 daemon daemon 4096 71 23:53 /www/blog
您在 /var/spool/mail/root 中有邮件
[root@web htdocs]# chown -R deamon.deamon /www/blog
chown: 无效的用户: "deamon.deamon"
[root@web htdocs]# chown -R daemon.daemon /www/blog
您在 /var/spool/mail/root 中有邮件
[root@web htdocs]# vim /usr/local/apache2/conf/httpd.conf
您在 /var/spool/mail/root 中有邮件
[root@web htdocs]# vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
您在 /var/spool/mail/root 中有邮件
[root@web htdocs]# cat /usr/local/apache2/conf/extra/httpd-v
cat: /usr/local/apache2/conf/extra/httpd-v: 没有那个文件或目录
[root@web htdocs]# cat /usr/local/apache2/conf/extra/httpd-vhosts.conf
# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#

<VirtualHost *:80>
    DocumentRoot "/www/blog"
    ServerName www.blog.com
    ErrorLog "logs/blog-error_log"
    CustomLog "logs/blog-access_log" common
</VirtualHost>


[root@web htdocs]# cd /usr/local/apache2/
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# bin/apachectl -k restart
[root@web apache2]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.31 Source distribution

Copyright (c) 2000, 2016, 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 blog default charset utf8
    -> ;
ERROR 1007 (HY000): Can't create database 'blog'; database exists
mysql> Ctrl-C -- exit!
Aborted
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# cd /
[root@web /]# cd /root
[root@web ~]# service apache stop
Redirecting to /bin/systemctl stop apache.service
Failed to stop apache.service: Unit apache.service not loaded.
[root@web ~]# systemctl status apache2
Unit apache2.service could not be found.
您在 /var/spool/mail/root 中有邮件
[root@web ~]# systemctl status apache
Unit apache.service could not be found.
[root@web ~]# cd /usr/local/apache2/
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# bin/apachectl -k stop
[root@web apache2]# service mysql stop
Shutting down MySQL. SUCCESS!
[root@web apache2]# rsync -av /usr/local/mysql/ 192.168.235.200:/backup/
The authenticity of host '192.168.235.200 (192.168.235.200)' can't be established.
ECDSA key fingerprint is SHA256:khlI72dk6xtaBObBlZbZT4+Z+s+1c1tjmHg3nZVV8G4.
ECDSA key fingerprint is MD5:59:e9:91:40:a4:ca:21:a9:c2:92:39:b8:d4:7f:5f:2f.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(226) [sender=3.1.2]
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# ssh 192.168.235.200
The authenticity of host '192.168.235.200 (192.168.235.200)' can't be established.
ECDSA key fingerprint is SHA256:khlI72dk6xtaBObBlZbZT4+Z+s+1c1tjmHg3nZVV8G4.
ECDSA key fingerprint is MD5:59:e9:91:40:a4:ca:21:a9:c2:92:39:b8:d4:7f:5f:2f.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# ssh 192.168.235.200
The authenticity of host '192.168.235.200 (192.168.235.200)' can't be established.
ECDSA key fingerprint is SHA256:khlI72dk6xtaBObBlZbZT4+Z+s+1c1tjmHg3nZVV8G4.
ECDSA key fingerprint is MD5:59:e9:91:40:a4:ca:21:a9:c2:92:39:b8:d4:7f:5f:2f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.235.200' (ECDSA) to the list of known hosts.
root@192.168.235.200's password:
Last login: Wed Jul 16 21:25:21 2025 from 192.168.235.200
[root@client ~]# ^C
[root@client ~]# exit
登出
Connection to 192.168.235.200 closed.
[root@web apache2]# rsync -av /usr/local/mysql/ 192.168.235.200:/backup
root@192.168.235.200's password:
sending incremental file list
./
COPYING
README
my-new.cnf
my.cnf
bin/
bin/innochecksum
bin/msql2mysql
bin/my_print_defaults
bin/myisam_ftdump
bin/myisamchk
bin/myisamlog
bin/myisampack
bin/mysql
bin/mysql_client_test
bin/mysql_client_test_embedded
bin/mysql_config
bin/mysql_config_editor
..
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# rsync -av /usr/local/mysql/ /u1
sending incremental file list
./
COPYING
README
my-new.cnf
my.cnf
bin/
bin/innochecksum
bin/msql2mysql
bin/my_print_defaults
bin/myisam_ftdump
bin/myisamchk
bin/myisamlog
bin/myisampack
bin/mysql
bin/mysql_client_test
bin/mysql_client_test_embedded
bin/mysql_config
bin/mysql_config_editor
bin/mysql_convert_table_format
bin/mysql_embedded
bin/mysql_find_rows
bin/mysql_fix_extensions
bin/mysql_plugin
bin/mysql_secure_inst
..
support-files/magic
support-files/my-default.cnf
support-files/mysql-log-rotate
support-files/mysql.server
support-files/mysqld_multi.server

sent 1,196,879,641 bytes  received 194,005 bytes  126,007,752.21 bytes/sec
total size is 1,195,945,962  speedup is 1.00
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# ls /u1
bin  COPYING  data  docs  include  lib  lost+found  man  my.cnf  my-new.cnf  mysql-test  README  scripts  share  sql-bench  support-files
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# du -sh /u1
1.2G    /u1
[root@web apache2]# umount /u1
[root@web apache2]# rm -rf /usr/local/mysql/*
[root@web apache2]# mount /dev/vg_mysql/lv_mysql /usr/local/mysql
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# vim /etc/rc.local
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
mount -o ro /dev/sr0 /mnt
mount /dev/vg_mysql/lv_mysql /usr/local/mysql
[root@web apache2]# vim /etc/rc.local
[root@web apache2]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
mount -o ro /dev/sr0 /mnt
mount /dev/vg_mysql/lv_mysql /usr/local/mysql/
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# service mysql start
Starting MySQL. SUCCESS!
[root@web apache2]# service apache staet
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
[root@web apache2]# service apache start
Redirecting to /bin/systemctl start apache.service
Failed to start apache.service: Unit not found.
[root@web apache2]# cd /usr/local/ap
apache2/ apr/
[root@web apache2]# cd /usr/local/apache2/
您在 /var/spool/mail/root 中有邮件
[root@web apache2]# bin/apachectl -k start
[root@web apache2]#

192.168.235.200

caozx26@192.168.235.200's password:
     ┌────────────────────────────────────────────────────────────────────┐
     │                        • MobaXterm 20.0 •                          │
     │            (SSH client, X-server and networking tools)             │
     │                                                                    │
     │ ➤ SSH session to caozx26@192.168.235.200                           │
     │   • SSH compression : ✘                                            │
     │   • SSH-browser     : ✔                                            │
     │   • X11-forwarding  : ✔  (remote display is forwarded through SSH) │
     │   • DISPLAY         : ✔  (automatically set on remote server)      │
     │                                                                    │
     │ ➤ For more info, ctrl+click on help or visit our website           │
     └────────────────────────────────────────────────────────────────────┘

Last login: Tue Jul 15 19:03:23 2025 from 192.168.235.1
[caozx26@client ~]$ sudo su
[sudo] caozx26 的密码:
[root@client caozx26]# ls /backup
123.jpg  1.txt  2.txt  app1_java  share.mp4
[root@client caozx26]# cat /etc/ssh/sshd_config
#       $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile      .ssh/authorized_keys

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
#KerberosUseKuserok yes

# GSSAPI options
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no
#GSSAPIEnablek5users no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
# WARNING: 'UsePAM no' is not supported in Red Hat Enterprise Linux and may cause several
# problems.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS

# override default of no subsystems
Subsystem       sftp    /usr/libexec/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       PermitTTY no
#       ForceCommand cvs server
[root@client caozx26]# ssh 192.168.235.200
The authenticity of host '192.168.235.200 (192.168.235.200)' can't be established.
ECDSA key fingerprint is SHA256:khlI72dk6xtaBObBlZbZT4+Z+s+1c1tjmHg3nZVV8G4.
ECDSA key fingerprint is MD5:59:e9:91:40:a4:ca:21:a9:c2:92:39:b8:d4:7f:5f:2f.
Are you sure you want to continue connecting (yes/no)?
Host key verification failed.
[root@client caozx26]# ssh 192.168.235.200
The authenticity of host '192.168.235.200 (192.168.235.200)' can't be established.
ECDSA key fingerprint is SHA256:khlI72dk6xtaBObBlZbZT4+Z+s+1c1tjmHg3nZVV8G4.
ECDSA key fingerprint is MD5:59:e9:91:40:a4:ca:21:a9:c2:92:39:b8:d4:7f:5f:2f.
Are you sure you want to continue connecting (yes/no)? ues
Please type 'yes' or 'no': yes
Warning: Permanently added '192.168.235.200' (ECDSA) to the list of known hosts.
root@192.168.235.200's password:
Last login: Wed Jul 16 21:20:47 2025
[root@client ~]# exit
登出
Connection to 192.168.235.200 closed.
[root@client caozx26]#


网站公告

今日签到

点亮在社区的每一天
去签到