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

网络源:[root@centos8 yum.repos.d]# cat 163.repo[AppStream]name=Appstream_163baseurl=http://mirrors.163.com/centos/8/AppStream/x86_64/osgpgcheck=0[Extras]name=Extras_163baseurl=http://mirrors.163.com/centos/8/extras/x86_64/osgpgcheck=0[BaseOS]name=BaseOS_163baseurl=http://mirrors.163.com/centos/8/BaseOS/x86_64/osgpgcheck=0[root@centos8 yum.repos.d]# yum repolistrepo id                                                              repo nameAppStream                                                            Appstream_163BaseOS                                                               BaseOS_163Extras                                                               Extras_163[root@centos8 yum.repos.d]# yum list |wc -l6937--------------------------------------------------------------------------------------------------------------本地源:[root@centos8 yum.repos.d]# mkdir /mnt/cdrom    //创建挂载路径文件夹[root@centos8 yum.repos.d]# mount /dev/cdrom /mnt/cdrom      //临时挂载光盘文件,永久挂载需写入fstab文件mount: /mnt/cdrom: WARNING: device write-protected, mounted read-only.[root@centos8 yum.repos.d]# cd /mnt/cdrom/[root@centos8 cdrom]# lsAppStream  BaseOS  EFI  images  isolinux  LICENSE  media.repo  TRANS.TBL[root@centos8 yum.repos.d]# cat cdrom.repo[BaseOS]name=BaseOSbaseurl=file:///mnt/cdrom/BaseOSenabled=1gpgcheck=0[AppStream]name=AppStreambaseurl=file:///mnt/cdrom/AppStreamenabled=1gpgcheck=0[root@centos8 yum.repos.d]# yum clean all0 files removed[root@centos8 yum.repos.d]# yum repolistrepo id             repo nameAppStream              AppStreamBaseOS               BaseOS[root@centos8 cdrom]# yum list |wc -l6680

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

