自建yum仓库

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

本地源:

[root@centos7 ~]# mount /dev/sr0 /mnt/cdrom
[root@centos7 ~]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
devtmpfs          915508       0    915508   0% /dev
tmpfs             931516       0    931516   0% /dev/shm
tmpfs             931516   10704    920812   2% /run
tmpfs             931516       0    931516   0% /sys/fs/cgroup
/dev/sda2      104806400 4079204 100727196   4% /
/dev/sda3       52403200   32992  52370208   1% /data
/dev/sda1         999320  154040    776468  17% /boot
tmpfs             186304      48    186256   1% /run/user/0
/dev/sr0         3339780 3339780         0 100% /mnt/cdrom
[root@centos7 ~]# vim /etc/yum.repos.d/centOS-local.repo
[CentOS7]
name=local repo
baseurl=file:///mnt
enabled=1
gpgcheck = 0

网络源:

[root@centos7 ~]# vim /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
baseurl=file:///misc/cd
        https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
        https://mirrors.huaweicloud.com/centos/$releasever/os/x86_64/os/
        https://mirrors.cloud.tencent.com/centos/$releasever/os/$basearch/
        https://mirrors.aliyun.com/centos/$releasever/os/$basearch/
gpgcheck=0

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

把下载好的httpd-2.4.43.tar.bz2解压到/usr/local/src
[root@centos8 src]# ls
httpd-2.4.43
[root@centos8 ~]#dnf install gcc make autoconf apr-devel apr-util-devel pcredevel openssl-devel redhat-rpm-config
[root@centos8 httpd-2.4.43]# ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl
[root@centos8 httpd-2.4.43]# make -j 2
[root@centos8 httpd-2.4.43]# make install
[root@centos8 httpd-2.4.43]# echo ‘PATH=/apps/httpd/bin/:$PATH‘ > /etc/profile.d/httpd.sh
[root@centos8 httpd-2.4.43]# ./etc/profile.d/httpd.sh
[root@centos8 httpd-2.4.43]# apachectl start

网站确认:
自建yum仓库

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

[root@centos8 ~]# ifconfig ens33 | sed -nr ‘2s/[^0-9]+([0-9.]+).*/\1/p‘
10.0.0.153

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

[root@centos8 ~]# sed -ri.bak ‘/^#/s/^#//‘ /etc/fstab
[root@centos8 ~]# cat /etc/fstab

 /etc/fstab
 Created by anaconda on Sat Jul 10 17:14:21 2021

 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=e7af5300-665e-4884-bf70-9134e196ad07 /                       xfs     defaults        0 0
UUID=666813b4-3a04-4b42-995c-e696377e3150 /boot                   xfs     defaults        0 0
UUID=c79a2ee8-102b-40ee-ac39-10a06679a58b /data                   xfs     defaults        0 0
UUID=4bcf47aa-154b-41be-a2a7-89ab5962d348 none                    swap    defaults        0 0

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

目录名:

[root@centos8 ~]# echo /etc/fstab | sed -nr ‘s@^(.*)/([^/]+)/?$@\1@p‘
/etc

基名:

[root@centos8 ~]# echo /etc/fstab | sed -nr ‘s@^(.*)/([^/]+)/?$@\2@p‘
fstab

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

list:根据包名列出包
search:在包描述中搜索
show:显示包的详细信息
Install:安装软件包
Remove:删除软件包
autoremove:自动删除所有未使用的包
update:可用包的更新列表
upgrade:通过安装/升级包来升级系统
full-upgrade:通过移除/安装/升级包来升级系统
edit-sources:编辑源信息文件

上一篇:进程和计划任务管理


下一篇:__new__ 和 __init__ 的区别