第七周作业

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

#基于光盘的本地yum源配置
配置/etc/yum.repos.d/local.repo

[local]
name=CentOS
baseurl=file:///misc/cd
enable=1
gpgcheck=0

#将阿里云epel源配置为本机的网络epel源
配置/etc/yum.repos.d/epel.repo
[epel]
name=aliyun epel
baseurl=https://mirrors.aliyun.com/epel/$releasever/$basearch/
gpgcheck=0
enabled=1

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

#第一步:解包
[root@centos6 /data]#tar xvf httpd-2.4.25.tar.bz2 
[root@centos6 /data/httpd-2.4.25]#ls
ABOUT_APACHE     ap.d          CHANGES         docs         httpd.spec      libhttpd.dep  Makefile.win   README            srclib
acinclude.m4     build         CMakeLists.txt  emacs-style  include         libhttpd.dsp  modules        README.cmake      support
Apache-apr2.dsw  BuildAll.dsp  config.layout   httpd.dep    INSTALL         libhttpd.mak  NOTICE         README.platforms  test
Apache.dsw       BuildBin.dsp  configure       httpd.dsp    InstallBin.dsp  LICENSE       NWGNUmakefile  ROADMAP           VERSIONING
apache_probes.d  buildconf     configure.in    httpd.mak    LAYOUT          Makefile.in   os             server
#第二步:开始编译
[root@centos6 /data/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... /bin/grep
checking for egrep... /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.  #提示缺少APR
============================================================= N/S Matched: apr =============================================================
apr-devel.i686 : APR library development kit          #找到缺失的APR
apr-devel.x86_64 : APR library development kit
apr-util-devel.i686 : APR utility library development kit
apr-util-devel.x86_64 : APR utility library development kit
apr-util-ldap.x86_64 : APR utility library LDAP support
apr-util-mysql.x86_64 : APR utility library MySQL DBD driver
apr-util-odbc.x86_64 : APR utility library ODBC DBD driver
apr-util-pgsql.x86_64 : APR utility library PostgreSQL DBD driver
apr-util-sqlite.x86_64 : APR utility library SQLite DBD driver
haproxy.x86_64 : HAProxy is a TCP/HTTP reverse proxy for high availability environments
apr.i686 : Apache Portable Runtime library

#使用命令yum search apr查询APR包
[root@centos7 /data/httpd-2.4.25]#yum search apr-devel
#然后安装apr-devel
yum install apr-devel
#执行configure命令出现新的报错“APR-util not found”
[root@centos7 /data/httpd-2.4.25]#yum install apr-util-devel
#执行configure命令出现新的报错“pcre-config for libpcre not found”
[root@centos7 /data/httpd-2.4.25]#yum install pcre-devel
#执行configure命令出现新的报错“error: mod_ssl has been requested but can not be built due to prerequisite failures”
[root@centos7 /data/httpd-2.4.25]#yum install openssl-devel

#第三步:根据Makefile文件,构建应用程序
make -j 4(因文件较多,启用4线程并行编译)

#第四步:复制文件到相应路径
make install
[root@centos7 /data/httpd-2.4.25]#tree /apps -d
/apps
├── httpd24
│   ├── bin
│   ├── build
│   ├── cgi-bin
│   ├── error
│   │   └── include
│   ├── htdocs
│   ├── icons
│   │   └── small
│   ├── include
│   ├── logs
│   ├── man
│   │   ├── man1
│   │   └── man8
│   ├── manual
│   │   ├── developer
│   │   ├── faq
│   │   ├── howto
│   │   ├── images
│   │   ├── misc
│   │   ├── mod
│   │   ├── platform
│   │   ├── programs
│   │   ├── rewrite
│   │   ├── ssl
│   │   ├── style
│   │   │   ├── css
│   │   │   ├── lang
│   │   │   ├── latex
│   │   │   ├── scripts
│   │   │   └── xsl
│   │   │       └── util
│   │   └── vhosts
│   └── modules
└── tree
    ├── bin
    └── man
        └── man1

#第五步:把程序目录写到PATH环境变量中
vim /etc/profile.d/env.sh
PATH=/apps/http24/bin:$PATH
#使修改后的环境变量生效
./etc/profile.d/env.sh
echo $PATH             #检查是否生效
#第六步:启动程序
apachectl start

#第七步:设置开机自启动
在rc.local文件中追加/apps/httpd24/bin/apachectl start 
vim /etc/rc.d/rc.local
并为文件添加执行权限,即成为可持续运行的服务。
#chmod +x /etc/rc.d/rc.local

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

#创建一个sdb2
fdisk /dev/sdb
[root@centos6 ~]#partx -a /dev/sdb
[root@centos6 ~]#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 97.7G  0 part /
├─sda3   8:3    0 48.8G  0 part /data
├─sda4   8:4    0    1K  0 part 
├─sda5   8:5    0    2G  0 part [SWAP]
└─sda6   8:6    0    1G  0 part 
sr0     11:0    1  3.7G  0 rom  /media/CentOS_6.10_Final
sdb      8:16   0   20G  0 disk 
├─sdb1   8:17   0    1G  0 part /mnt/sdb1
└─sdb2   8:18   0    2G  0 part 
[root@centos6 ~]#mke2fs -t ext4 -b 2048 -m 1 -L 'TEST' /dev/sdb2
mke2fs 1.41.12 (17-May-2010)
Filesystem label=TEST
OS type: Linux
Block size=2048 (log=1)
Fragment size=2048 (log=1)
Stride=0 blocks, Stripe width=0 blocks
131560 inodes, 1052256 blocks
10522 blocks (1.00%) reserved for the super user
First data block=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

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[root@centos6 ~]#mkdir /test            #创建挂载点
[root@centos6 /]#mount /dev/sdb2 /test/
#设置开机自动挂载至/test目录
[root@centos6 /]#vim /etc/fstab 
/dev/sdb2               /test                   ext4    acl      0 0
[root@centos6 /]#df -hT
Filesystem     Type     Size  Used Avail Use% Mounted on
/dev/sda2      ext4      96G  4.6G   87G   5% /
tmpfs          tmpfs    490M   76K  490M   1% /dev/shm
/dev/sda1      ext4     976M   34M  892M   4% /boot
/dev/sda3      ext4      48G  101M   46G   1% /data
/dev/sr0       iso9660  3.8G  3.8G     0 100% /media/CentOS_6.10_Final
/dev/sdb1      ext4     988M  1.3M  935M   1% /mnt/sdb1
/dev/sdb2      ext4     2.0G  9.1M  1.9G   1% /test

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

#创建PV
[root@centos7 /apps/httpd24]#pvcreate /dev/sd{c,d}
  Physical volume "/dev/sdc" successfully created.
  Physical volume "/dev/sdd" successfully created.
#创建VG
[root@centos7 /apps/httpd24]#vgcreate testvg /dev/sd{c,d} -s 16
  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               0oJuxl-qfUJ-dZYg-i7b8-H9JN-nKjt-9Qah6B
#创建大小为5G,名字为testlv的逻辑卷
[root@centos7 ~]#lvcreate -n testlv -L 5G testvg
#对testlv创建文件系统
[root@centos7 ~]#mkfs.xfs /dev/testvg/testlv 
[root@centos7 ~]#ll /dev/testvg/testlv 
lrwxrwxrwx 1 root root 7 Jul  6 22:15 /dev/testvg/testlv -> ../dm-0
[root@centos7 ~]#ll /dev/mapper/testvg-testlv 
lrwxrwxrwx 1 root root 7 Jul  6 22:15 /dev/mapper/testvg-testlv -> ../dm-0
[root@centos7 ~]#mount /dev/testvg/testlv /users
[root@centos7 ~]#df -hT
/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、付费专栏及课程。

余额充值