软件包管理及磁盘管理

1、自建yum仓库,分别为网络源和本地源

vim /etc/yum/repos.d/test.repo
[network]
name=aliyun
baseurl=https://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=0

[local]
name=cdrom
baseurl=file:///misc/cd/
gpgcheck=0

在这里插入图片描述
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。

1.解压httpd软件包
[root@centos7 data]# tar xvf httpd-2.4.25.tar.bz2  

2.安装依赖软件包
[root@centos7 httpd-2.4.25]# yum install gcc -y
[root@centos7 httpd-2.4.25]# yum install apr-devel -y
[root@centos7 httpd-2.4.25]# yum install apr-util-devel -y
[root@centos7 httpd-2.4.25]# yum install pcre-devel -y

3.执行configure生成Makefile文件
[root@centos7 httpd-2.4.25]# ./configure --prefix=/apps/httpd2.4

4.根据Makefile文件,构建应用程序
[root@centos7 httpd-2.4.25]# make

5.复制文件到相应路径
[root@centos7 httpd-2.4.25]# make install

6.启动apache服务
[root@centos7 httpd-2.4.25]# /apps/httpd2.4/bin/apachectl start

在这里插入图片描述

3、创建一个2G的文件系统,块大小为2048byte,预留1%可用空间,文件系统 ext4,卷标为TEST,要求此分区开机后自动挂载至/test目录,且默认有acl挂载选项

1.创建2G磁盘分区
[root@centos7 ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xd9bc365c.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-419430399, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): +2G
Partition 1 of type Linux and of size 2 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@centos7 ~]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  200G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0  100G  0 part /
├─sda3   8:3    0   50G  0 part /data
├─sda4   8:4    0    1K  0 part 
└─sda5   8:5    0    4G  0 part [SWAP]
sdb      8:16   0  200G  0 disk 
└─sdb1   8:17   0    2G  0 part 
sr0     11:0    1 10.3G  0 rom

2.创建文件系统并设置属性
[root@centos7 ~]# mkfs.ext4 -b 2048 -m 1 -L TEST /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=TEST
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
Stride=0 blocks, Stripe width=0 blocks
131072 inodes, 1048576 blocks
10485 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=269484032
64 block groups
16384 blocks per group, 16384 fragments per group
2048 inodes per group
Superblock backups stored on blocks: 
	16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@centos7 ~]# blkid
/dev/sda1: UUID="950d0256-66e5-4aa4-af62-305c37271784" TYPE="xfs" 
/dev/sda2: UUID="76534a3e-2787-4c60-af17-04c9f02d378d" TYPE="xfs" 
/dev/sda3: UUID="2bcc708b-c51e-471d-b5de-37bc41b84a46" TYPE="xfs" 
/dev/sda5: UUID="406ae6bb-2870-4f3f-84b6-0d96cec899b9" TYPE="swap" 
/dev/sr0: UUID="2019-09-09-19-08-41-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos" 
/dev/sdb1: LABEL="TEST" UUID="addf3f37-fdc8-4309-abb9-0187997beb36" TYPE="ext4"

3.设置开机自动挂载及挂载选项
[root@centos7 ~]# mkdir /test
[root@centos7 ~]# vim /etc/fstab 


#
# /etc/fstab
# Created by anaconda on Wed Apr 15 09:25:57 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=76534a3e-2787-4c60-af17-04c9f02d378d /                       xfs     defaults        0 0
UUID=950d0256-66e5-4aa4-af62-305c37271784 /boot                   xfs     defaults        0 0
UUID=2bcc708b-c51e-471d-b5de-37bc41b84a46 /data                   xfs     defaults        0 0
UUID=406ae6bb-2870-4f3f-84b6-0d96cec899b9 swap                    swap    defaults        0 0
UUID=addf3f37-fdc8-4309-abb9-0187997beb36 /test                   ext4    acl             0 0

4、创建一个至少有两个PV组成的大小为20G的名为testvg的VG;要求PE大小 为16MB, 而后在卷组中创建大小为5G的逻辑卷testlv;挂载至/users目录

1.创建2个10G分区,设置为Linux LVM分区
[root@centos7 ~]# fdisk /dev/sdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xf46fd850.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-419430399, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-419430399, default 419430399): +10G
Partition 1 of type Linux and of size 10 GiB is set

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (2-4, default 2): 
First sector (20973568-419430399, default 20973568): 
Using default value 20973568
Last sector, +sectors or +size{K,M,G} (20973568-419430399, default 419430399): +10G
Partition 2 of type Linux and of size 10 GiB is set

