实验环境为Centos 7.9
[root@OurLab ~]# vim /etc/yum.repos.d/Centos-7.repo
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
验证
[root@OurLab ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 498
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 2,543
repolist: 17,134
选择光盘镜像作为本地源,挂载光盘镜像
[root@OurLab ~]# mount /dev/cdrom /mnt/cdrom/
mount: /dev/sr0 is write-protected, mounting read-only
编辑repo文件
[root@OurLab ~]# vim /etc/yum.repos.d/local.repo
[local]
name=local
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1
验证
[root@OurLab ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,072
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 498
local local 4,021
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 2,543
repolist: 17,134
进入https://httpd.apache.org/download.cgi,下载http2.4
[root@OurLab ~]# rpm -qa | grep http
httpd-tools-2.4.6-93.el7.centos.x86_64
http-parser-2.7.1-8.el7_7.2.x86_64
httpd-2.4.6-93.el7.centos.x86_64
卸载http
[root@OurLab ~]# yum remove httpd httpd-tools http-parser
yum install apr-devel apr-util-devel openssl-devel pcre-devel gcc -y
[root@OurLab data]# ls
httpd-2.4.48.tar.bz2
[root@OurLab data]# tar -jxvf httpd-2.4.48.tar.bz2
[root@OurLab httpd-2.4.48]# ./configure --prefix=/usr/local/httpd24 --syscOnfdir=/etc/httpd/ --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork
[root@OurLab httpd-2.4.48]# make && make install
[root@OurLab httpd-2.4.48]# cd /usr/local/httpd24/bin/
[root@OurLab bin]# echo 'PATH=$PATH:/usr/local/httpd24/bin' > /etc/profile.d/httpd.sh
[root@OurLab bin]# . /etc/profile.d/httpd.sh
[root@OurLab bin]# apachectl start
[root@OurLab bin]# curl 127.0.0.1
It works!
[root@OurLab bin]# ifconfig ens33 | sed -n '/inet /s#\(.*inet \)\(.*\)\( n.*\)##gp'
192.168.1.59
[root@OurLab bin]# cat /etc/fstab |sed -r 's/^#\ ?(.*)//'|sed '/^$/d'
/etc/fstab
Created by anaconda on Fri May 17 05:52:23 2019
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
/dev/mapper/centos-root / xfs defaults 0 0
UUID=89dbf7a6-b689-4b3b-9a2e-2c56613dcecf /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
[root@OurLab bin]# ls -d /etc/fstab | sed -nr 's@^(.*)/([^/]+)/?$@@p'
/etc
[root@OurLab bin]# ls -d /etc/fstab | sed -nr 's@^(.*)/([^/]+)/?$@@p'
fstab
gw@node2:~$ sudo apt-get install vim -y
Reading package lists... Done
Building dependency tree
......
gw@node2:~$ sudo apt-get remove vim -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
......
gw@node2:~$ sudo apt-get update
0% [Connecting to mirrors.aliyun.com]
......
gw@node2:~$ sudo apt-get update
Hit:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
Get:2 http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB]
......
gw@node2:~$ apt search vim
Sorting... Done
Full Text Search... Done
acr/bionic,bionic 1.2-1 all
autoconf like tool
......
gw@node2:~$ apt show vim
Package: vim
Version: 2:8.0.1453-1ubuntu1.4
Priority: optional
Section: editors
......
gw@node2:~$ apt depends vim
vim
Depends: vim-common (= 2:8.0.1453-1ubuntu1.4)
Depends: vim-runtime (= 2:8.0.1453-1ubuntu1.4)
Depends: libacl1 (>= 2.2.51-8)
......
gw@node2:~$ apt-cache rdepends vim
vim
Reverse Depends:
byobu
vim-athena
vim-gtk
vim-gtk3
......
gw@node2:~$ sudo apt-get build-dep vim
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
......
gw@node2:~$ apt-get source vim
Reading package lists... Done
NOTICE: 'vim' packaging is maintained in the 'Git' version control system at:
https://salsa.debian.org/vim-team/vim.git
......
gw@node2:~$ sudo apt-get clean
gw@node2:~$ sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
gw@node2:~$ sudo apt-get check
Reading package lists... Done
Building dependency tree
Reading state information... Done