第六周

第六周

1、自建yum倉(cāng)庫(kù),分別為網(wǎng)絡(luò)源和本地源

[root@repo-server ~]# cat /etc/yum.repos.d/baseOS.repo
[base]
name=BaseOS
baseurl=file:///misc/cd/BaseOS
        https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///misc/cd/AppStream
        https://mirrors.aliyun.com/centos/8/AppStream/x86_64/os/
gpgcheck=0
[root@repo-server ~]# 

2、編譯安裝http2.4,實(shí)現(xiàn)可以正常訪問(wèn),并將編譯步驟和結(jié)果提交。

  • 從官網(wǎng)下載軟件包到本地目錄/usr/local/src
wget -P /usr/local/src https://ftp.wayne.edu/apache//httpd/httpd-2.4.46
  • 由于是最小化安裝,編譯是缺少必要的包,需要安裝
  dnf -y install apr-devel apr-util-devel
  yum -y install pcre-devel
  dnf install -y  openssl-devel
  • 選擇安裝目錄在/apps/httpd,配置文件目錄/etc/httpd,啟用ssl.(查看configure的選項(xiàng),可以運(yùn)行 ./configure --help)
./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl

配置成功后顯示

configure: summary of build options:
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]$ 
  • 開(kāi)始編譯,-j選擇是選擇多個(gè)線程
 make -j 4 && make install

有報(bào)錯(cuò)gcc: error: /usr/lib/rpm/redhat/redhat-hardened-ld: No such file or directory

//查詢?nèi)鄙俚奈募儆谀膫€(gè)包文件
[root@centos8 httpd-2.4.46]$yum provides /usr/lib/rpm/redhat/redhat-hardened-ld
Last metadata expiration check: 0:25:46 ago on Sun 03 Jan 2021 10:06:35 AM CST.
redhat-rpm-config-120-1.el8.noarch : CentOS specific rpm configuration files
Repo        : MyAppStream
Matched from:
Filename    : /usr/lib/rpm/redhat/redhat-hardened-ld
//安裝缺少的包
[root@centos8 httpd-2.4.46]$yum -y install redhat-rpm-config-120-1.el8.noarch
//繼續(xù)安裝
 [root@centos8 httpd-2.4.46]make -j 4 && make install

  • 根據(jù)INSTALL文件提示,要運(yùn)行PREFIX/bin/apachectl start,安裝完成。
   $ ./configure --prefix=PREFIX
       $ make
       $ make install
       $ PREFIX/bin/apachectl start
  
[root@centos8 bin]$./apachectl start
[root@centos8 bin]$ss -ntl
  State      Recv-Q       Send-Q              Local Address:Port             Peer Address:Port      
  LISTEN     0            128                       0.0.0.0:22                    0.0.0.0:*         
  LISTEN     0            128                             *:80                          *:*         
  LISTEN     0            128                          [::]:22                       [::]:*         
  [root@centos8 bin]$curl http://localhost
<html><body><h1>It works!</h1></body></html>

3、利用sed 取出ifconfig命令中本機(jī)的IPv4地址

[root@centos8 data]$ifconfig eth0 |sed -En '2s/(^ *inet )([0-9.]*)( .*$)/\2/p'
10.0.0.8

4、刪除/etc/fstab文件中所有以#開(kāi)頭,后面至少跟一個(gè)空白字符的行的行首的#和空白字符

[root@centos8 data]$cat /etc/fstab|sed -E 's/(^# )(.*)/\2/'

#
/etc/fstab
Created by anaconda on Tue Oct 27 17:54:45 2020
#
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=c970ffb7-8e3a-4b64-8014-c21e125be6d5 /                       xfs     defaults        0 0
UUID=81f38a9b-5532-4606-9147-44ab13b72f13 /boot                   ext4    defaults        1 2
UUID=b2c38bd9-642f-4660-8115-d50f51450d3a /data                   xfs     defaults        0 0
UUID=498e6700-939f-4a48-8f6a-6f7708c7a902 swap                    swap    defaults        0 0

5、處理/etc/fstab路徑,使用sed命令取出其目錄名和基名

root@centos8 data]$echo '/etc/fstab'|sed -E 's@(^/.*/)([^/]+/?)@\2@'
fstab
[root@centos8 data]$echo '/etc/fstab'|sed -E 's@(^/.*/)([^/]+/?)@\1@'
/etc/
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 1、自建yum倉(cāng)庫(kù),分別為網(wǎng)絡(luò)源和本地源2、編譯安裝http2.4,實(shí)現(xiàn)可以正常訪問(wèn),并將編譯步驟和結(jié)果提交。3、...
    阿浩浩浩閱讀 498評(píng)論 0 1
  • 1、自建yum倉(cāng)庫(kù),分別為網(wǎng)絡(luò)源和本地源 網(wǎng)絡(luò)源: 備份repo文件 mkdir /etc/yum.repos.d...
    24K_CHEN閱讀 150評(píng)論 0 0
  • 1、每12小時(shí)備份并壓縮/etc/目錄至/backup目錄中,保存文件名稱格式為,"etc-年-月-日-時(shí)-分.t...
    是小何同學(xué)閱讀 663評(píng)論 0 0
  • 1、自建yum倉(cāng)庫(kù),分別為網(wǎng)絡(luò)源和本地源 1)基于本地光盤創(chuàng)建yum源 2)基于本地的網(wǎng)絡(luò)yum源(web服務(wù)ht...
    196_fendou閱讀 233評(píng)論 0 0
  • 5月以來(lái),哪怕對(duì)市場(chǎng)風(fēng)向再不敏感的人,也感覺(jué)到陣陣涼意。二級(jí)市場(chǎng)連續(xù)下挫,一級(jí)市場(chǎng)融資環(huán)境惡化,不論企業(yè)融資數(shù)量還...
    錢皓頻道閱讀 6,457評(píng)論 1 6

友情鏈接更多精彩內(nèi)容