Command (m for help): t
Partition number (1,2, default 2): 1
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): t
Partition number (1,2, default 2): 2
Hex code (type L to list all codes): 8e
Changed type of partition 'Linux' to 'Linux LVM'

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@centos7 ~]# fdisk -l /dev/sdb

Disk /dev/sdb: 214.7 GB, 214748364800 bytes, 419430400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xf46fd850

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    20973567    10485760   8e  Linux LVM
/dev/sdb2        20973568    41945087    10485760   8e  Linux LVM

2.创建物理卷(pv)
[root@centos7 ~]# pvcreate /dev/sdb1 /dev/sdb2
WARNING: ext4 signature detected on /dev/sdb1 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sdb1.
  Physical volume "/dev/sdb1" successfully created.
  Physical volume "/dev/sdb2" successfully created.
[root@centos7 ~]# pvs
  PV         VG Fmt  Attr PSize  PFree 
  /dev/sdb1     lvm2 ---  10.00g 10.00g
  /dev/sdb2     lvm2 ---  10.00g 10.00g

3.创建卷组(VG)testvg,设置PE大小为16M
[root@centos7 ~]# vgcreate testvg -s 16M /dev/sdb1 /dev/sdb2 
  Volume group "testvg" successfully created
[root@centos7 ~]# vgdisplay 
  --- Volume group ---
  VG Name               testvg
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               <19.97 GiB
  PE Size               16.00 MiB
  Total PE              1278
  Alloc PE / Size       0 / 0   
  Free  PE / Size       1278 / <19.97 GiB
  VG UUID               TTpcio-E563-73Jl-8VdM-P0lE-knUW-IFDJVk
   
4.创建5G大小的逻辑卷testlv
[root@centos7 ~]# lvcreate -n testlv -L 5G testvg
  Logical volume "testlv" created.
[root@centos7 ~]# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/testvg/testlv
  LV Name                testlv
  VG Name                testvg
  LV UUID                SjR19f-bhxF-j1FN-RDTN-o7Mq-lsem-25cVhB
  LV Write Access        read/write
  LV Creation host, time centos7.localdomain, 2020-05-29 10:45:19 +0800
  LV Status              available
  # open                 0
  LV Size                5.00 GiB
  Current LE             320
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

5.在逻辑卷testlv上创建xfs文件系统,并挂载至/users目录
[root@centos7 ~]# mkfs.xfs /dev/testvg/testlv 
meta-data=/dev/testvg/testlv     isize=512    agcount=4, agsize=327680 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=1310720, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@centos7 ~]# blkid
/dev/sda2: UUID="76534a3e-2787-4c60-af17-04c9f02d378d" TYPE="xfs" 
/dev/sda1: UUID="950d0256-66e5-4aa4-af62-305c37271784" TYPE="xfs" 
/dev/sda3: UUID="2bcc708b-c51e-471d-b5de-37bc41b84a46" TYPE="xfs" 
/dev/sda5: UUID="406ae6bb-2870-4f3f-84b6-0d96cec899b9" TYPE="swap" 
/dev/sdb1: UUID="q6RmdV-M5bU-WHIz-aRGI-fxOw-OQ8C-6CB01s" TYPE="LVM2_member" 
/dev/sdb2: UUID="VAdkvY-81V9-pddc-bUgM-9Xqr-NpBo-UeU74h" TYPE="LVM2_member" 
/dev/sr0: UUID="2019-09-09-19-08-41-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos" 
/dev/mapper/testvg-testlv: UUID="7258910b-9c01-4bb4-bb74-fe751f7dc9f8" TYPE="xfs" 
[root@centos7 ~]# mkdir /users
[root@centos7 ~]# mount /dev/testvg/testlv /users
[root@centos7 ~]# df -hT
Filesystem                Type      Size  Used Avail Use% Mounted on
devtmpfs                  devtmpfs  895M     0  895M   0% /dev
tmpfs                     tmpfs     910M     0  910M   0% /dev/shm
tmpfs                     tmpfs     910M   11M  900M   2% /run
tmpfs                     tmpfs     910M     0  910M   0% /sys/fs/cgroup
/dev/sda2                 xfs       100G  4.3G   96G   5% /
/dev/sda3                 xfs        50G  101M   50G   1% /data
/dev/sda1                 xfs      1014M  179M  836M  18% /boot
tmpfs                     tmpfs     182M   12K  182M   1% /run/user/42
tmpfs                     tmpfs     182M     0  182M   0% /run/user/0
/dev/mapper/testvg-testlv xfs       5.0G   33M  5.0G   1% /users

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值