[root@centos8 test]# tar -xvf httpd-2.4.46.tar.bz2 -C .  //解压文件到当前目录下[root@centos8 httpd-2.4.46]# ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd      //运行 configure  --prefix制定程序存放路径  --sysconfdir 配置文件路径[root@centos8 httpd-2.4.46]# ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd     //编译文件checking for chosen layout... Apachechecking for working mkdir -p... yeschecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking build system type... x86_64-pc-linux-gnuchecking host system type... x86_64-pc-linux-gnuchecking target system type... x86_64-pc-linux-gnuconfigure:configure: Configuring Apache Portable Runtime library...configure:checking for APR... noconfigure: error: APR not found.  Please read the documentation.        //编译报错[root@centos8 httpd-2.4.46]# yum search apr*                            //搜索带ARP的包,一般缺失devel 和 util-devel包Repository BaseOS is listed more than once in the configurationRepository AppStream is listed more than once in the configurationLast metadata expiration check: 0:14:13 ago on Sat 17 Apr 2021 01:19:53 PM CST.======================================================== Name & Summary Matched: apr* ========================================================apr-devel.i686 : APR library development kitapr-devel.x86_64 : APR library development kitapr-util-bdb.i686 : APR utility library Berkeley DB driverapr-util-bdb.x86_64 : APR utility library Berkeley DB driverapr-util-devel.i686 : APR utility library development kitapr-util-devel.x86_64 : APR utility library development kitapr-util-ldap.x86_64 : APR utility library LDAP supportapr-util-mysql.x86_64 : APR utility library MySQL DBD driverapr-util-odbc.x86_64 : APR utility library ODBC DBD driverapr-util-openssl.i686 : APR utility library OpenSSL crypto supportapr-util-openssl.x86_64 : APR utility library OpenSSL crypto supportapr-util-pgsql.x86_64 : APR utility library PostgreSQL DBD driverapr-util-sqlite.x86_64 : APR utility library SQLite DBD driver============================================================= Name Matched: apr* =============================================================apr.i686 : Apache Portable Runtime libraryapr.x86_64 : Apache Portable Runtime libraryapr-util.i686 : Apache Portable Runtime Utility libraryapr-util.x86_64 : Apache Portable Runtime Utility library[root@centos8 httpd-2.4.46]# ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd  //再次执行编译文件,不出意外会在次报错,报错pcre,同样是缺失devel 和 util-devel包再次安装pcre-devel和pcre-util-devel即可    Server Version: 2.4.46    Install prefix: /apps/httpd    C compiler:     gcc    CFLAGS:           -pthread    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE    LDFLAGS:    LIBS:    C preprocessor: gcc -E[root@centos8 httpd-2.4.46]# echo $?0                                             //安装完成[root@centos8 httpd-2.4.46]# make -j 4 && make install                                   //make安装 报错gcc: error: /usr/lib/rpm/redhat/redhat-hardened-ld: No such file or directorymake[4]: *** [/data/test/httpd-2.4.46/modules/aaa/modules.mk:6: mod_authn_anon.la] Error 1make[4]: *** Waiting for unfinished jobs....gcc: error: /usr/lib/rpm/redhat/redhat-hardened-ld: No such file or directorymake[4]: *** [/data/test/httpd-2.4.46/modules/aaa/modules.mk:2: mod_authn_file.la] Error 1gcc: error: /usr/lib/rpm/redhat/redhat-hardened-ld: No such file or directorymake[4]: *** [/data/test/httpd-2.4.46/modules/aaa/modules.mk:4: mod_authn_dbm.la] Error 1make[4]: Leaving directory '/data/test/httpd-2.4.46/modules/aaa'make[3]: *** [/data/test/httpd-2.4.46/build/rules.mk:117: shared-build-recursive] Error 1make[3]: Leaving directory '/data/test/httpd-2.4.46/modules/aaa'make[2]: *** [/data/test/httpd-2.4.46/build/rules.mk:117: shared-build-recursive] Error 1make[2]: Leaving directory '/data/test/httpd-2.4.46/modules'make[1]: *** [/data/test/httpd-2.4.46/build/rules.mk:117: shared-build-recursive] Error 1make[1]: Leaving directory '/data/test/httpd-2.4.46'make: *** [/data/test/httpd-2.4.46/build/rules.mk:75: all-recursive] Error 1    [root@centos8 httpd-2.4.46]# yum search redhat*                                 //搜索redhat开头的包 发现缺失Repository BaseOS is listed more than once in the configurationRepository AppStream is listed more than once in the configurationLast metadata expiration check: 0:23:42 ago on Sat 17 Apr 2021 01:19:53 PM CST.=========================================================== Name Matched: redhat* ============================================================redhat-lsb.x86_64 : Implementation of Linux Standard Base specificationredhat-lsb-core.i686 : LSB Core module supportredhat-lsb-core.x86_64 : LSB Core module supportredhat-lsb-cxx.i686 : LSB CXX module supportredhat-lsb-cxx.x86_64 : LSB CXX module supportredhat-lsb-desktop.i686 : LSB Desktop module supportredhat-lsb-desktop.x86_64 : LSB Desktop module supportredhat-lsb-languages.i686 : LSB Languages module supportredhat-lsb-languages.x86_64 : LSB Languages module supportredhat-lsb-printing.i686 : LSB Printing module supportredhat-lsb-printing.x86_64 : LSB Printing module supportredhat-lsb-submod-multimedia.i686 : LSB Multimedia submodule supportredhat-lsb-submod-multimedia.x86_64 : LSB Multimedia submodule supportredhat-lsb-submod-security.i686 : LSB Security submodule supportredhat-lsb-submod-security.x86_64 : LSB Security submodule supportredhat-menus.noarch : Configuration and data files for the desktop menusredhat-rpm-config.noarch : CentOS specific rpm configuration filesredhat-support-lib-python.noarch : Red Hat Support Software Development Libraryredhat-support-tool.noarch : Tool for console access to Red Hat subscriber services[root@centos8 httpd-2.4.46]# yum provides  /usr/lib/rpm/redhat/redhat-hardened-ld             //搜索包Repository BaseOS is listed more than once in the configurationRepository AppStream is listed more than once in the configurationLast metadata expiration check: 0:29:04 ago on Sat 17 Apr 2021 01:19:53 PM CST.redhat-rpm-config-123-1.el8.noarch : CentOS specific rpm configuration filesRepo        : AppStreamMatched from:Filename    : /usr/lib/rpm/redhat/redhat-hardened-ld[root@centos8 httpd-2.4.46]# yum -y install redhat-rpm-config-123-1.el8.noarch    //安装[root@centos8 httpd-2.4.46]# make -j 4 && make install    //再次安装make[1]: Leaving directory '/data/test/httpd-2.4.46'[root@centos8 httpd]# lsbin  build  cgi-bin  error  htdocs  icons  include  logs  man  manual  modules[root@centos8 httpd]# cd bin/[root@centos8 bin]# lsab         apxs      dbmmanage  envvars-std  htcacheclean  htdigest  httpd      logresolveapachectl  checkgid  envvars    fcgistarter  htdbm         htpasswd  httxt2dbm  rotatelogs[root@centos8 bin]# ./apachectl start    //启动之后可以访问


