第六周作业

旧街凉风 提交于 2020-03-25 12:18:19

3 月,跳不动了?>>>

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

配置网络源:

阿里云yum源链接:https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11Al1i4w
备份:
# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# yum makecache
# yum repolist

配置本地源:

[root@www ~]# mount /dev/cdrom /mnt/
[root@www ~]# rm -rf /etc/yum.repos.d/*
[root@www ~]# vim local.repo
[centos]
name=centos
baseurl=file:///mnt
gpgcheck=0
enabled=1
[root@www yum.repos.d]# yum clean all 
Loaded plugins: fastestmirror, langpacks
Cleaning repos: centos
Cleaning up list of fastest mirrors
Other repos take up 125 M of disk space (use --verbose for details)
[root@www yum.repos.d]# yum repolist  
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
centos                                                                              | 3.6 kB  00:00:00     
(1/2): centos/group_gz                                                              | 165 kB  00:00:00     
(2/2): centos/primary_db                                                            | 3.2 MB  00:00:00     
repo id                                            repo name                                         status
centos                                             centos                                            4,067
repolist: 4,067

2、 编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。

[root@www ~]# tar xvf httpd-2.4.25.tar.bz2
[root@www ~]# cd httpd-2.4.25/
[root@www httpd-2.4.25]# ./configure --prefix=/apps/httpd24 --sysconfdir=/etc/httpd --enable-ssl --enable-so
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... no
configure: error: APR not found.  Please read the documentation.
[root@www httpd-2.4.25]# yum install -y apr-devel.x86_64
[root@www httpd-2.4.25]# ./configure --prefix=/apps/httpd24 --sysconfdir=/etc/httpd --enable-ssl --enable-so
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to "  -pthread"
  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "
configure: 
configure: Configuring Apache Portable Runtime Utility library...
configure: 
checking for APR-util... no
configure: error: APR-util not found.  Please read the documentation.
[root@www httpd-2.4.25]# yum install -y apr-util-devel.x86_64
[root@www httpd-2.4.25]# ./configure --prefix=/apps/httpd24 --sysconfdir=/etc/httpd --enable-ssl --enable-so
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to "  -pthread"
  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "
configure: 
configure: Configuring Apache Portable Runtime Utility library...
configure: 
checking for APR-util... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C99... -std=gnu99
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
[root@www httpd-2.4.25]# yum search pcre*
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Warning: No matches found for: pcre*
No matches found
[root@www httpd-2.4.25]# yum search pcre
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
============================================================================================================ N/S matched: pcre ============================================================================================================
pcre-devel.x86_64 : Development files for pcre
pcre2-utf16.x86_64 : UTF-16 variant of PCRE2
pcre.x86_64 : Perl-compatible regular expression library
pcre2.x86_64 : Perl-compatible regular expression library

  Name and summary matches only, use "search all" for everything.
[root@www httpd-2.4.25]# yum install -y pcre-devel.x86_64 
[root@www httpd-2.4.25]# ./configure --prefix=/apps/httpd24 --sysconfdir=/etc/httpd --enable-ssl --enable-so
[root@www httpd-2.4.25]# echo $?
0
[root@www httpd-2.4.25]# make -j 2  && make install
[root@www httpd-2.4.25]# echo $?
0
[root@www httpd-2.4.25]# /apps/httpd24/bin/apachectl start
[root@www httpd-2.4.25]# curl http://192.168.43.130
<html><body><h1>It works!</h1></body></html>
[root@www httpd-2.4.25]# 

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

###新添加一块硬盘,需要进行扫盘
[root@www ~]# echo "- - -" > /sys/class/scsi_host/host0/scan

