1、自建yum仓库,分别为网络源和本地源
网络源
## 阿里云镜像地址为例
vi /etc/yum.repos.d/CentOS-Base.repo
[local]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
或者
##下载rpm文件
wget http://mirrors.aliyun.com/repo/Centos-7.repo
##安装rpm即可直接生成repo文件
rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
本地源
### 挂载光盘
mount /dev/sr0 /mnt/cdrom
### 编辑repo文件:
vi /etc/yum.repos.d/CentOS-Base.repo
[local]
name=localyum
baseurl=file:///mnt/cdrom/
gpgcheck=0
enabled=1
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交
(1)安装依赖包
yum -y install wget pcre-devel gcc gcc-c++ openssl-devel apr apr-util-devel
(2)下载源码包
wget http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.41.tar.gz
(3)解压文件,编译
tar zxvf httpd-2.4.41.tar.gz
./configure --prefix=/soft/http --enable-http --enable-proxy --enable-ssl
make
make install
(4)启动
/soft/http/bin/apachectl start
![http.png](https://upload-images.jianshu.io/upload_images/20338643-430a92df947ee521.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
3、创建一个2G的文件系统,块大小为2048byte,预留1%可用空间,文件系统 ext4,卷标为TEST,要求此分区开机后自动挂载至/test目录,且默认有acl挂载选项
##命令
### 划分磁盘
fdisk /dev/sdb
(n-->p-->+1932M-->w)
### 格式化ext4文件格式
mkfs.ext4 /dev/sdb1
### 打卷标
e2label /dev/sdb1 TEST
### 查看卷标
blkid
###创建挂载点目录
mkdir /test
### 编辑配置开机自动挂载
vi /etc/fstab
### 挂载
mount -a
#过程
[root@rac1 ~]# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00066e7f
Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 256000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 4700 37491712 8e Linux LVM
/dev/sda3 4700 5222 4194304 82 Linux swap / Solaris
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_root-LogVol00: 38.4 GB, 38390464512 bytes
255 heads, 63 sectors/track, 4667 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[root@rac1 ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x6fa1cdcb.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-261, default 1): 1
Last cylinder, +cylinders or +size{K,M,G} (1-261, default 261): +1932M
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@rac1 ~]# fdisk -l
Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00066e7f
Device Boot Start End Blocks Id System
/dev/sda1 * 1 32 256000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 32 4700 37491712 8e Linux LVM
/dev/sda3 4700 5222 4194304 82 Linux swap / Solaris
Disk /dev/sdb: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x6fa1cdcb
Device Boot Start End Blocks Id System
/dev/sdb1 1 247 1983996 83 Linux
Disk /dev/mapper/vg_root-LogVol00: 38.4 GB, 38390464512 bytes
255 heads, 63 sectors/track, 4667 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[root@rac1 ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
124160 inodes, 495999 blocks
24799 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=511705088
16 block groups
32768 blocks per group, 32768 fragments per group
7760 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@rac1 ~]# e2label /dev/sdb1 TEST
[root@rac1 ~]# blkid
/dev/mapper/vg_root-LogVol00: UUID="714741b6-8385-4647-807e-f5a4e3946276" TYPE="ext4"
/dev/sda1: UUID="46f19ac6-907f-456c-b188-275bf3a77763" TYPE="ext4"
/dev/sda2: UUID="t3dgsp-ogVH-zypY-v08B-fAGD-MTza-565cT2" TYPE="LVM2_member"
/dev/sda3: UUID="62e305e8-0f56-4fe8-ad8d-957b14ad7781" TYPE="swap"
/dev/sdb1: LABEL="TEST" UUID="81e4fa94-9024-484f-9b28-d489529465ed" TYPE="ext4"
[root@rac1 ~]# mkdir /test
[root@rac1 ~]# vi /etc/fstab
[root@rac1 ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Jul 5 09:58:50 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/vg_root-LogVol00 / ext4 defaults 1 1
UUID=46f19ac6-907f-456c-b188-275bf3a77763 /boot ext4 defaults 1 2
UUID=62e305e8-0f56-4fe8-ad8d-957b14ad7781 swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/sdb1 /test ext4 acl 0 0
[root@rac1 ~]# mount -a
[root@rac1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_root-LogVol00
36G 1.6G 32G 5% /
tmpfs 932M 0 932M 0% /dev/shm
/dev/sda1 243M 33M 198M 14% /boot
/dev/sdb1 1.9G 35M 1.8G 2% /test
4、创建一个至少有两个PV组成的大小为20G的名为testvg的VG;要求PE大小 为16MB, 而后在卷组中创建大小为5G的逻辑卷testlv;挂载至/users目录
#查看磁盘
lsblk
#划分第一块盘
fdisk /dev/sdc
#划分第二块盘
fdisk /dev/sdd
#创建pv
pvcreate /dev/sdc1
pvcreate /dev/sdd1
#创建vg
vgcreate -s 16M testvg /dev/sdc1 /dev/sdd1
#查看vg
vgs
#创建lv卷组
lvcreate -n testlv -L 5G testvg
#查看lv信息
lvs
#格式化
mkfs.ext4 /dev/testvg/testlv
#查看磁盘信息uuid
blkid
#添加自动挂载
vi /etc/fstab
#挂载
mkdir /users
mount -a
[root@rac1 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sdb 8:16 0 2G 0 disk
└─sdb1 8:17 0 1.9G 0 part /test
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 250M 0 part /boot
├─sda2 8:2 0 35.8G 0 part
│ └─vg_root-LogVol00 (dm-0) 253:0 0 35.8G 0 lvm /
└─sda3 8:3 0 4G 0 part [SWAP]
sdc 8:32 0 10G 0 disk
sdd 8:48 0 10G 0 disk
[root@rac1 ~]# fdisk /dev/sdc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x9f177076.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): +10G
Value out of range.
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305
Command (m for help): p
Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x9f177076
Device Boot Start End Blocks Id System
/dev/sdc1 1 1305 10482381 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@rac1 ~]# fdisk /dev/sdd
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xf23a4da4.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305):
Using default value 1305
Command (m for help): p
Disk /dev/sdd: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf23a4da4
Device Boot Start End Blocks Id System
/dev/sdd1 1 1305 10482381 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@rac1 ~]# pvcreate /dev/sdc1
Writing physical volume data to disk "/dev/sdc1"
Physical volume "/dev/sdc1" successfully created
[root@rac1 ~]# pvcreate /dev/sdd1
Writing physical volume data to disk "/dev/sdd1"
Physical volume "/dev/sdd1" successfully created
[root@rac1 ~]# vgcreate -s 16M testvg /dev/sdc1 /dev/sdd1
Volume group "testvg" successfully created
[root@rac1 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
testvg 2 0 0 wz--n- 19.97g 19.97g
vg_root 1 1 0 wz--n- 35.75g 0
[root@rac1 ~]# lvcreate -n testlv -L 5G testvg
Logical volume "testlv" created
[root@rac1 ~]# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
testlv testvg -wi-a--- 5.00g
LogVol00 vg_root -wi-ao-- 35.75g
[root@rac1 ~]# #mkfs.ext4 /dev/testvg/testlv
[root@rac1 ~]# mkfs.ext4 /dev/testvg/testlv
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 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
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@rac1 ~]# blkid
/dev/mapper/vg_root-LogVol00: UUID="714741b6-8385-4647-807e-f5a4e3946276" TYPE="ext4"
/dev/sda1: UUID="46f19ac6-907f-456c-b188-275bf3a77763" TYPE="ext4"
/dev/sda2: UUID="t3dgsp-ogVH-zypY-v08B-fAGD-MTza-565cT2" TYPE="LVM2_member"
/dev/sda3: UUID="62e305e8-0f56-4fe8-ad8d-957b14ad7781" TYPE="swap"
/dev/sdb1: LABEL="TEST" UUID="81e4fa94-9024-484f-9b28-d489529465ed" TYPE="ext4"
/dev/sdc1: UUID="b0GWgB-CI8s-slT7-M835-jaa7-TmfL-Jv8I6l" TYPE="LVM2_member"
/dev/sdd1: UUID="j268OB-EvOU-F4iA-hpdJ-E4Hv-4m0F-ZdKdwp" TYPE="LVM2_member"
/dev/mapper/testvg-testlv: UUID="82f9cd59-eb74-4dd4-af87-3fc8464649ab" TYPE="ext4"
[root@rac1 ~]# vi /etc/fstab
[root@rac1 ~]# mkdir /users
[root@rac1 ~]# mount -a
[root@rac1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_root-LogVol00
36G 1.6G 32G 5% /
tmpfs 932M 0 932M 0% /dev/shm
/dev/sda1 243M 33M 198M 14% /boot
/dev/sdb1 1.9G 35M 1.8G 2% /test
/dev/mapper/testvg-testlv
5.0G 138M 4.6G 3% /users