3、sed命令取ip地址

[root@centos8 test]# ifconfig ens33|sed -En "s/.*[[:space:]]([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})[[:space:]]{1,2}net.*/\1/p"10.0.0.108

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

[root@centos8 data]# sed -i.bak -En '/^#[[:space:]]+/d' fstab[root@centos8 data]# cat fstab[root@centos8 data]# cp fstab.bak fstabcp: overwrite 'fstab'? y[root@centos8 data]# sed -i.bak -E '/^#[[:space:]]+/d' fstab[root@centos8 data]# cat fstab####UUID=5ba2a66b-0e07-41b7-883d-bbf2e80fdc15 /                       xfs     defaults        0 0UUID=3907332c-a026-4f30-8e74-bec273aafa9b /boot                   xfs     defaults        0 0UUID=6aebae13-df28-479a-8510-a2b6db90b9e6 /data                   xfs     defaults        0 0UUID=483f2853-7e93-425a-80a1-e8145be813d5 none                    swap    defaults        0 0UUID=1852dc2c-4ab0-49b2-a6c5-9d76e10ee6ff /data/mysql             xfs     defaults,noatime        0 0

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

[root@centos8 data]# echo '/etc/fstab'|sed -En "s#^/(.*)/(.*)#\1#p"etc[root@centos8 data]# echo '/etc/fstab'|sed -En "s#^/(.*)/(.*)#\2#p"fstab


©著作权归作者所有:来自51CTO博客作者qq604db53b5fadb的原创作品,如需转载,请注明出处,否则将追究法律责任

更多相关文章

  1. 【ASM】Oracle ASM + 11gR2 + RHEL6.5 安装
  2. Gitlab安装部署及基础操作
  3. Windows环境下Git配置及使用
  4. 编译安装mysql-5.6.40
  5. ES开发指南|如何快速上手ElasticSearch
  6. 22.从0学ARM-移植uboot支持exynos4412
  7. 【粉丝问答19】为啥变量没初始化就用了?那是宏定义啊!
  8. Ubuntu18.04搭建ssh服务器
  9. Ubuntu Linux 安装 .7z 解压和压缩文件

随机推荐

  1. Android(安卓)Studio解决依赖文件冲突
  2. 【第765期】你不懂JS:this豁然开朗!
  3. 【第766期】你不懂JS:对象
  4. No.8 bin和sbin的区别
  5. 聊聊“干货”
  6. 【第767期】你不懂JS:混合(淆)“类”的对象
  7. android binder与handler的简要理解
  8. 【早读汇】广州@mogeWCY的《实战ES2015》
  9. 【第769期】2016 JavaScript 发展现状大
  10. 【早读汇】上海@瑞心扉雪《CSS揭秘》笔记