美文网首页
程序包安装和磁盘文件系统

程序包安装和磁盘文件系统

作者: jamas | 来源:发表于2020-02-29 10:39 被阅读0次

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

备份原有repo文件

[root@centos7 ~]# cd /etc/yum.repos.d/
[root@centos7 yum.repos.d]# mkdir repobak
[root@centos7 yum.repos.d]# mv *.repo repobak/

创建新的repo文件

vim test.repo
[base]
name=base
baseurl=file:///mnt/cdrom
gpgcheck=0

[epel]
name=epel
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7

验证yum源

[root@centos7 yum.repos.d]# yum repolist 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id                                                    repo name                                                status
!base                                                      base                                                     10,097
!epel                                                      epel                                                     13,195
repolist: 23,292

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

创建安装位置(文件夹)

mkdir /data/http24

安装编译工具

yum groups install "Development Tools"
yum install apr-util-devel apr-devel pcre-devel -y

下载源码包

http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.41.tar.gz

解压缩源码包

tar xvf httpd-2.4.41

编译前可以查看一个README、INSTALL文档

less README
less INSTALL  

编译安装http2.4

./configure --prefix=/data/http24
make
make install

启动服务

[root@centos7 /]# /data/http24/bin/apachectl -k start  //启动服务
[root@centos7 /]# ss -tnl    
State      Recv-Q Send-Q                Local Address:Port                               Peer Address:Port              
LISTEN     0      128                               *:111                                           *:*                  
LISTEN     0      128                               *:6000                                          *:*                  
LISTEN     0      5                     192.168.122.1:53                                            *:*                  
LISTEN     0      128                               *:22                                            *:*                  
LISTEN     0      128                       127.0.0.1:631                                           *:*                  
LISTEN     0      100                       127.0.0.1:25                                            *:*                  
LISTEN     0      128                       127.0.0.1:6010                                          *:*                  
LISTEN     0      128                       127.0.0.1:6011                                          *:*                  
LISTEN     0      128                              :::111                                          :::*                  
LISTEN     0      128                              :::80                                           :::*           //端口已监听     
LISTEN     0      128                              :::6000                                         :::*                  
LISTEN     0      128                              :::22                                           :::*                  
LISTEN     0      128                             ::1:631                                          :::*                  
LISTEN     0      100                             ::1:25                                           :::*                  
LISTEN     0      128                             ::1:6010                                         :::*                  
LISTEN     0      128                             ::1:6011                                         :::*  

用浏览器验证结果


snipaste_20200229_102841.png

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

建立需要的硬盘分区

[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): 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 (20973568-104857599, default 20973568): 
Using default value 20973568
Last sector, +sectors or +size{K,M,G} (20973568-104857599, default 104857599): +2G
Partition 2 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@centos7 ~]# 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  154G  0 part 
  ├─centos-root 253:0    0   50G  0 lvm  /
  ├─centos-swap 253:1    0    4G  0 lvm  [SWAP]
  └─centos-data 253:2    0  100G  0 lvm  /data
sdb               8:16   0   50G  0 disk 
├─sdb1            8:17   0   10G  0 part 
└─sdb2            8:18   0    2G  0 part 
sdc               8:32   0   10G  0 disk 
└─testvg-testlv 253:3    0    5G  0 lvm  /users
sr0              11:0    1 1024M  0 rom  

格式化分区

[root@centos7 ~]# mkfs.ext4 -m 1 -b 2048 -L TEST /dev/sdb2
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@centos7 ~]# mkdir /test
[root@centos7 ~]# vim /etc/fstab 
#
# /etc/fstab
# Created by anaconda on Sat Feb  8 09:35:29 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root /                       xfs     defaults        0 0
UUID=312e33d9-90ca-4022-b3ba-98be176d6aca /boot                   xfs     defaults        0 0
/dev/mapper/centos-data /data                   xfs     defaults        0 0
/dev/mapper/centos-swap swap                    swap    defaults        0 0
UUID=f52aa9ba-9dd8-4ed4-be32-6497e754711f /test ext4    acl     0 0 

[root@centos7 ~]# mount -a

验证结果

