第四周練習記錄
第四周
1、自建yum倉庫,分別為網絡源和本地源
刪掉原yum源
rm-rf /etc/yum.repos.d/*
掛載光盤下的centos7安裝包
mount /dev/sr0 /mnt/
創建yum源
vim /etc/yum.repos.d/base.repo [base] name=base baseurl=file:///mnt/ https://mirrors.aliyun.com/centos/$releasever/os/$basearch/ https://mirrors.cloud.tencent.com/centos/$releasever/os/$basearch/ https://repo.huaweicloud.com/centos/$releasever/os/$basearch/ https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/ [epel] name=epel baseurl=https://mirrors.aliyun.com/epel/$releasever/x86_64/ https://mirrors.cloud.tencent.com/epel/$releasever/x86_64/ https://mirrors.huaweicloud.com/epel/$releasever/x86_64/ https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/x86_64/ gpgcheck=0 enabled=1 [extras] name=extras baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/ gpgcheck=0
2、編譯安裝http2.4,實現可以正常訪問,并將編譯步驟和結果提交。
最小化安裝建議先安裝相關包
yum install gcc make autoconf gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel zlib-devel vim lrzsz tree tmux lsof tcpdump wget net-tools iotop bc bzip2 zip unzip nfs-utils man-pages
下載httpd-2.4.48.tar.bz2
tar -jxvf httpd-2.4.48.tar.bz2 cd httpd-2.4.48 ./configure
報錯顯示:configure: error: APR not found. Please read the documentation
下載并編譯安裝apr
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.bz2 cd apr-1.7.0 ; ./configure --prefix=/usr/local/apr make ; make install
繼續安裝httpd
cd /date/httpd-2.4.48 ;./configure #報錯顯示:configure: error: APR-util not found. Please read the documentation.
下載編譯安裝apr-util
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz #解壓后進入執行
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr #make時報錯: make[1]: *** [xml/apr_xml.lo] Error 1 make[1]: Leaving directory `/date/apr-util-1.6.1' make: *** [all-recursive] Error 1 #網上搜索后顯示缺少了一個xml解析器yum 安裝一個 expat-devel 包即可 yum -y install expat-devel
#繼續編譯安裝apr-util make&&make install
成功后;切換到httpd繼續編譯安裝httpd:
./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ #需指明apr以及apr-util路徑 #執行成功后 make && make install #成功最后顯示 Installing configuration files mkdir /usr/local/httpd/conf mkdir /usr/local/httpd/conf/extra mkdir /usr/local/httpd/conf/original mkdir /usr/local/httpd/conf/original/extra Installing HTML documents mkdir /usr/local/httpd/htdocs Installing error documents mkdir /usr/local/httpd/error Installing icons mkdir /usr/local/httpd/icons mkdir /usr/local/httpd/logs Installing CGIs mkdir /usr/local/httpd/cgi-bin Installing header files mkdir /usr/local/httpd/include Installing build system files mkdir /usr/local/httpd/build Installing man pages and online manual mkdir /usr/local/httpd/man mkdir /usr/local/httpd/man/man1 mkdir /usr/local/httpd/man/man8 mkdir /usr/local/httpd/manual make[1]: Leaving directory `/date/httpd-2.4.48'
開啟httpd
usr/local/httpd/bin/httpd -k start
瀏覽器輸入本地ip地址后:

編譯安裝apache2.4.48成功
3、利用sed 取出ifconfig命令中本機的IPv4地址
ifconfig eth0 | sed -n '/inet /s#\(.*inet \)\(.*\)\( n.*\)#\2#gp'
4、刪除/etc/fstab文件中所有以#開頭,后面至少跟一個空白字符的行的行首的#和空白字符
sed -ri.bak '/^#/s/^#//' /etc/fstab
5、處理/etc/fstab路徑,使用sed命令取出其目錄名和基名
echo /etc/fstab | sed -rn 's#(.*)/([^/]+)/?#\2#p' #取基名 echo /etc/fstab/ | sed -rn 's#(.*)/([^/]+)/?#\1#p' #取目錄名
6、列出ubuntu軟件管理工具apt的一些用法(自由總結)
apt install 安裝軟件包
apt remove 移除軟件包
apt purge 移除軟件包以及卑職文件
apt update 刷新存儲庫索引
apt upgrade 升級所有可升級的軟件包
apt autoremove 自動刪除不需要的包
apt full-upgrade在升級軟件包是自動處理依賴關系
apt search 搜索應用程序
apt show 顯示安裝細節
apt list 列出包含條件的包
apt edit-sources 編輯源列表
浙公網安備 33010602011771號