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

1)挂载光盘镜像

[root@centos7 ~]#mount /dev/sr0 /mnt/

[root@centos7 ~]# df -h

Filesystem               Size  Used Avail Use% Mounted on

/dev/mapper/centos-root   60G  5.2G   55G   9% /

devtmpfs                 983M     0  983M   0% /dev

tmpfs                   1000M     0 1000M   0% /dev/shm

tmpfs                   1000M   75M  926M   8% /run

tmpfs                   1000M     0 1000M   0% /sys/fs/cgroup

/dev/sda1               1014M  166M  849M  17% /boot

tmpfs                    200M   52K  200M   1% /run/user/1008

/dev/sr0                  11G   11G     0 100% /mnt

tmpfs                    200M     0  200M   0% /run/user/0

2)搭建本地源

[root@centos7 yum.repos.d]# cat > local.repo <

> [local]

> name=centos7.6

> baseurl=file:///mnt

> enabled=1

> gpgcheck=0

> EOF

3)安装httpd并搭建网络yum源

[root@centos7 yum.repos.d]# yum install httpd -y    #安装成功代表本地源生效

[root@centos7 html]# cd /var/www/html

[root@centos7 html]# ln -s /mnt centos7.6

[root@centos7 html]# ls centos7.6/

CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7

EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7

EULA             isolinux  repodata  TRANS.TBL

4)验证网络yum源(在另外一台centos7上验证)

配置使用网络yum源:

[root@jumpserver yum.repos.d]# cat local.repo

[local]

name=centos7.6

baseurl=http://网络yum源的ip/centos7.6

enabled=1

gpgcheck=0

[root@jumpserver yum.repos.d]#

安装httpd成功代表网络yum源可用

[root@jumpserver yum.repos.d]# yum install httpd -y2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。

1)解压

[root@centos7 bin]# rpm -qi httpd

package httpd is not installed

[root@centos7 src]# tar -xf httpd-2.4.41.tar.gz

2)Configure

[root@centos7 src]# cd httpd-2.4.41/

[root@centos7 httpd-2.4.41]# ./configure

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-pc-linux-gnu

checking host system type... x86_64-pc-linux-gnu

checking target system type... x86_64-pc-linux-gnu

configure:

configure: Configuring Apache Portable Runtime library...

configure:

checking for APR... no

configure: error: APR not found.  Please read the documentation.

安装缺少的依赖包:

[root@centos7 httpd-2.4.41]# yum install apr* pcre* -y

[root@centos7 src]# cd httpd-2.4.41/

3)编译

[root@centos7 httpd-2.4.41]# make

4)安装

[root@centos7 httpd-2.4.41]# make install

5)启动并验证

[root@centos7 bin]# pwd

/usr/local/apache2/bin

[root@centos7 bin]# ./apachectl -k start

[root@centos7 bin]# ps aux |grep apache

root     14751  0.0  0.1 103732  2728 ?        Ss   18:34   0:00 /usr/local/apache2/bin/httpd -k start

daemon   14754  0.0  0.1 392644  2416 ?        Sl   18:34   0:00 /usr/local/apache2/bin/httpd -k start

daemon   14755  0.0  0.1 392644  2424 ?        Sl   18:34   0:00 /usr/local/apache2/bin/httpd -k start

daemon   14756  0.0  0.1 458180  2424 ?        Sl   18:34   0:00 /usr/local/apache2/bin/httpd -k start

[root@centos7 bin]# curl localhost

It works!

[root@centos7 bin]#

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

1)为虚拟机添加一块硬盘并让系统马上识别硬盘

[root@centos7 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan

[root@centos7 ~]# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x0003e74f

Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux

/dev/sda2         2099200   136333311    67117056   8e  Linux LVM

Disk /dev/mapper/centos-root: 64.4 GB, 64424509440 bytes, 125829120 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/centos-swap: 4294 MB, 4294967296 bytes, 8388608 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

2)创建一个2G的分区

[root@centos7 ~]# fdisk /dev/sdb

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 0xfbaa7750.

Command (m for help): n

Partition type:

p   primary (0 primary, 0 extended, 4 free)

e   extended

Select (default p): p

Partition number (1-4, default 1): 1

First sector (2048-104857599, default 2048):

Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599): +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.

3)按要求创建分区并挂载

[root@centos7 ~]# mke2fs -t ext4 -b 2048 -L 'TEST' -m 1 /dev/sdb1

