1、自建yum仓库,分别为网络源和本地源
[root@srehost conf]#
[root@srehost conf]#yum repolist
repo id repo name
media-appstream CentOS Linux 8 - Media - AppStream
media-baseos CentOS Linux 8 - Media - BaseOS
[root@srehost conf]#cat /etc/yum.repos.d/*.repo
# CentOS-Linux-Media.repo
#
# You can use this repo to install items directly off the installation media.
# Verify your mount point matches one of the below file:// paths.
[media-baseos]
name=CentOS Linux $releasever - Media - BaseOS
baseurl=file:///mnt/cdrom/BaseOS
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[media-appstream]
name=CentOS Linux $releasever - Media - AppStream
baseurl=file:///mnt/cdrom/AppStream
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
STEP1 yum检查系统自带版本号,因为老王课上说CENTOS8的版本较新,所以拿CENTOS8做实验
[root@srehost conf]#yum provides httpd
Last metadata expiration check: 3:57:54 ago on Fri 22 Dec 2023 07:26:07 AM CST.
httpd-2.4.37-41.module_el8.5.0+977+5653bbea.x86_64 : Apache HTTP Server
Repo : @System
Matched from:
Provide : httpd = 2.4.37-41.module_el8.5.0+977+5653bbea
httpd-2.4.37-41.module_el8.5.0+977+5653bbea.x86_64 : Apache HTTP Server
Repo : media-appstream
Matched from:
Provide : httpd = 2.4.37-41.module_el8.5.0+977+5653bbea
STEP2 安装HTTP服务
yum -y install httpd
STEP3 将相关用户组信息检查并修改,因为apache用户和组都在/etc/passwd里面
因此,需要将两个信息更改
[root@srehost conf]#usermod -u 88 apache
[root@srehost conf]#groupmod -g 88 apache
[root@srehost conf]#
[root@srehost conf]#
[root@srehost conf]#
[root@srehost conf]#cat /etc/passwd | grep -E '^apache'
apache:x:88:88:Apache:/usr/share/httpd:/sbin/nologin
STEP4 更新配置文件,将80端口改为8088
[root@srehost conf]#cat httpd.conf |grep 8088
Listen 8088
STEP5 启动服务,检查端口是否在运行
[root@srehost conf]#systemctl start httpd.service
[root@srehost conf]#netstat -napl | grep 8088
tcp6 0 0 :::8088 :::* LISTEN 10036/httpd
[root@srehost conf]#
3、利用sed 取出ifconfig命令中本机的IPv4地址
[root@srehost ~]#ifconfig ens33 |sed -r -n '/^.*inet ([0-9]+\.){3}([0-9]+)/s#^ +inet ([0-9]+\.)([0-9]+\.)([0-9]+\.)([0-9]+) +netmask ([0-9]+\.)([0-9]+\.)([0-9]+\.)([0-9]+) +broadcast ([0-9]+\.)([0-9]+\.)([0-9]+\.)([0-9]+)#\1\2\3\4 #p'
192.168.81.11
4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
[root@srehost ~]#cat /etc/fstab | sed -r 's@^#([ \f\n\r\t\v]*)@\1@p'
/etc/fstab
/etc/fstab
Created by anaconda on Sun Dec 3 11:04:13 2023
Created by anaconda on Sun Dec 3 11:04:13 2023
Accessible filesystems, by reference, are maintained under '/dev/disk/'.
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.
See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
After editing this file, run 'systemctl daemon-reload' to update systemd
After editing this file, run 'systemctl daemon-reload' to update systemd
units generated from this file.
units generated from this file.
/dev/mapper/cl-root / xfs defaults 0 0
UUID=5d3101f3-0a86-44c9-9dae-6bcd01971ed4 /boot xfs defaults 0 0
/dev/mapper/cl-home /home xfs defaults 0 0
/dev/mapper/cl-swap none swap defaults 0 0
5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
[root@srehost ~]#echo /etc/fstab | sed -r "s@(^\/.*\/)(.*)@\1@p"
/etc/
/etc/
[root@srehost ~]#echo /etc/fstab | sed -r -n "s@(^\/.*\/)(.*)@\1@p"
/etc/
[root@srehost ~]#echo /etc/fstab | sed -r -n "s@(^\/.*\/)(.*)@\2@p"
fstab
[root@srehost ~]#echo /etc/httpd/conf/httpd.conf | sed -r -n "s@(^\/.*\/)(.*)@\2@p"
httpd.conf
[root@srehost ~]#echo /etc/httpd/conf/httpd.conf | sed -r -n "s@(^\/.*\/)(.*)@\1@p"
/etc/httpd/conf/
6、列出ubuntu软件管理工具apt的一些用法(自由总结)
标签:httpd,work4,fstab,etc,conf,root,srehost From: https://www.cnblogs.com/kingkim/p/17924261.html