1、自建yum仓库,分别为网络源和本地源
将镜像挂载到本地
#mount -t iso9660 /opt/CentOS-7-x86_64-DVD-1611.iso /var/www/html/centos73/
#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 408G 21G 367G 6% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 1.8G 30G 6% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sda1 190M 99M 78M 57% /boot
tmpfs 6.3G 0 6.3G 0% /run/user/0
/dev/sdb 9.6T 7.8T 1.3T 86% /data1
/dev/loop0 4.1G 4.1G 0 100% /var/www/html/centos73
本地源
#cat >> /etc/yum.repos.d/local.repo<< EOF
[local]
name=localmedia
baseurl=file:///var/www/html/centos73
gpgcheck=0
enabled=1
EOF
网络源
将镜像挂载到httpd服务的路径下面
#mount -t iso9660 /opt/CentOS-7-x86_64-DVD-1611.iso /var/www/html/centos73/
#cat >> /etc/yum.repos.d/web.repo<< EOF
[local]
name=web
baseurl=http://10.21.12.33:8080/centos73
gpgcheck=0
enabled=1
EOF
查看yum源
# yum clean all && yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id repo name status
local localmedia 3,831
web webyum 3,831
repolist: 7,662
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
下载apr,apr-util,httpd及安装编译包
#wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.38.tar.gz
#wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.5.tar.gz
#wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
#yum -y install pcre-devel expat-devel openssl-devel gcc-c++ bzip2 gcc make
安装apr
#tar -xf apr-1.6.5.tar.gz
#cd apr-1.6.5
#./configure --prefix=/usr/local/apr/
#make && make install
安装apr-util
#tar -xf apr-util-1.6.1.tar.gz
#cd apr-util-1.6.1
#./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/
#make && make install
安装httpd
#tar -xf httpd-2.4.38.tar.gz
#cd httpd-2.4.38
#./configure --prefix=/usr/local/httpd/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/
#make && make install
#cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
#sed -i s/'#ServerName www.example.com:80'/'ServerName www.example.com:80'/ /usr/local/httpd#/conf/httpd.conf
#/etc/init.d/httpd start
setenforce 0
systemctl stop firewalld
访问主机ip正常显示则成功
3、创建一个2G的文件系统,块大小为2048byte,预留1%可用空间,文件系统 ext4,卷标为TEST,要求此分区开机后自动挂载至/test目录,且默认有acl挂载选项
fidisk创建2G的分区
#fdisk /dev/sdo
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): p
Disk /dev/sdo: 1199.6 GB, 1199638052864 bytes
255 heads, 63 sectors/track, 145847 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: 0x0004f992
Device Boot Start End Blocks Id System
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-145847, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-145847, default 145847): +2G
Command (m for help): p
Disk /dev/sdo: 1199.6 GB, 1199638052864 bytes
255 heads, 63 sectors/track, 145847 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: 0x0004f992
Device Boot Start End Blocks Id System
/dev/sdo1 1 262 2104483+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
格式化分区
# mkfs.ext4 -L TEST -m 1 -b 2048 /dev/sdo1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=TEST
操作系统:Linux
块大小=2048 (log=1)
分块大小=2048 (log=1)
Stride=0 blocks, Stripe width=0 blocks
131560 inodes, 1052240 blocks
10522 blocks (1.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=538968064
65 block groups
16384 blocks per group, 16384 fragments per group
2024 inodes per group
Superblock backups stored on blocks:
16384, 49152, 81920, 114688, 147456, 409600, 442368, 802816
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
查看UUID及写入配置文件
# blkid /dev/sdo1
/dev/sdo1: LABEL="TEST" UUID="f72b9bbb-64cc-4096-9b2d-5d954ecedf1b" TYPE="ext4"
echo 'UUID="f72b9bbb-64cc-4096-9b2d-5d954ecedf1b" /opt/xx ext4 defaults,acl 0 0' >> /etc/fstab
验证挂载
#mount -av|grep sdo
/dev/sdo1 on /opt/xx type ext4 (rw,acl)
#df -h|grep /opt/xx
/dev/sdo1 2.0G 9.1M 1.9G 1% /opt/xx
4、创建一个至少有两个PV组成的大小为20G的名为testvg的VG;要求PE大小 为16MB, 而后在卷组中创建大小为5G的逻辑卷testlv;挂载至/users目录
查看准备的2个10G分区
# fdisk -l /dev/sdo|grep sdo*
Disk /dev/sdo: 1199.6 GB, 1199638052864 bytes
/dev/sdo1 1 262 2104483+ 83 Linux
/dev/sdo2 263 1568 10490445 83 Linux
/dev/sdo3 1569 2874 10490445 83 Linux
创建PV
# pvcreate /dev/sdo{2..3}
Physical volume "/dev/sdo2" successfully created
Physical volume "/dev/sdo3" successfully created
[root@JSCN-IP-NJ-CDN-06 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sdo2 lvm2 --- 10.00g 10.00g
/dev/sdo3 lvm2 --- 10.00g 10.00g
创建VG
# vgcreate -s 16M testvg /dev/sdo{2..3}
Volume group "testvg" successfully created
# vgs
VG #PV #LV #SN Attr VSize VFree
testvg 2 0 0 wz--n- 20.00g 20.00g
# 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 20.00 GiB
PE Size 16.00 MiB
Total PE 1280
Alloc PE / Size 0 / 0
Free PE / Size 1280 / 20.00 GiB
VG UUID LYAyM2-dmK0-FdzO-M1lB-Az3g-y0fE-SjunOG
创建lv
# lvcreate -L 5G -n testlv testvg
Logical volume "testlv" created.
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
testlv testvg -wi-a----- 5.00g
格式化lv
# mkfs.ext4 /dev/testvg/testlv
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
第一个数据块=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
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
查看uuid,方便写入配置文件挂载
# blkid /dev/testvg/testlv
/dev/testvg/testlv: UUID="4c71433e-28aa-437b-9f24-fb0f132d4b6f" TYPE="ext4"
创建挂载路径及手动挂载
# mkdir /users
# mount /dev/testvg/testlv /users
# df -h|grep users
/dev/mapper/testvg-testlv 4.8G 10M 4.6G 1% /users
写入配置文件
#echo 'UUID="4c71433e-28aa-437b-9f24-fb0f132d4b6f" /users ext4 defaults 0 0' >> /etc/fstab