Q1、自建yum仓库,分别为网络源和本地源
[root@Centos7 ~]# cd /etc/yum.repos.d/
[root@Centos7 ~]# mkdir bak
[root@Centos7 ~]# mv *.repo bak/
[root@Centos7 yum.repos.d]# vim base.repo
[cdrom]
name=cdrom base
baseurl=file:///misc/cd
gpgkey=file:///misc/cd/RPM-GPG-KEY-CentOS-$releasever
[aliyun]
name=aliyun base
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgkey=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/RPM-GPG-KEY-CentOS-$releasever
gpgcheck=1
enabled=1
[EPEL]
name=EPEL base
baseurl=http://mirrors.aliyun.com/epel/$releasever/$basearch/
gpgcheck=0
enabled=1
[root@Centos7 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: EPEL aliyun cdrom
Cleaning up list of fastest mirrors
Other repos take up 764 M of disk space (use --verbose for details)
[root@Centos7 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
EPEL | 5.3 kB 00:00:00
aliyun | 3.6 kB 00:00:00
cdrom | 3.6 kB 00:00:00
(1/7): EPEL/7/x86_64/group_gz | 95 kB 00:00:00
(2/7): EPEL/7/x86_64/updateinfo | 1.0 MB 00:00:00
(3/7): aliyun/7/x86_64/group_gz | 165 kB 00:00:00
(4/7): cdrom/group_gz | 166 kB 00:00:00
(5/7): cdrom/primary_db | 3.1 MB 00:00:00
(6/7): aliyun/7/x86_64/primary_db | 6.0 MB 00:00:01
(7/7): EPEL/7/x86_64/primary_db | 6.7 MB 00:00:01
repo id repo name status
EPEL/7/x86_64 EPEL base 13,217
aliyun/7/x86_64 aliyun base 10,097
cdrom drom base 4,021
repolist: 27,335
Q2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
[root@Centos7 ~]# yum install gcc openssl-devel pcre-devel apr-devel apr-util-devel -y
[root@Centos7 ~]# tar xf httpd-2.4.39.tar.bz2
[root@Centos7 ~]# mkdir /apps
[root@Centos7 ~]# cd httpd-2.4.39/
[root@Centos7 httpd-2.4.39]# ./configure --prefix=/apps/http24 --sysconfdir=/etc/httpd --enable-ssl --enable-so
[root@Centos7 httpd-2.4.39]# make && make install
[root@Centos7 httpd-2.4.39]# /apps/http24/bin/apachectl start
[root@Centos7 httpd-2.4.39]# curl 192.168.139.110
<html><body><h1>It works!</h1></body></html>
Q3、创建一个2G的文件系统,块大小为2048byte,预留1%可用空间,文件系统 ext4,卷标为TEST,要求此分区开机后自动挂载至/test目录,且默认有acl挂载选项
[root@Centos7 ~]# echo -e 'n\n\n+2G\nw\n' | fdisk /dev/sda
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.
Command (m for help): Command (m for help): All primary partitions are in use
Adding logical partition 6
First sector (325064704-419430399, default 325064704): Using default value 325064704
Last sector, +sectors or +size{K,M,G} (325064704-419430399, default 419430399): Partition 6 of type Linux and of size 2 GiB is set
Command (m for help): The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@Centos7 ~]# partprobe
[root@Centos7 ~]# mkfs.ext4 -b 2048 -m 1 -L TEST /dev/sda6 #ext4分区,块大小2048,预留1%,卷标TEST
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/sda6
/dev/sda6: LABEL="TEST" UUID="1988e6a6-e9d4-44e0-9b2e-e1cbb3baacc6" TYPE="ext4"
[root@Centos7 ~]# vim /etc/fstab
UUID=b6cd728b-bba0-4293-82f3-c79a5afd648e / xfs defaults 0 0
UUID=7a05f57c-dbbd-468a-9468-f79aaa0e9ff3 /boot xfs defaults 0 0
UUID=33b2eb35-fd44-4d83-9f68-01ef1bfe8a67 /data xfs defaults 0 0
UUID=f101c6fe-d00d-4162-aab6-ab1ef7333047 swap swap defaults 0 0
UUID=1988e6a6-e9d4-44e0-9b2e-e1cbb3baacc6 /test ext4 defaults,acl 0 0
[root@Centos7 ~]# mkdir /test
[root@Centos7 ~]# mount -a
[root@Centos7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 100G 4.9G 96G 5% /
devtmpfs 975M 0 975M 0% /dev
tmpfs 991M 0 991M 0% /dev/shm
tmpfs 991M 19M 973M 2% /run
tmpfs 991M 0 991M 0% /sys/fs/cgroup
/dev/sda3 50G 33M 50G 1% /data
/dev/sda1 1014M 164M 851M 17% /boot
tmpfs 199M 0 199M 0% /run/user/0
tmpfs 199M 12K 199M 1% /run/user/42
/dev/sda6 2.0G 9.1M 1.9G 1% /test
[root@Centos7 ~]# dumpe2fs -h /dev/sda6 | grep acl
dumpe2fs 1.42.9 (28-Dec-2013)
Default mount options: user_xattr acl
Q4、创建一个至少有两个PV组成的大小为20G的名为testvg的VG;要求PE大小 为16MB, 而后在卷组中创建大小为5G的逻辑卷testlv;挂载至/users目录
#先创建2个10G的分区
[root@Centos7 ~]# echo -e "\nn\n\n+10G\nt\n\n8e\nw\n" | fdisk /dev/sda
[root@Centos7 ~]# echo -e "\nn\n\n+10G\nt\n\n8e\nw\n" | fdisk /dev/sda
[root@Centos7 ~]# partprobe
[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]
├─sda6 8:6 0 2G 0 part /test
├─sda7 8:7 0 10G 0 part
└─sda8 8:8 0 10G 0 part
sr0 11:0 1 4.3G 0 rom
[root@Centos7 ~]# pvcreate /dev/sda{7,8}
Physical volume "/dev/sda7" successfully created.
Physical volume "/dev/sda8" successfully created.
[root@Centos7 ~]# vgcreate testvg -s 16 /dev/sda{7,8}
Volume group "testvg" successfully created
[root@Centos7 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
testvg 2 0 0 wz--n- <19.97g <19.97g
[root@Centos7 ~]# lvcreate -n testlv -L 5G testvg
Logical volume "testlv" created.
[root@Centos7 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
testlv testvg -wi-a----- 5.00g
[root@Centos7 ~]# mkfs.ext4 /dev/mapper/testvg-testlv
[root@Centos7 ~]# vim /etc/fstab
/dev/mapper/testvg-testlv /users ext4 defaults 0 0
[root@Centos7 ~]# mkdir /users
[root@Centos7 ~]# mount -a
[root@Centos7 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 100G 4.9G 96G 5% /
devtmpfs 975M 0 975M 0% /dev
tmpfs 991M 0 991M 0% /dev/shm
tmpfs 991M 19M 973M 2% /run
tmpfs 991M 0 991M 0% /sys/fs/cgroup
/dev/sda3 50G 33M 50G 1% /data
/dev/sda1 1014M 164M 851M 17% /boot
tmpfs 199M 0 199M 0% /run/user/0
tmpfs 199M 12K 199M 1% /run/user/42
/dev/sda6 2.0G 9.1M 1.9G 1% /test
/dev/mapper/testvg-testlv 4.8G 20M 4.6G 1% /users
网友评论