1、创建一个3G大小的分区,并格式化为xfs的文件系统类型,将/etc/passwd文件复制到该分区
先查看自己的磁盘,能否分3G,如果当前磁盘空间已使用完,则添加新磁盘
创建分区
[root@rhcsa0801 ~]# fdisk /dev/sda
命令(输入 m 获取帮助):n
所有主分区都在使用中。
添加逻辑分区 6
第一个扇区 (18880512-31457279, 默认 18880512):
最后一个扇区,+/-sectors 或 +size{K,M,G,T,P} (18880512-31457279, 默认 31457279): +3G
创建了一个新分区 6,类型为“Linux”,大小为 3 GiB。
命令(输入 m 获取帮助):p
Disk /dev/sda:15 GiB,16106127360 字节,31457280 个扇区
磁盘型号:VMware Virtual S
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x7b1f7deb
设备 启动 起点 末尾 扇区 大小 Id 类型
/dev/sda1 2048 4196351 4194304 2G 83 Linux
/dev/sda2 4196352 8390655 4194304 2G 83 Linux
/dev/sda3 8390656 12584959 4194304 2G 83 Linux
/dev/sda4 12584960 31457279 18872320 9G 5 扩展
/dev/sda5 12587008 18878463 6291456 3G 83 Linux
/dev/sda6 18880512 25171967 6291456 3G 83 Linux
格式化为xfs
[root@rhcsa0801 ~]# mkfs.xfs /dev/sda6
meta-data=/dev/sda6 isize=512 agcount=4, agsize=196608 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1 bigtime=1 inobtcount=1
data = bsize=4096 blocks=786432, 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@rhcsa0801 ~]#
挂载
[root@rhcsa0801 ~]# mkdir -pv /guazai6
mkdir: 已创建目录 '/guazai6'
[root@rhcsa0801 ~]#
[root@rhcsa0801 ~]# mount /dev/sda6 /guazai6
[root@rhcsa0801 ~]# mount | grep guazai
/dev/sda1 on /guazai1 type ext3 (rw,relatime,seclabel)
/dev/sda6 on /guazai6 type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
[root@rhcsa0801 ~]# cp /etc/passwd /guazai6
[root@rhcsa0801 ~]# ll /guazai6
总用量 4
-rw-r--r--. 1 root root 2290 8月 9 17:35 passwd
开机自动挂载
[root@rhcsa0801 ~]# blkid
/dev/nvme0n1p3: UUID="f85c0534-5d35-4a57-8098-6cda7f07b236" TYPE="xfs" PARTUUID="3447041b-03"
/dev/nvme0n1p1: UUID="aea4d3be-7db0-46f1-a142-2d25d92ec066" TYPE="xfs" PARTUUID="3447041b-01"
/dev/nvme0n1p2: UUID="6f87b2be-8131-4893-b3ff-bc3bd9c293fc" TYPE="swap" PARTUUID="3447041b-02"
/dev/sdb2: PARTUUID="21a458c8-b25e-d64e-9751-55a82be6e150"
/dev/sdb1: PARTUUID="802a4a45-62bd-9a41-81e5-21e8885b3d73"
/dev/sr0: UUID="2023-04-13-16-58-02-00" LABEL="RHEL-9-2-0-BaseOS-x86_64" TYPE="iso9660" PTUUID="d3d1f9a5" PTTYPE="dos"
/dev/nvme0n2p3: PARTUUID="48b7ba7f-03"
/dev/nvme0n2p1: PARTUUID="48b7ba7f-01"
/dev/nvme0n2p4: PARTUUID="48b7ba7f-04"
/dev/nvme0n2p2: PARTUUID="48b7ba7f-02"
/dev/sda2: UUID="4449e18a-ae00-4481-b669-f4fb737c802f" TYPE="ext4" PARTUUID="7b1f7deb-02"
/dev/sda5: UUID="0e55157d-14aa-4ecf-9251-031e5d11a697" TYPE="xfs" PARTUUID="7b1f7deb-05"
/dev/sda3: UUID="a18a3529-2aac-49cb-9557-6447b32c4ecb" TYPE="xfs" PARTUUID="7b1f7deb-03"
/dev/sda1: UUID="fe390874-82ae-491c-97e7-3f87f5b55ced" TYPE="ext3" PARTUUID="7b1f7deb-01"
/dev/sda6: UUID="f9bd8d1f-56e7-4a7f-a93e-0d80e9d63602" TYPE="xfs" PARTUUID="7b1f7deb-06"
[root@rhcsa0801 ~]# vim /etc/fstab
UUID=f9bd8d1f-56e7-4a7f-a93e-0d80e9d63602 /guazai6 xfs defaults
0 0
[root@rhcsa0801 ~]# reboot
[root@rhcsa0801 ~]# mount -a
mount: /etc/fstab:第 17 行解析出错 -- 已忽略
[root@rhcsa0801 ~]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 876M 0 876M 0% /dev/shm
tmpfs 351M 5.8M 345M 2% /run
/dev/nvme0n1p3 15G 4.1G 11G 28% /
/dev/sda6 3.0G 54M 3.0G 2% /guazai6
/dev/nvme0n1p1 495M 276M 220M 56% /boot
/dev/sda1 2.0G 96K 1.9G 1% /guazai1
tmpfs 176M 52K 176M 1% /run/user/42
tmpfs 176M 36K 176M 1% /run/user/0
2.安装httpd软件包,并让该程序开机自启动,关闭防火墙服务
[root@localhost ~]# ll /etc/yum.repos.d/
[root@localhost ~]# vim /etc/yum.repos.d/wangluo.repo
[root@localhost ~]# cat /etc/yum.repos.d/wangluo.repo
[wangluo-app]
name=wanluo-app
baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/AppStream/x86_64/os/
gpgcheck=0
[wangluo-base]
name=wangluo-base
baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/x86_64/os/
gpgcheck=0
[root@localhost ~]# yum install httpd -y ----装包
[root@localhost ~]# systemctl enable --now httpd ---开启HTTPD服务
[root@localhost ~]# systemctl disable --now firewalld---关闭防火墙
[root@localhost ~]# ll /etc/yum.repos.d/
[root@localhost ~]# vim /etc/yum.repos.d/wangluo.repo
[root@localhost ~]#
[root@localhost ~]# yum install httpd -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
wanluo-app 11 MB/s | 18 MB 00:01
wangluo-base 5.4 MB/s | 7.8 MB 00:01
依赖关系解决。
==============================================================================================================================================================
软件包 架构 版本 仓库 大小
==============================================================================================================================================================
安装:
httpd x86_64 2.4.57-5.el9 wangluo-app 47 k
安装依赖关系:
apr x86_64 1.7.0-11.el9 wangluo-app 123 k
apr-util x86_64 1.6.1-23.el9 wangluo-app 95 k
apr-util-bdb x86_64 1.6.1-23.el9 wangluo-app 13 k
centos-logos-httpd noarch 90.4-1.el9 wangluo-app 252 k
httpd-core x86_64 2.4.57-5.el9 wangluo-app 1.4 M
httpd-filesystem noarch 2.4.57-5.el9 wangluo-app 14 k
httpd-tools x86_64 2.4.57-5.el9 wangluo-app 81 k
安装弱的依赖:
apr-util-openssl x86_64 1.6.1-23.el9 wangluo-app 15 k
mod_http2 x86_64 1.15.19-4.el9 wangluo-app 149 k
mod_lua x86_64 2.4.57-5.el9 wangluo-app 61 k
事务概要
==============================================================================================================================================================
安装 11 软件包
总下载:2.2 M
安装大小:6.4 M
下载软件包:
(1/11): apr-util-bdb-1.6.1-23.el9.x86_64.rpm 36 kB/s | 13 kB 00:00
(2/11): apr-1.7.0-11.el9.x86_64.rpm 294 kB/s | 123 kB 00:00
(3/11): apr-util-1.6.1-23.el9.x86_64.rpm 206 kB/s | 95 kB 00:00
(4/11): apr-util-openssl-1.6.1-23.el9.x86_64.rpm 79 kB/s | 15 kB 00:00
(5/11): centos-logos-httpd-90.4-1.el9.noarch.rpm 470 kB/s | 252 kB 00:00
(6/11): httpd-2.4.57-5.el9.x86_64.rpm 90 kB/s | 47 kB 00:00
(7/11): httpd-core-2.4.57-5.el9.x86_64.rpm 3.2 MB/s | 1.4 MB 00:00
(8/11): httpd-filesystem-2.4.57-5.el9.noarch.rpm 131 kB/s | 14 kB 00:00
(9/11): httpd-tools-2.4.57-5.el9.x86_64.rpm 696 kB/s | 81 kB 00:00
(10/11): mod_http2-1.15.19-4.el9.x86_64.rpm 876 kB/s | 149 kB 00:00
(11/11): mod_lua-2.4.57-5.el9.x86_64.rpm 360 kB/s | 61 kB 00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 1.8 MB/s | 2.2 MB 00:01
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
准备中 : 1/1
安装 : apr-1.7.0-11.el9.x86_64 1/11
安装 : apr-util-bdb-1.6.1-23.el9.x86_64 2/11
安装 : apr-util-openssl-1.6.1-23.el9.x86_64 3/11
安装 : apr-util-1.6.1-23.el9.x86_64 4/11
安装 : httpd-tools-2.4.57-5.el9.x86_64 5/11
运行脚本: httpd-filesystem-2.4.57-5.el9.noarch 6/11
安装 : httpd-filesystem-2.4.57-5.el9.noarch 6/11
安装 : httpd-core-2.4.57-5.el9.x86_64 7/11
安装 : mod_lua-2.4.57-5.el9.x86_64 8/11
安装 : centos-logos-httpd-90.4-1.el9.noarch 9/11
安装 : mod_http2-1.15.19-4.el9.x86_64 10/11
安装 : httpd-2.4.57-5.el9.x86_64 11/11
运行脚本: httpd-2.4.57-5.el9.x86_64 11/11
验证 : apr-1.7.0-11.el9.x86_64 1/11
验证 : apr-util-1.6.1-23.el9.x86_64 2/11
验证 : apr-util-bdb-1.6.1-23.el9.x86_64 3/11
验证 : apr-util-openssl-1.6.1-23.el9.x86_64 4/11
验证 : centos-logos-httpd-90.4-1.el9.noarch 5/11
验证 : httpd-2.4.57-5.el9.x86_64 6/11
验证 : httpd-core-2.4.57-5.el9.x86_64 7/11
验证 : httpd-filesystem-2.4.57-5.el9.noarch 8/11
验证 : httpd-tools-2.4.57-5.el9.x86_64 9/11
验证 : mod_http2-1.15.19-4.el9.x86_64 10/11
验证 : mod_lua-2.4.57-5.el9.x86_64 11/11
已更新安装的产品。
已安装:
apr-1.7.0-11.el9.x86_64 apr-util-1.6.1-23.el9.x86_64 apr-util-bdb-1.6.1-23.el9.x86_64 apr-util-openssl-1.6.1-23.el9.x86_64
centos-logos-httpd-90.4-1.el9.noarch httpd-2.4.57-5.el9.x86_64 httpd-core-2.4.57-5.el9.x86_64 httpd-filesystem-2.4.57-5.el9.noarch
httpd-tools-2.4.57-5.el9.x86_64 mod_http2-1.15.19-4.el9.x86_64 mod_lua-2.4.57-5.el9.x86_64
完毕!
[root@localhost ~]# systemctl enable --now httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
[root@localhost ~]# systemctl disable --now firewalld
Removed "/etc/systemd/system/multi-user.target.wants/firewalld.service".
Removed "/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service".
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#