文本处理和编译安装

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

root@CentOS8 ~]\ [#vim /etc/yum.repos.d/base.repo
[BaseOS]
name=BaseOS
baseurl=file:///mnt/cdrom/BaseOS
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/BaseOS/$basearch/os
https://mirrors.huaweicloud.com/centos/$releasever/BaseOS/$basearch/os
https://mirrors.cloud.tencent.com/centos/$releasever/BaseOS/$basearch/os
gpgcheck=0

[AppStream]
name=AppStream
baseurl=file:///mnt/cdrom/AppStream
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/AppStream/$basearch/os
https://mirrors.huaweicloud.com/centos/$releasever/AppStream/$basearch/os
https://mirrors.cloud.tencent.com/centos/$releasever/Appstream/$basearch/os
gpgcheck=0

[epel]
name=EPEL
baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/Everything/$basearch/
https://mirrors.huaweicloud.com/epel/$releasever/Everything/$basearch/
https://mirrors.cloud.tencent.com/epel/$releasever/Everything/$basearch/
gpgcheck=0
enabled=1

[extras]
name=extras
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/os
https://mirrors.huaweicloud.com/centos/$releasever/extras/$basearch/os
https://mirrors.cloud.tencent.com/centos/$releasever/extras/$basearch/os
gpgcheck=0
enabled=1

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

dnf install gcc make autoconf apr-devel apr-util-devel pcre-devel openssl-devel redhat-rpm-config(下载安装相关包)
rz -E (官网下载后拖入)
tar xvf httpd-2.4.46.tar.bz2 -c /usr/local/src (解压缩到指定目录)
cd /usr/local/src/httpd-2.4.46/ (进入该目录)
./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl(编译安装第一步)
make -j 4 && make install (编译安装第二步和第三步)
echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/httpd.sh(配置环境)
cd
. /etc/profile.d/httpd.sh
apachectl start (运行)
useradd -r -s /sbin/nologin -d /var/www -c Apache -u 48 apache(指定用户运行)
vim /etc/httpd/httpd.conf (修改user和group)
apachectl restart(重启服务生效)
ps aux(查看进程)
history

3、利用sed 取出ifconfig命令中本机的IPv4地址

[16:17:36 root@CentOS8 ~]\ [#ifconfig ens33 | sed -nr '2s/[^0-9]+([0-9.]+).*/\1/p'
10.0.0.8

4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符

[16:36:55 root@CentOS8 ~]\ [#cat /cat /etc/fstab |sed -r 's/^#[[:space:]]+(.*$)/\1/p'
#
/etc/fstab
/etc/fstab
Created by anaconda on Fri Jun 18 06:20:46 2021
Created by anaconda on Fri Jun 18 06:20:46 2021
#
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.
#
UUID=5cb25e0d-f840-4151-b233-a8693daef222 / xfs defaults 0 0
UUID=79b9811d-7519-4dd3-806b-073da9920fbd /boot ext4 defaults 1 2
UUID=09a49cd2-58b8-4f86-ab2d-db9a55cc4026 /data xfs defaults 0 0
UUID=7937620b-091b-4cbb-9df9-ceb3dc512d6c none swap defaults 0 0

5、处理/etc/fstab路径,使用sed命令取出其目录名和基名

<!--目录名-->

[16:27:53 root@CentOS8 ~]\ [#echo /etc/fstab |sed -rn 's#(.*)/([^/]+)/?#\1#p'
/etc

<!--基名-->

[16:29:58 root@CentOS8 ~]\ [#echo /etc/fstab |sed -rn 's#(.*)/([^/]+)/?#\2#p'
fstab

6、列出ubuntu软件管理工具apt的一些用法(*总结)

apt install 安装软件包
apt remove 移除软件包
apt purge 移除软件包及配置文件
apt update 刷新存储库索引
apt upgrade 升级所有可升级的软件包
apt autoremove 自动删除不需要的包
apt full-upgrade 在升级软件包时自动处理依赖关系
apt search 搜索应用程序
apt show 显示安装细节
apt list 列出包含条件的包

上一篇:Anaconda下安装Graphviz


下一篇:纯Java实现的graphviz