1、自建yum仓库,分别为网络源和本地源
本地源
#已将repo移动到备份文件夹了,/etc/yum.repos.d/为空
[root@centos7 data]#ls backupRepo/
CentOS-base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo CentOS-x86_64-kernel.repo docker-ce.repo
[root@centos7 data]#ls /etc/yum.repos.d/
[root@centos7 data]#
#repolist查看为空
[root@centos7 data]#yum repolist all
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
repolist: 0
#挂在磁盘到/data/ mnt文件夹
[root@centos7 data]#mount /dev/cdrom /data/mnt
mount: /dev/sr0 写保护,将以只读方式挂载
[root@centos7 data]#ls mnt/
CentOS_BuildTag EFI EULA GPL images isolinux LiveOS Packages repodata RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 TRANS.TBL
创建repo文件 指向本地源
[root@centos7 data]#cat >> base.repo < [base]
> name=CentOS
> baseurl=file:///data/mnt/
> enable=1
> gpgcheck=1
> gpgkey-file:///data/mnt/RPM-GPG-KEY-CentOS-
RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7
> gpgkey-file:///data/mnt/RPM-GPG-KEY-CentOS-7
> EOF
[root@centos7 data]#mv base.repo /etc/yum.repos.d/
[root@centos7 data]#yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
源标识 源名称 状态
base CentOS 10,072
repolist: 10,072
网络源
[root@centos7 yum.repos.d]#cat epel.repo
[epel]
name=EPEL
baseurl=http://mirrors.aliyun.com/epel/$releasever/$basearch
gpgcheck=0
enable=0
[root@centos7 yum.repos.d]#yum repolist
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
epel | 4.7 kB 00:00:00
(1/3): epel/7/x86_64/group_gz | 96 kB 00:00:00
(2/3): epel/7/x86_64/updateinfo | 1.0 MB 00:00:00
(3/3): epel/7/x86_64/primary_db | 7.0 MB 00:00:00
源标识 源名称 状态
base CentOS 10,072
epel/7/x86_64 EPEL 13,685
repolist: 23,757
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
#下载最新的httpd
[root@centos7 data]#wget -P /usr/local/src/ https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.gz --no-check-certificate
--2021-11-14 22:48:04-- https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.gz
正在解析主机 dlcdn.apache.org (dlcdn.apache.org)... 151.101.2.132, 2a04:4e42::644
正在连接 dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:443... 已连接。
警告: 无法验证 dlcdn.apache.org 的由 “/C=US/O=Let's Encrypt/CN=R3” 颁发的证书:
颁发的证书已经过期。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:9873874 (9.4M) [application/x-gzip]
正在保存至: “/usr/local/src/httpd-2.4.51.tar.gz”
100%[==========================================================>] 9,873,874 --.-K/s 用时 0.1s
2021-11-14 22:48:04 (85.6 MB/s) - 已保存 “/usr/local/src/httpd-2.4.51.tar.gz” [9873874/9873874])
#查看下载内容
[root@centos7 data]#cd /usr/local/src
[root@centos7 src]#tar xf httpd-2.4.51.tar.gz
[root@centos7 src]#cd httpd-2.4.51/
[root@centos7 httpd-2.4.51]#ls
about_APACHE BuildBin.dsp docs InstallBin.dsp modules ROADMAP
acinclude.m4 buildconf emacs-style LAYOUT NOTICE server
Apache-apr2.dsw CHANGES httpd.dep libhttpd.dep NWGNUmakefile srclib
Apache.dsw changes-entries httpd.dsp libhttpd.dsp os support
apache_probes.d CMakeLists.txt httpd.mak libhttpd.mak README test
ap.d config.layout httpd.spec LICENSE README.CHANGES VERSIonING
build configure include Makefile.in README.cmake
BuildAll.dsp configure.in INSTALL Makefile.win README.platforms
#编译安装过程
278 2021-11-15 00:26:57 root wget -P /usr/local/src/ https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.gz --no-check-certificate
279 2021-11-15 00:27:11 root cd /usr/local/src/
280 2021-11-15 00:27:20 root tar zxvf httpd-2.4.51.tar.gz httpd-2.4.51/
281 2021-11-15 00:27:35 root cd httpd-2.4.51/
282 2021-11-15 00:28:10 root ./configure --prefix=/data/apps/httpd --sysconfdir=/etc/httpd/ --enable-ssl
283 2021-11-15 00:29:58 root yum -y -q install apr-devel apr-util-devel
284 2021-11-15 00:31:07 root yum -y -q install pcre-devel
285 2021-11-15 00:32:13 root ./configure --prefix=/data/apps/httpd --sysconfdir=/etc/httpd/ --enable-ssl
286 2021-11-15 00:32:38 root cat config.log
287 2021-11-15 00:34:22 root yum install gcc
288 2021-11-15 00:34:38 root ./configure --prefix=/data/apps/httpd --sysconfdir=/etc/httpd/ --enable-ssl
289 2021-11-15 00:35:12 root yum install openssl-devel
290 2021-11-15 00:35:32 root ./configure --prefix=/data/apps/httpd --sysconfdir=/etc/httpd/ --enable-ssl
291 2021-11-15 00:47:21 root make -j 2
292 2021-11-15 00:47:33 root make
293 2021-11-15 00:47:41 root yum install make -y
294 2021-11-15 00:47:47 root make -j 2
295 2021-11-15 00:48:43 root yum provides /usr/lib/rpm/redhat/redhat-hardened-ld
296 2021-11-15 00:48:53 root yum install /usr/lib/rpm/redhat/redhat-hardened-ld
297 2021-11-15 00:49:05 root make -j 2
298 2021-11-15 00:50:46 root make install
299 2021-11-15 00:51:10 root ls
300 2021-11-15 00:53:50 root echo 'PATH=/data/apps/httpd/bin/:$PATH' > /etc/profile.d/httpd.sh
301 2021-11-15 00:54:15 root . /etc/profile.d/httpd.sh
302 2021-11-15 00:54:48 root appachctl start
303 2021-11-15 00:55:17 root apachectl start
304 2021-11-15 00:55:31 root ip a
305 2021-11-15 00:56:03 root history
#已将repo移动到备份文件夹了,/etc/yum.repos.d/为空 [root@centos7 data]#ls backupRepo/ CentOS-base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo CentOS-x86_64-kernel.repo docker-ce.repo [root@centos7 data]#ls /etc/yum.repos.d/ [root@centos7 data]# #repolist查看为空 [root@centos7 data]#yum repolist all 已加载插件:fastestmirror Loading mirror speeds from cached hostfile repolist: 0 #挂在磁盘到/data/ mnt文件夹 [root@centos7 data]#mount /dev/cdrom /data/mnt mount: /dev/sr0 写保护,将以只读方式挂载 [root@centos7 data]#ls mnt/ CentOS_BuildTag EFI EULA GPL images isolinux LiveOS Packages repodata RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 TRANS.TBL 创建repo文件 指向本地源 [root@centos7 data]#cat >> base.repo <网络源[base] > name=CentOS > baseurl=file:///data/mnt/ > enable=1 > gpgcheck=1 > gpgkey-file:///data/mnt/RPM-GPG-KEY-CentOS- RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 > gpgkey-file:///data/mnt/RPM-GPG-KEY-CentOS-7 > EOF [root@centos7 data]#mv base.repo /etc/yum.repos.d/ [root@centos7 data]#yum repolist 已加载插件:fastestmirror Loading mirror speeds from cached hostfile 源标识 源名称 状态 base CentOS 10,072 repolist: 10,072
[root@centos7 yum.repos.d]#cat epel.repo [epel] name=EPEL baseurl=http://mirrors.aliyun.com/epel/$releasever/$basearch gpgcheck=0 enable=0 [root@centos7 yum.repos.d]#yum repolist 已加载插件:fastestmirror Loading mirror speeds from cached hostfile epel | 4.7 kB 00:00:00 (1/3): epel/7/x86_64/group_gz | 96 kB 00:00:00 (2/3): epel/7/x86_64/updateinfo | 1.0 MB 00:00:00 (3/3): epel/7/x86_64/primary_db | 7.0 MB 00:00:00 源标识 源名称 状态 base CentOS 10,072 epel/7/x86_64 EPEL 13,685 repolist: 23,757
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
#下载最新的httpd
[root@centos7 data]#wget -P /usr/local/src/ https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.gz --no-check-certificate
--2021-11-14 22:48:04-- https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.gz
正在解析主机 dlcdn.apache.org (dlcdn.apache.org)... 151.101.2.132, 2a04:4e42::644
正在连接 dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:443... 已连接。
警告: 无法验证 dlcdn.apache.org 的由 “/C=US/O=Let's Encrypt/CN=R3” 颁发的证书:
颁发的证书已经过期。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:9873874 (9.4M) [application/x-gzip]
正在保存至: “/usr/local/src/httpd-2.4.51.tar.gz”
100%[==========================================================>] 9,873,874 --.-K/s 用时 0.1s
2021-11-14 22:48:04 (85.6 MB/s) - 已保存 “/usr/local/src/httpd-2.4.51.tar.gz” [9873874/9873874])
#查看下载内容
[root@centos7 data]#cd /usr/local/src
[root@centos7 src]#tar xf httpd-2.4.51.tar.gz
[root@centos7 src]#cd httpd-2.4.51/
[root@centos7 httpd-2.4.51]#ls
about_APACHE BuildBin.dsp docs InstallBin.dsp modules ROADMAP
acinclude.m4 buildconf emacs-style LAYOUT NOTICE server
Apache-apr2.dsw CHANGES httpd.dep libhttpd.dep NWGNUmakefile srclib
Apache.dsw changes-entries httpd.dsp libhttpd.dsp os support
apache_probes.d CMakeLists.txt httpd.mak libhttpd.mak README test
ap.d config.layout httpd.spec LICENSE README.CHANGES VERSIonING
build configure include Makefile.in README.cmake
BuildAll.dsp configure.in INSTALL Makefile.win README.platforms
#编译安装过程
278 2021-11-15 00:26:57 root wget -P /usr/local/src/ https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.gz --no-check-certificate
279 2021-11-15 00:27:11 root cd /usr/local/src/
280 2021-11-15 00:27:20 root tar zxvf httpd-2.4.51.tar.gz httpd-2.4.51/
281 2021-11-15 00:27:35 root cd httpd-2.4.51/
282 2021-11-15 00:28:10 root ./configure --prefix=/data/apps/httpd --sysconfdir=/etc/httpd/ --enable-ssl
283 2021-11-15 00:29:58 root yum -y -q install apr-devel apr-util-devel
284 2021-11-15 00:31:07 root yum -y -q install pcre-devel
285 2021-11-15 00:32:13 root ./configure --prefix=/data/apps/httpd --sysconfdir=/etc/httpd/ --enable-ssl
286 2021-11-15 00:32:38 root cat config.log
287 2021-11-15 00:34:22 root yum install gcc
288 2021-11-15 00:34:38 root ./configure --prefix=/data/apps/httpd --sysconfdir=/etc/httpd/ --enable-ssl
289 2021-11-15 00:35:12 root yum install openssl-devel
290 2021-11-15 00:35:32 root ./configure --prefix=/data/apps/httpd --sysconfdir=/etc/httpd/ --enable-ssl
291 2021-11-15 00:47:21 root make -j 2
292 2021-11-15 00:47:33 root make
293 2021-11-15 00:47:41 root yum install make -y
294 2021-11-15 00:47:47 root make -j 2
295 2021-11-15 00:48:43 root yum provides /usr/lib/rpm/redhat/redhat-hardened-ld
296 2021-11-15 00:48:53 root yum install /usr/lib/rpm/redhat/redhat-hardened-ld
297 2021-11-15 00:49:05 root make -j 2
298 2021-11-15 00:50:46 root make install
299 2021-11-15 00:51:10 root ls
300 2021-11-15 00:53:50 root echo 'PATH=/data/apps/httpd/bin/:$PATH' > /etc/profile.d/httpd.sh
301 2021-11-15 00:54:15 root . /etc/profile.d/httpd.sh
302 2021-11-15 00:54:48 root appachctl start
303 2021-11-15 00:55:17 root apachectl start
304 2021-11-15 00:55:31 root ip a
305 2021-11-15 00:56:03 root history
3、利用sed 取出ifconfig命令中本机的IPv4地址
[root@centos8sec httpd-2.4.51]#ifconfig ens33 |sed -nr "2s/[^0-9]+([0-9.]+).*/1/p"
192.168.1.71
4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
[root@centos8sec httpd-2.4.51]#echo /etc/fstab | sed -nr 's#(.*)/.*$#1#p' /etc
[root@centos8sec httpd-2.4.51]#echo /etc/fstab | sed -nr 's#.*/([^/]+)/?$#1#p'
fstab
6、列出ubuntu软件管理工具apt的一些用法(自由总结)
6、列出ubuntu软件管理工具apt的一些用法(自由总结)
将已安装的软件包升级到最新版本
sudo apt upgrade
升级单个包
sudo apt upgrade package_name
全面升级
sudo apt full-upgrade
安装包
sudo apt install package_name
本地安装
sudo apt install 完全路径.deb
删除包
sudo apt remove package_name
删除未使用的包
sudo apt autoremove
列出所有可用包
sudo apt list
列出所有已安装的包
sudo apt list --installed
搜索包
sudo apt search package_name



