第7周作业

题1
在VMware虚拟机中通过光碟实理本地yum源配置
创建光盘挂载目录

[root@use09 ~]# mkdir /isolinux

配置开机自动挂载

[root@use09 ~]# vim /etc/fstab
[root@use09 ~]# mount -a
[root@use09 ~]# tail -n 1 /etc/fstab
/dev/sr0 /isolinux iso9660 defaults 0 0

创建yum配置文件

[root@use09 ~]# vim /etc/yum.repos.d/base.repo
[root@use09 ~]# cat /etc/yum.repos.d/base.repo
[base]
name=base
baseurl=file:///isolinux
enabled=1
gpgcheck=0

验证效果

[root@use09 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Cleaning repos: base
Cleaning up list of fastest mirrors
Other repos take up 85 M of disk space (use --verbose for details)
[root@use09 yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                                                                          | 3.6 kB  00:00:00
(1/2): base/group_gz                                                                                          | 3.5 kB  00:00:00
(2/2): base/primary_db                                                                                        | 798 kB  00:00:00
repo id                                                          repo name                                                     status
base                                                             base                                                          445
repolist: 445

补充

yum clean all 清理缓存
yum repolist 列出可用的yum源
将阿里云epel源配置为本机的网络epel源
确定本机可联网,并正确解析域名

[root@use09 ~]# ping www.baidu.com
PING www.a.shifen.com (14.215.177.39) 56(84) bytes of data.
64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=1 ttl=128 time=4.58 ms
64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=2 ttl=128 time=7.17 ms
64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=3 ttl=128 time=13.5 ms
^C
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 4.581/8.427/13.529/3.759 ms

配置yum配置文件

[root@use09 ~]# cat /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.aliyun.com/epel/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://mirrors.aliyun.com/epel/7/$basearch/debug
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0

[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://mirrors.aliyun.com/epel/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0

验证epel源

[root@use09 ~]# yum clean all
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Cleaning repos: epel
Cleaning up list of fastest mirrors
Other repos take up 52 M of disk space (use --verbose for details)
[root@use09 ~]# yum repolist
Loaded plugins: fastestmirror
Determining fastest mirrors
epel                                                                                                          | 4.7 kB  00:00:00
(1/3): epel/x86_64/group_gz                                                                                   |  95 kB  00:00:00
(2/3): epel/x86_64/updateinfo                                                                                 | 1.0 MB  00:00:01
(3/3): epel/x86_64/primary_db                                                                                 | 6.8 MB  00:00:02
repo id                                       repo name                                                                        status
epel/x86_64                                   Extra Packages for Enterprise Linux 7 - x86_64                                   13,286
repolist: 13,286

补充

yum clean all 清理本地缓存
yum repolist 列出可用yum源
阿里云的epel配置可在阿里云的网站获取,阿里epel

题2
准备原码包
这里将apr原码包一同放入httpd原码包中进行编译

[root@use09 ~]# cd /usr/local/src/
[root@use09 src]# ls
apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.39.tar.gz
[root@use09 src]# tar -xf apr-1.7.0.tar.gz 
[root@use09 src]# tar -xf apr-util-1.6.1.tar.gz 
[root@use09 src]# tar -xf httpd-2.4.39.tar.gz

合并原码包
将apr相关原码包放入httpd原码包中

[root@use09 src]# mv apr-1.7.0 httpd-2.4.39/srclib/apr
[root@use09 src]# mv apr-util-1.6.1 httpd-2.4.39/srclib/apr-util

安装依赖包

[root@use09 src]# yum install gcc pcre-devel openssl-devel expat-devel -y

生成编译配置文件

[root@use09 src]# cd httpd-2.4.39/
[root@use09 httpd-2.4.39]# ./configure \
> --prefix=/app/httpd24 \
> --enable-so \
> --enable-ssl \
> --enable-cgi \
> --enable-rewrite \
> --with-zlib \
> --with-pcre \
> --with-included-apr \
> --enable-modules=most \
> --enable-mpms-shared=all \
> --with-mpm=prefork

编译

[root@use09 httpd-2.4.39]# make

安装

[root@use09 httpd-2.4.39]# make install

配置PATH变量

[root@use09 httpd-2.4.39]# echo 'export PATH=/app/httpd24/bin/:$PATH' > /etc/profile.d/httpd24.sh
[root@use09 httpd-2.4.39]# source /etc/profile.d/httpd24.sh

启用httpd服务
提示是因为ServerName没有定义,不影响httpd启动

[root@use09 httpd-2.4.39]# apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::87ee:bad9:e86f:1df9%ens33. Set the 'ServerName' directive globally to suppress this message

验证httpd服务

[root@use09 httpd-2.4.39]# ps aux | grep httpd
root      40367  0.0  0.2  99568  2360 ?        Ss   14:28   0:00 /app/httpd24/bin/httpd -k start
daemon    40368  0.0  0.1  99568  1608 ?        S    14:28   0:00 /app/httpd24/bin/httpd -k start
daemon    40369  0.0  0.1  99568  1608 ?        S    14:28   0:00 /app/httpd24/bin/httpd -k start
daemon    40370  0.0  0.1  99568  1608 ?        S    14:28   0:00 /app/httpd24/bin/httpd -k start
daemon    40371  0.0  0.1  99568  1608 ?        S    14:28   0:00 /app/httpd24/bin/httpd -k start
daemon    40372  0.0  0.1  99568  1608 ?        S    14:28   0:00 /app/httpd24/bin/httpd -k start

补充

apr apache portable runtime用于实现httpd跨平台使用问题,可以类比为java虚拟机之于java,windows平台的.net那样的实现机制;
PATH变量记录了系统中可执行程序的目录位置,这样可使执行httpd的命令时不用输入完整路径;

题3
创建一个2G大小的分区,sdb1

[root@use01 ~]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   20G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0    2G  0 part [SWAP]
└─sda3   8:3    0   17G  0 part /
sdb      8:16   0    5G  0 disk 
└─sdb1   8:17   0    2G  0 part 
sdc      8:32   0    5G  0 disk 
sr0     11:0    1 1024M  0 rom

创建文件系统

[root@use01 ~]# mke2fs -b 2048 -m 1 -t ext4 -L TEST /dev/sdb1
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

查看分区UUID

[root@use01 ~]# blkid /dev/sdb1
/dev/sdb1: LABEL="TEST" UUID="258c14a3-3b0e-4898-9618-4a375142d94b" TYPE="ext4"

创建挂载文件夹

[root@use01 ~]# mkdir /test

自动挂载配置

[root@use01 ~]# tail -n 1 /etc/fstab
UUID=258c14a3-3b0e-4898-9618-4a375142d94b /test ext4 defaults 0 0
[root@use01 ~]# mount -a
[root@use01 ~]# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/sda3      xfs        17G  1.2G   16G   7% /
devtmpfs       devtmpfs  476M     0  476M   0% /dev
tmpfs          tmpfs     487M     0  487M   0% /dev/shm
tmpfs          tmpfs     487M  7.6M  479M   2% /run
tmpfs          tmpfs     487M     0  487M   0% /sys/fs/cgroup
/dev/sda1      xfs      1014M  127M  888M  13% /boot
tmpfs          tmpfs      98M     0   98M   0% /run/user/0
/dev/sdb1      ext4      2.0G  9.1M  1.9G   1% /test

题4
添加硬盘,sdb

[root@use01 ~]# lsblk 
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   20G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0    2G  0 part [SWAP]
└─sda3   8:3    0   17G  0 part /
sdb      8:16   0    5G  0 disk 
sr0     11:0    1 1024M  0 rom

创建物理卷

[root@use01 ~]# pvcreate /dev/sdb
  Physical volume "/dev/sdb" successfully created.

创建卷组

[root@use01 ~]# vgcreate -s 16m testvg /dev/sdb
  Volume group "testvg" successfully created

创建逻辑卷

[root@use01 ~]# lvcreate -L 2G -n testlv testvg
  Logical volume "testlv" created.

创建挂载文件夹

[root@use01 ~]# mkdir /users

创建文件系统

[root@use01 ~]# mkfs.xfs /dev/testvg/testlv 
meta-data=/dev/testvg/testlv     isize=512    agcount=4, agsize=131072 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=524288, 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@use01 ~]# mount /dev/testvg/testlv /users/
[root@use01 ~]# df -Th
Filesystem                Type      Size  Used Avail Use% Mounted on
/dev/sda3                 xfs        17G  1.4G   16G   8% /
devtmpfs                  devtmpfs  476M     0  476M   0% /dev
tmpfs                     tmpfs     487M     0  487M   0% /dev/shm
tmpfs                     tmpfs     487M  7.6M  479M   2% /run
tmpfs                     tmpfs     487M     0  487M   0% /sys/fs/cgroup
/dev/sda1                 xfs      1014M  127M  888M  13% /boot
tmpfs                     tmpfs      98M     0   98M   0% /run/user/0
/dev/mapper/testvg-testlv xfs       2.0G   33M  2.0G   2% /users
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

okman312

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值