[root@centos7 ~]# echo "/dev/sdb1 /test ext4 acl 0 0" >> /etc/fstab

[root@centos7 ~]#mkdir /test

[root@centos7 ~]#mount -a4、创建一个至少有两个PV组成的大小为20G的名为testvg的VG;要求PE大小为16MB, 而后在卷组中创建大小为5G的逻辑卷testlv;挂载至/users目录1)创建2个10G大小的分区

[root@centos7 ~]# fdisk /dev/sdb

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): p

Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xfbaa7750

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1         2048          4196351     2097152   83  Linux

Command (m for help): n

Partition type:

p   primary (1 primary, 0 extended, 3 free)

e   extended

Select (default p): p

Partition number (2-4, default 2):

First sector (4196352-104857599, default 4196352):

Using default value 4196352

Last sector, +sectors or +size{K,M,G} (4196352-104857599, default 104857599): +10G

Partition 2 of type Linux and of size 10 GiB is set

Command (m for help): p

Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xfbaa7750

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1         2048          4196351     2097152   83  Linux

/dev/sdb2        4196352         25167871    10485760   83  Linux

Command (m for help): n

Partition type:

p   primary (2 primary, 0 extended, 2 free)

e   extended

Select (default p): p

Partition number (3,4, default 3):

First sector (25167872-104857599, default 25167872):

Using default value 25167872

Last sector, +sectors or +size{K,M,G} (25167872-104857599, default 104857599): +10G

Partition 3 of type Linux and of size 10 GiB is set

Command (m for help): p

Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0xfbaa7750

Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048     4196351     2097152   83  Linux

/dev/sdb2         4196352    25167871    10485760   83  Linux

/dev/sdb3        25167872    46139391    10485760   83  Linux

Command (m for help): w

The partition table has been altered!

Calling ioctl() to re-read partition table.

Syncing disks.

[root@centos7 ~]#

2)创建pv

[root@centos7 ~]# pvcreate /dev/sdb2 /dev/sdb3

Physical volume "/dev/sdb2" successfully created.

Physical volume "/dev/sdb3" successfully created.

[root@centos7 ~]#

3)创建逻辑卷组

[root@centos7 ~]# vgcreate -s 16MB testvg /dev/sdb2 /dev/sdb3

Volume group "testvg" successfully created

[root@centos7 ~]# vgdisplay testvg

--- 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               0fGU0o-XJGc-TKQD-2G2G-bL3I-bO7I-3sV4Y0

[root@centos7 ~]#

4)创建大小为5G的逻辑卷testlv;挂载至/users目录

[root@centos7 ~]# lvcreate -L 5G -n testlv testvg

Logical volume "testlv" created.

[root@centos7 ~]# lvdisplay testvg

--- Logical volume ---

LV Path                /dev/testvg/testlv

LV Name                testlv

VG Name                testvg

LV UUID                Onl32p-WxHz-TcX3-EBzf-plNB-I01E-sPCuev

LV Write Access        read/write

LV Creation host, time centos7.6, 2020-03-08 21:10:12 +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     256

Block device           253:2

[root@centos7 ~]# mkdir /users

[root@centos7 ~]# mkfs.xfs /dev/mapper/testvg-testlv

meta-data=/dev/mapper/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@centos7 ~]# mount /dev/mapper/testvg-testlv /users

[root@centos7 ~]# df -h

Filesystem                 Size  Used Avail Use% Mounted on

/dev/mapper/centos-root     60G  5.4G   55G   9% /

devtmpfs                   983M     0  983M   0% /dev

tmpfs                     1000M     0 1000M   0% /dev/shm

tmpfs                     1000M   74M  926M   8% /run

tmpfs                     1000M     0 1000M   0% /sys/fs/cgroup

/dev/sda1                 1014M  166M  849M  17% /boot

tmpfs                      200M     0  200M   0% /run/user/0

/dev/sr0                    11G   11G     0 100% /mnt

/dev/mapper/testvg-testlv  5.0G   33M  5.0G   1% /users

[root@centos7 ~]#

