1、自建yum仓库,分别为网络源和本地源
网络源
[root@sakura:]~ # mkdir bak;mv *.repo /etc/yum.repos.d/bak
[root@sakura:]~ # ls /etc/yum.repos.d/
bak base.repo
[root@sakura:]~ # cat /etc/yum.repos.d/base.repo
[BaseOS]
name=BaseOS
baseurl=https://mirrors.cloud.tencent.com/centos/$releasever/BaseOS/x86_64/os/
https://mirrors.aliyun.com/centos/$releasever/BaseOS/x86_64/os/
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/BaseOS/x86_64/os/
# file:///misc/cd/BaseOS
gpgcheck=0
[AppStream]
name=AppStream
baseurl=https://mirrors.cloud.tencent.com/centos/$releasever/AppStream/x86_64/os/
https://mirrors.aliyun.com/centos/$releasever/AppStream/x86_64/os/
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/AppStream/x86_64/os/
# file:///misc/cd/AppStream
gpgcheck=0
[epel]
name=EPEL
baseurl=https://mirrors.cloud.tencent.com/epel/$releasever/Everything/x86_64
https://mirrors.aliyun.com/epel/$releasever/Everything/x86_64
https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/Everything/x86_64
gpgcheck=0
enabled=1
[extras]
name=extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/x86_64/os
https://mirrors.cloud.tencent.com/centos/$releasever/extras/$basearch/os
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/os
gpgcheck=0
enabled=1
本地源
检查光盘是否连接到虚机
[root@sakura:]/ # rpm -q autofs || yum -y install autofs
[root@sakura:]/ # systemctl enable --now autofs
[root@sakura:]~ # ls /etc/yum.repos.d/
bak base.repo
[root@sakura:]~ # cat /etc/yum.repos.d/base.repo
[BaseOS]
name=BaseOS
baseurl=file:///misc/cd/BaseOS
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///misc/cd/AppStream
gpgcheck=0
[epel]
name=EPEL
baseurl=http://mirrors.aliyun.com/epel/$releasever/Everything/$basearch
gpgcheck=0
enabled=1
[extras]
name=extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os
gpgcheck=0
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
# 关闭防火墙
[root@sakura:~] # systemctl disable --now firewalld
# 下载必要组件
[root@sakura:~] # dnf -y install gcc make autoconf apr-devel apr-util-devel pcre-devel openssl-devel redhat-rpm-config bzip2 wget
# 下载httpd2.4.52安装包
[root@sakura:~] # wget https://dlcdn.apache.org//httpd/httpd-2.4.52.tar.bz2
# 解压至/usr/local/src
[root@sakura:~] # tar xvf httpd-2.4.52.tar.bz2 -C /usr/local/src
#写配置文件
[root@sakura:~] # cd /usr/local/src/httpd-2.4.52
[root@sakura:/usr/local/src/httpd-2.4.52] # ./configure --prefix=/app/httped --sysconfdir=/etc/httped --enable-ssl
# 查看CPU
[root@sakura:/usr/local/src/httpd-2.4.52] # lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
# 编译安装
[root@sakura:/usr/local/src/httpd-2.4.52] # make -j 4 && make install
# 创建用户和组
[root@sakura:/usr/local/src/httpd-2.4.52] # groupadd -r -g 88 apache
[root@sakura:/usr/local/src/httpd-2.4.52] # useradd -r -u 88 -g apache -s /sbin/nologin -d /var/www/ apache
# 运行httpd服务
[root@sakura:/usr/local/src/httpd-2.4.52] # /app/httped/bin/apachectl start
在浏览器输入地址并检查
3、利用sed 取出ifconfig命令中本机的IPv4地址
[root@sakura:]~ # ifconfig ens160 |sed -nr "2s/[^0-9]+([0-9.]+).*/\1/p"
10.0.0.5
4、删除/etc/fstab文件中所有跟一个空白字以#开头,后面至少符的行的行首的#和空白字符
[root@sakura:]~ sed -r "s/^#[[:space:]]*//" /etc/fstab
/etc/fstab
Created by anaconda on Tue Jan 18 10:47:42 2022
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.
After editing this file, run 'systemctl daemon-reload' to update systemd
units generated from this file.
UUID=d52f807e-44fb-409d-b56c-8757f6c509e7 / ext4 defaults 1 1
UUID=1926a965-9c76-4fee-8b08-cfeb55a9afa5 /boot ext4 defaults 1 2
UUID=4e4c393d-e275-4b38-b105-2b165904802f /data ext4 defaults 1 2
UUID=b5fcaf1d-b246-40ea-876e-408132e1622b none swap defaults 0 0
5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
#取目录名
[root@sakura:]~ # echo /etc/fstab | sed -rn 's/^(.*)\/([^/]+)/\1/p'
/etc
# 取基名
[root@sakura:]~ # echo /etc/fstab | sed -r "s/(^\/[[:alpha:]]*\/)//"
fstab
6、列出ubuntu软件管理工具apt的一些用法(自由总结)
# 安装软件包
apt install
# 移除软件包
apt remove
# 列出包含条件的包(已安装,可升级等)
apt list
# 移除软件包及配置文件
apt purge
# 刷新存储库索引
apt update
# 升级所有可升级的软件包
apt upgrade
# 自动删除不需要的软件包
apt autoremove
# 在升级软件包时自动处理依赖关系
apt full-upgrade
# 显示安装细节
apt show
# 编辑source源⽂件
apt edit-sources