[root@centos7 ~]# df -h
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/centos-root     50G  4.8G   46G  10% /
devtmpfs                   974M     0  974M   0% /dev
tmpfs                      991M     0  991M   0% /dev/shm
tmpfs                      991M   11M  981M   2% /run
tmpfs                      991M     0  991M   0% /sys/fs/cgroup
/dev/sda1                 1014M  166M  849M  17% /boot
/dev/mapper/centos-data    100G   33M  100G   1% /data
tmpfs                      199M   12K  199M   1% /run/user/42
tmpfs                      199M     0  199M   0% /run/user/0
/dev/mapper/testvg-testlv  5.0G   33M  5.0G   1% /users
/dev/sdb2                  2.0G  9.1M  1.9G   1% /test

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

创建PV

[root@centos7 ~]# pvcreate /dev/sdc
  Physical volume "/dev/sdc" successfully created.

创建vg

[root@centos7 ~]# vgcreate -s 16 testvg /dev/{sdc,sdb1}
  Physical volume "/dev/sdb1" successfully created.
  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               hU3knR-Hmej-ok8B-mKMJ-JOmD-VP1l-uYmzEK

创建lv

[root@centos7 ~]# lvcreate -L 5G -n testlv testvg 
  Logical volume "testlv" created.
[root@centos7 ~]# lvdisplay 
  --- Logical volume ---
  LV Path                /dev/testvg/testlv
  LV Name                testlv
  VG Name                testvg
  LV UUID                lDI3p6-dy3F-vM9V-POhE-Delb-z40S-25ThmG
  LV Write Access        read/write
  LV Creation host, time centos7.6.localdomain, 2020-02-27 22:44:35 +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:3

格式化lv

[root@centos7 ~]# 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

挂载lv

[root@centos7 ~]# mkdir /users
[root@centos7 ~]# mount /dev/testvg/testlv /users
[root@centos7 ~]# df -h
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/centos-root     50G  4.8G   46G  10% /
devtmpfs                   974M     0  974M   0% /dev
tmpfs                      991M     0  991M   0% /dev/shm
tmpfs                      991M   11M  981M   2% /run
tmpfs                      991M     0  991M   0% /sys/fs/cgroup
/dev/sda1                 1014M  166M  849M  17% /boot
/dev/mapper/centos-data    100G   33M  100G   1% /data
tmpfs                      199M   12K  199M   1% /run/user/42
tmpfs                      199M     0  199M   0% /run/user/0
/dev/mapper/testvg-testlv  5.0G   33M  5.0G   1% /users

相关文章

  • 程序包安装和磁盘文件系统

    1、自建yum仓库,分别为网络源和本地源 备份原有repo文件 创建新的repo文件 验证yum源 2.安装htt...

  • Linux命令之——df

    查看文件系统磁盘空间使用情况df显示指定文件系统的可用磁盘容量,如果不指定文件系统,则会显示所有当前安装的文件系统...

  • note_8.1_Linux磁盘使用以及文件系统管理

    Linux系统管理 磁盘分区及文件系统管理 RAID LVM 网络属性管理 程序包管理 sed and awk 进...

  • FAT 文件系统 布局结构/属性 概念

    FAT 文件系统概念 首先我们知道,我们如果想使用一个磁盘进行安装系统,存储数据,首先要对该磁盘进行分区(对磁盘依...

  • 3 Linux 磁盘与文件系统管理

    1 认识 Linux 文件系统 Linux 最传统的磁盘文件系统使用的是 ext2 1.1 磁盘组成与分区 磁盘组...

  • 2019-10-19

    Mac 上“磁盘工具”中可用的文件系统格式Mac 上的“磁盘工具”支持多种文件系统格式:Apple 文件系统 (A...

  • 2018-05-21 课堂笔记

    目录1. 认识磁盘2. 认识文件系统(filesystem,fs)3. 查看文件系统4. 磁盘分区5. 磁盘格式化...

  • HDFS与LINUX文件系统的区别

    每个磁盘都有默认的数据块大小,这是磁盘进行数据读/写的最小单位。而构建于单个磁盘之上的文件系统(linux文件系统...

  • linux下的磁盘操作2【磁盘格式】

    磁盘的使用离不开文件的读写,对于磁盘的使用,首先要对磁盘装入文件系统,目前,linux比较流行的文件系统有 ext...

  • Linux系统排查3——I/O篇

    当磁盘无法写入的时候,一般有以下可能: 文件系统只读 磁盘已满 I节点使用完 一、 遇到只读的文件系统文件系统自动...

网友评论

      本文标题:程序包安装和磁盘文件系统

      本文链接:https://www.haomeiwen.com/subject/zajuhhtx.html