第四周作業(yè)

一、查詢var下不屬于root lp gdm的所有文件

find /var \( -not -user root -a -not -user lp -a -not -user -gdm \) ?

二、統(tǒng)計/etc/init.d/functions文件中每個單詞的出現(xiàn)次數(shù),并排序(用grep和sed兩種方法分別實現(xiàn))

1、egrep -o '\<[[:alpha:]]+\>' /etc/init.d/functions | sort |uniq -c | sort -n

\<詞首 ? ?\>詞尾 ? ? ? +表示至少匹配一次 ??

2、sed -r 's@[^[:alpha:]]+@\n@g' /etc/init.d/functions|sort|uniq -c|sort -n

三、利用sed取出ifconfig命令中本機的IP地址

1、利用sed -n 不自動打印,,模式空間內(nèi)容。-r 用擴展正則表達式。s///查找替換IP地址。查找時對查找的內(nèi)容用()進行分組,用\1引用分組進行替換。最后顯示IP地址

1

2、利用sed中!取反然后進行d刪除,取出對應(yīng)的行

2

四、總結(jié)yum的配置和使用,包括yum倉庫的創(chuàng)建

yum install yum安裝 ? ?yum clean all ?清除緩存 ??

yum remove ?卸載??

yum list ?顯示所有包

yum 源配置目錄為/etc/yum.repos.d ?里面存放yum源配置文件,文件名.repo結(jié)尾。

.repo文件格式:[basse] ? ?源名稱

? ? ? ? ? ? ? ? ? ? ? ? ? ?baseurl= ? ? 文件路徑 ?或者ftp路徑 ?或者網(wǎng)絡(luò)路徑

? ? ? ? ? ? ? ? ? ? ? ? ? ?gpkcheck=0? ? 表示對從這個源下載的rpm包不進行校驗

五、編寫系統(tǒng)初始化腳本reset.sh,包括別名,提示符顏色,yum倉庫配置文件

#!/bin/bash

cat >>/root/.bashrc<<EOF

alias cp='cp -i'

alias mv='mv -i'

alias rm='rm -i'

PS1="\[\033[1;36;40m\] [\u@\h: \w] \\$"? ? ??\[\033[1;36;40m\]?表示是遏制的顏色? ? \\$ :第一個\是轉(zhuǎn)義符? \$表示提示符? root為#? 普通用戶$

六、安裝tree,ftp,lftp,telnet等包

yum install tree?ftp?lftp?telnet -y


七、在Centos上編譯安裝apache2.4源碼包,并啟動此服務(wù)

1 yum groupinstall "development tools"

yum install apr-devel apr-util-devel pcre-devel openssl-devel

2 useradd -r -u 80 -d /data/www/ -s /sbin/nologin httpd

3 tar xf httpd-2.4.25.tar.bz2

cd httpd-2.4.25/

4 cat README

cat INSTALL

5 ./configure --help

./configure --prefix=/app/httpd --sysconfdir=/etc/httpd24? --enable-ssl --disable-status

6 make && make install

7 PATH變量

echo 'PATH=/app/httpd/bin:$PATH' > /etc/profile.d/httpd.sh

. /etc/profile.d/httpd.sh

8 apachectl start


?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

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

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