创建一个3g大小的分区
[root@rhcsa /]# fdisk /dev/nvme0n1
命令(输入 m 获取帮助):n
分区类型
p 主分区 (2 primary, 0 extended, 2 free)
e 扩展分区 (逻辑分区容器)
选择 (默认 p):
将使用默认回应 p。
分区号 (3,4, 默认 3):
第一个扇区 (68356096-83886079, 默认 68356096):
最后一个扇区,+/-sectors 或 +size{K,M,G,T,P} (68356096-83886079, 默认 83886079): +3g
创建了一个新分区 3,类型为“Linux”,大小为 3 GiB。
命令(输入 m 获取帮助):wq
分区表已调整。
正在同步磁盘。
格式化为xfs的文件系统类型
[root@rhcsa /]# mkfs.xfs /dev/nvme0n1p3
meta-data=/dev/nvme0n1p3 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
将磁盘分区挂载至挂载点 /abc
1.创建/abc目录
[root@rhcsa ~]# mkdir /abc
2.将磁盘分区挂载至挂载点
[root@rhcsa /]# mount /dev/nvme0n1p3 /abc
3.查看挂载信息,用mount命令直接查看,通过管道符用grep搜索关键字;或者用df命令
[root@rhcsa /]# mount |grep abc
/dev/nvme0n1p3 on /abc type xfs (rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
[root@rhcsa /]# df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 872M 0 872M 0% /dev/shm
tmpfs 349M 9.7M 340M 3% /run
/dev/mapper/rhel-root 30G 5.5G 25G 19% /
/dev/nvme0n1p1 595M 280M 315M 48% /boot
tmpfs 175M 52K 175M 1% /run/user/42
tmpfs 175M 36K 175M 1% /run/user/0
/dev/sr0 8.5G 8.5G 0 100% /guangpan
/dev/nvme0n1p3 3.0G 54M 3.0G 2% /abc
将/etc/passwd文件复制到该分区
[root@rhcsa /]# cp -r /etc/passwd /abc
[root@rhcsa /]# ll /abc/
总用量 4
-rw-r--r--. 1 root root 2304 6月 1 16:48 passwd
yum配置仓库,再/etc/yum.repos.d创建一个rhel.repo文件并配置仓库
[appstream]
name=appstream
baseurl=file:///guangpan/AppStream/
gpgcheck=0
#gpgcheck=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[base]
name=base
baseurl=file:///guangpan/BaseOS
gpgcheck=0
#gpgcheck=1
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
配置好仓库后,查看当前启用的仓库
[root@rhcsa yum.repos.d]# yum repolist
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
仓库 id 仓库名称
appstream appstream
base base
安装httpd
[root@rhcsa yum.repos.d]# yum install httpd -y
正在更新 Subscription Management 软件仓库。
无法读取客户身份
本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。
上次元数据过期检查:0:09:02 前,执行于 2023年06月01日 星期四 15时08分18秒。
依赖关系解决。
===============================================================================================================================================================
软件包 架构 版本 仓库 大小
===============================================================================================================================================================
安装:
httpd x86_64 2.4.53-7.el9 appstream 54 k
安装依赖关系:
apr x86_64 1.7.0-11.el9 appstream 127 k
apr-util x86_64 1.6.1-20.el9 appstream 98 k
apr-util-bdb x86_64 1.6.1-20.el9 appstream 15 k
httpd-core x86_64 2.4.53-7.el9 appstream 1.5 M
httpd-filesystem noarch 2.4.53-7.el9 appstream 18 k
httpd-tools x86_64 2.4.53-7.el9 appstream 89 k
redhat-logos-httpd noarch 90.4-1.el9 appstream 18 k
安装弱的依赖:
apr-util-openssl x86_64 1.6.1-20.el9 appstream 17 k
mod_http2 x86_64 1.15.19-2.el9 appstream 153 k
mod_lua x86_64 2.4.53-7.el9 appstream 64 k
事务概要
===============================================================================================================================================================
安装 11 软件包
总计:2.1 M
安装大小:5.9 M
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
准备中 : 1/1
安装 : apr-1.7.0-11.el9.x86_64 1/11
安装 : apr-util-bdb-1.6.1-20.el9.x86_64 2/11
安装 : apr-util-openssl-1.6.1-20.el9.x86_64 3/11
安装 : apr-util-1.6.1-20.el9.x86_64 4/11
安装 : httpd-tools-2.4.53-7.el9.x86_64 5/11
安装 : redhat-logos-httpd-90.4-1.el9.noarch 6/11
运行脚本: httpd-filesystem-2.4.53-7.el9.noarch 7/11
安装 : httpd-filesystem-2.4.53-7.el9.noarch 7/11
安装 : httpd-core-2.4.53-7.el9.x86_64 8/11
安装 : mod_http2-1.15.19-2.el9.x86_64 9/11
安装 : mod_lua-2.4.53-7.el9.x86_64 10/11
安装 : httpd-2.4.53-7.el9.x86_64 11/11
运行脚本: httpd-2.4.53-7.el9.x86_64 11/11
验证 : apr-1.7.0-11.el9.x86_64 1/11
验证 : apr-util-1.6.1-20.el9.x86_64 2/11
验证 : apr-util-bdb-1.6.1-20.el9.x86_64 3/11
验证 : apr-util-openssl-1.6.1-20.el9.x86_64 4/11
验证 : httpd-2.4.53-7.el9.x86_64 5/11
验证 : httpd-core-2.4.53-7.el9.x86_64 6/11
验证 : httpd-filesystem-2.4.53-7.el9.noarch 7/11
验证 : httpd-tools-2.4.53-7.el9.x86_64 8/11
验证 : mod_http2-1.15.19-2.el9.x86_64 9/11
验证 : mod_lua-2.4.53-7.el9.x86_64 10/11
验证 : redhat-logos-httpd-90.4-1.el9.noarch 11/11
已更新安装的产品。
已安装:
apr-1.7.0-11.el9.x86_64 apr-util-1.6.1-20.el9.x86_64 apr-util-bdb-1.6.1-20.el9.x86_64 apr-util-openssl-1.6.1-20.el9.x86_64
httpd-2.4.53-7.el9.x86_64 httpd-core-2.4.53-7.el9.x86_64 httpd-filesystem-2.4.53-7.el9.noarch httpd-tools-2.4.53-7.el9.x86_64
mod_http2-1.15.19-2.el9.x86_64 mod_lua-2.4.53-7.el9.x86_64 redhat-logos-httpd-90.4-1.el9.noarch
完毕!
启动http服务
[root@rhcsa /]# systemctl start httpd
设置httpd服务的开机自启动
[root@rhcsa /]# systemctl enable --now httpd
查看httpd服务的运行情况
[root@rhcsa /]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2023-06-01 15:23:57 CST; 2min 18s ago
Docs: man:httpd.service(8)
Main PID: 2736 (httpd)
Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec: 0 B/sec"
Tasks: 213 (limit: 10754)
Memory: 31.3M
CPU: 187ms
CGroup: /system.slice/httpd.service
├─2736 /usr/sbin/httpd -DFOREGROUND
├─2737 /usr/sbin/httpd -DFOREGROUND
├─2738 /usr/sbin/httpd -DFOREGROUND
├─2739 /usr/sbin/httpd -DFOREGROUND
└─2740 /usr/sbin/httpd -DFOREGROUND
6月 01 15:23:56 rhcsa systemd[1]: Starting The Apache HTTP Server...
6月 01 15:23:56 rhcsa httpd[2736]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:febb:89d2%ens16>
6月 01 15:23:57 rhcsa httpd[2736]: Server configured, listening on: port 80
6月 01 15:23:57 rhcsa systemd[1]: Started The Apache HTTP Server.
关闭防火墙服务
[root@rhcsa /]# systemctl stop firewalld.service
查看防火墙服务的运行情况
[root@rhcsa /]# systemctl status firewalld.service
○ firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Thu 2023-06-01 15:28:27 CST; 22s ago
Duration: 48min 33.513s
Docs: man:firewalld(1)
Process: 976 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 976 (code=exited, status=0/SUCCESS)
CPU: 419ms
6月 01 14:39:53 rhcsa systemd[1]: Starting firewalld - dynamic firewall daemon...
6月 01 14:39:54 rhcsa systemd[1]: Started firewalld - dynamic firewall daemon.
6月 01 15:28:27 rhcsa systemd[1]: Stopping firewalld - dynamic firewall daemon...
6月 01 15:28:27 rhcsa systemd[1]: firewalld.service: Deactivated successfully.
6月 01 15:28:27 rhcsa systemd[1]: Stopped firewalld - dynamic firewall daemon.