[root@www ~]# fdisk /dev/sdc
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 0xd2acf92d.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p):
Using default response p
Partition number (1-4, default 1):
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +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@www ~]# mkfs.ext4 -b 2048 -m 1 -L TEST /dev/sdc1
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@www ~]# vim /etc/fstab
UUID=e66dfc23-e538-4397-a0e5-29b4c41d7c5d /test                   ext4    defaults,acl    0 0
[root@www ~]# mkdir /test
[root@www ~]# mount -a
[root@www ~]# df -hT
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs  975M     0  975M   0% /dev
tmpfs          tmpfs     991M     0  991M   0% /dev/shm
tmpfs          tmpfs     991M   11M  981M   2% /run
tmpfs          tmpfs     991M     0  991M   0% /sys/fs/cgroup
/dev/sda2      xfs       100G  6.2G   94G   7% /
/dev/sda3      xfs        50G  2.2G   48G   5% /data
/dev/sdb2      xfs       2.0G   33M  2.0G   2% /home
/dev/sda1      xfs      1014M  168M  847M  17% /boot
tmpfs          tmpfs     199M   12K  199M   1% /run/user/42
tmpfs          tmpfs     199M     0  199M   0% /run/user/0
/dev/sdc1      ext4      2.0G  9.1M  1.9G   1% /test
[root@www ~]# tune2fs -l /dev/sdc1
tune2fs 1.42.9 (28-Dec-2013)
Filesystem volume name:   TEST
Last mounted on:          <not available>
Filesystem UUID:          e66dfc23-e538-4397-a0e5-29b4c41d7c5d
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              131072
...
[root@www ~]#

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

[root@www ~]# pvcreate /dev/sd{b3,c1}
WARNING: ext4 signature detected on /dev/sdc1 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sdc1.
  Physical volume "/dev/sdb3" successfully created.
  Physical volume "/dev/sdc1" successfully created.
[root@www ~]# vgcreate -s 16M  testvg  /dev/sd{b3,c1}
  Volume group "testvg" successfully created
[root@www ~]# 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               0QNYeC-q8HI-CSUe-YQuS-uBac-28DJ-efORrz
[root@www ~]# lvcreate -L +5G -n testlv testvg
  Logical volume "testlv" created.

[root@www ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/testvg/testlv
  LV Name                testlv
  VG Name                testvg
  LV UUID                n2In5A-CtF8-Cp1L-vzzM-mZqy-rfbp-yKk5Zk
  LV Write Access        read/write
  LV Creation host, time www.xiaoliang.com, 2020-03-25 11:19:50 +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

[root@www ~]# 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@www ~]# mkdir /users
[root@www ~]# mount /dev/testvg/testlv /users/
[root@www ~]# df -hT
Filesystem                Type      Size  Used Avail Use% Mounted on
devtmpfs                  devtmpfs  975M     0  975M   0% /dev
tmpfs                     tmpfs     991M     0  991M   0% /dev/shm
tmpfs                     tmpfs     991M   11M  981M   2% /run
tmpfs                     tmpfs     991M     0  991M   0% /sys/fs/cgroup
/dev/sda2                 xfs       100G  6.2G   94G   7% /
/dev/sda3                 xfs        50G  2.2G   48G   5% /data
/dev/sdb2                 xfs       2.0G   33M  2.0G   2% /home
/dev/sda1                 xfs      1014M  168M  847M  17% /boot
tmpfs                     tmpfs     199M   12K  199M   1% /run/user/42
tmpfs                     tmpfs     199M     0  199M   0% /run/user/0
/dev/mapper/testvg-testlv xfs       5.0G   33M  5.0G   1% /users
[root@www ~]# blkid
/dev/sda1: UUID="a70c0f77-5f34-4d0d-9b8c-c38bb2b864f5" TYPE="xfs"
/dev/sda2: UUID="00478075-e8ad-41be-86c0-e8e9634e4f56" TYPE="xfs"
/dev/sda3: UUID="d1983f95-08b7-4878-b234-75da3f01be63" TYPE="xfs"
/dev/sda5: UUID="b116c5f2-2edb-4786-a5b4-e0e1fc57da8c" TYPE="swap"
/dev/sr0: UUID="2019-09-11-18-50-31-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"
/dev/sdb1: UUID="15cb48e9-1a3e-401d-8fe6-0a0b613bc5b7" TYPE="swap"
/dev/sdb2: UUID="a379259c-acd9-4f9d-b858-1aba9bc827d3" TYPE="xfs"
/dev/sdc1: UUID="NnO0FJ-7qYx-PW1P-vEcJ-h5rd-eF8J-aemETu" TYPE="LVM2_member"
/dev/sdb3: UUID="j1Lau6-pmXD-5Ulm-S8NS-WzbS-8peE-VHJQM3" TYPE="LVM2_member"
/dev/mapper/testvg-testlv: UUID="1f399d51-7dd0-479b-8602-d251176cee1b" TYPE="xfs"

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!