linux yum安装分区工具,搭建本地和网络yum源、源码编译安装软件及磁盘分区管理...相关推荐

  1. Dnsmasq安装与配置-搭建本地DNS服务器 更干净更快无广告DNS解析

    Dnsmasq安装与配置-搭建本地DNS服务器 更干净更快无广告DNS解析 文章目录 Dnsmasq安装 Dnsmasq配置 Dnsmasq启动 Dnsmasq使用 Dnsmasq小结 默认的情况下, ...

  2. 菜鸟学Linux 第030篇笔记 yum使用,源码编译安装

    菜鸟学Linux 第030篇笔记 yum使用,源码编译安装 yum yellow updatet modified c/s: client, server yum repository 文件服务定义 ...

  3. linux 安装源码网卡包,【linux命令】Linux通过yum 或者源码编译安装vnstat查看网卡流量...

    Linux通过vnstat查看网卡流量有两种安装方式: yum 安装或者源码编译安装. 1,yum安装. 直接运行yum install vnstat  -y 安装完后测试: [[email prot ...

  4. yum安装 vs 源码编译安装

    一直坚持yum安装,原则如下: 1. 公共约定优先,方便运维 2. 方便编写自动化部署脚本 3. 应用升级方便 一直以为源码编译安装可能会有效率上的优势,结局却比较另人忧伤. 根做运维的朋友聊天,谈到 ...

  5. LNMP架构环境搭建之PHP、Nginx源码编译安装及其简单配置应用

    LNMP架构中的Mysql见上一篇博文"LNMP架构环境搭建之mysql源码编译安装" 一.PHP简介 PHP(外文名:PHP: Hypertext Preprocessor,中文 ...

  6. 保姆级教程——Ubuntu16.04 Server下深度学习环境搭建:安装CUDA8.0,cuDNN6.0,Bazel0.5.4,源码编译安装TensorFlow1.4.0(GPU版)...

    写在前面 本文叙述了在Ubuntu16.04 Server下安装CUDA8.0,cuDNN6.0以及源码编译安装TensorFlow1.4.0(GPU版)的亲身经历,包括遇到的问题及解决办法,也有一些 ...

  7. LAMP架构搭建明细,源码编译安装

    LAMP架构搭建明细 LAMP概述 Apache源码编译 Mysql源码编译 PHP源码编译 LAMP概述 LAMP是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写 Linux,操 ...

  8. LNMP架构环境搭建之mysql源码编译安装

    Mysql MySQL是一个开源的数据库,在互联网行业应用的很广泛,下面来记录一下从源码编译安装的步骤,当然,MySQL也有其他安装方式,比如,使用yum下载安装rpm包,或者二进制方式安装,如果机器 ...

  9. Linux 下源码编译安装 vim 8.1

    前言 目前 linux 的各个发行版基本上都是带了一个 vi 编辑器的,而本文要说的 vim 编辑器对 vi 做了一些优化升级,更好用.当我们需要远程操作一台 linux 服务器的时候,只能使用命令行 ...

最新文章

  1. mtcnn android
  2. Maven Filter
  3. Torch——[TypeError: can‘t pickle Environment objects]解决方案
  4. 某中学的排课管理系统_某中学的排课管理系统(SQL的简单应用)
  5. mac下用scp命令实现本地文件与服务器Linux文件之间的相互传输
  6. 元气骑士没有手柄怎么解锁机器人_机器人怎么解锁(元气骑士机器人)
  7. DOMBOM(source、methods、contents、Application)
  8. linux中使用lftp上传下载文件
  9. Linux——alias 设置别名详解
  10. python dict排序
  11. 小米 MIUI 12 Magisk root教程(无需刷REC)
  12. 【转】win7 旗舰版激活密钥
  13. 网络:网络地址到虚拟地址的映射ARP
  14. 记录华夏ERP配置报错
  15. 操作系统安全防护技术
  16. 元认知是认知的监督体系
  17. java---JUC并发包详解
  18. 轻松玩转AI(从Python开始之Python3入门)
  19. lol网通区服务器的位置,lol网一是哪个区
  20. 转:intellij idea如何右键新建文件中添加jsp格式的文件【初学者适用】

热门文章

  1. 【OpenCV 4开发详解】图像噪声的种类与生成
  2. Leetcode (396 旋转函数)
  3. Rotate Image
  4. zookeeper3.4.6配置实现自动清理日志
  5. CSS background 之设置图片为背景技巧
  6. Ubuntu13.04下使用dnw
  7. mysql从入门到精通之数据库安装图解
  8. wpf计算字符大小占像素_[读书笔记]《计算机科学速成课》——23 屏幕与2D图像显示...
  9. session传递参数_分布式 Session 之 Spring Session 架构与设计
  10. 自学入门不在困难,初学者挑战学习Python编程30天 (三)