第六周

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正常显示则成功

图片.png

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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 200,045评论 5 468
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,114评论 2 377
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 147,120评论 0 332
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 53,902评论 1 272
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 62,828评论 5 360
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,132评论 1 277
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,590评论 3 390
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,258评论 0 254
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,408评论 1 294
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,335评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,385评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,068评论 3 315
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,660评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,747评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,967评论 1 255
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,406评论 2 346
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 41,970评论 2 341