1踏烙、自建yum倉庫历等,分別為網(wǎng)絡源和本地源
網(wǎng)絡源repo配置(centos7):
[CentOS7]
name=CentOS7
baseurl=file:///data/centos7
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/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[CentOS7-Updates]
name=CentOS7-Updates
baseurl=https://mirrors.aliyun.com/centos/7/updates/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[extras7]
name=extras7
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[EPEL7]
name=EPEL7
baseurl=https://mirrors.aliyun.com/epel/$releasever/x86_64
https://mirrors.cloud.tencent.com/epel/$releasever/x86_64
https://repo.huaweicloud.com/epel/$releasever/x86_64
https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/x86_64
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591
本地源repo配置(centos7):
repo配置:
[base]
name=CentOS
baseurl=http://10.10.10.8/centos/CentOS7/Packages/
gpgcheck=1
gpgkey=http://10.10.10.8/centos/CentOS7/RPM-GPG-KEY-CentOS-7
[base-updates]
name=base-updates
baseurl=http://10.10.10.8/centos/CentOS7/CentOS7-Updates/
gpgcheck=1
gpgkey=http://10.10.10.8/centos/CentOS7/RPM-GPG-KEY-CentOS-7
[extras7]
name=extras7
baseurl=http://10.10.10.8/centos/CentOS7/extras7/
gpgcheck=1
gpgkey=http://10.10.10.8/centos/CentOS7/RPM-GPG-KEY-CentOS-7
[EPEL7]
name=EPEL7
baseurl=http://10.10.10.8/centos/CentOS7/EPEL7/
gpgcheck=1
gpgkey=http://10.10.10.8/centos/CenTOS/EPEL7/RPM-GPG-KEY-EPEL-7
[zabbix]
name=zabbix
baseurl=http://10.10.10.8/zabbix/5.0/centos/7/
gpgcheck=1
gpgkey=http://10.10.10.8/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591
2荐捻、編譯安裝http2.4寡夹,實現(xiàn)可以正常訪問,并將編譯步驟和結果提交魂角。
下載并解壓安裝包
[root@centos8 ~]#wget https://mirror.bit.edu.cn/apache//httpd/httpd-2.4.46.tar.bz2
[root@centos8 ~]#tar xvf httpd-2.4.46.tar.bz2 -C /usr/local/src
進入解壓目錄
[root@centos8 ~]#cd /usr/local/src/httpd-2.4.43/
編譯
[root@centos8 httpd-2.4.46]#./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl
PS:
--prefix為指定安裝目錄
--sysconfdir為指定配置文件安裝位置
--enable-ssl為指定軟件特性
安裝
[root@centos8 httpd-2.4.46]#make && make install
配置環(huán)境(配置后無須進入軟件bin目錄下啟動)
[root@centos8 ~]#echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/httpd.sh
[root@centos8 ~]#. /etc/profile.d/httpd.sh
運行
[root@centos8 ~]#apachectl start
打開瀏覽器輸入IP地址后野揪,出現(xiàn)“It works!”瞧栗,安裝成功
image.png
3迹恐、利用sed 取出ifconfig命令中本機的IPv4地址
[root@test ~]$ifconfig | sed -nE '2s/.* ([0-9.]+[0-9]{1,3}).*mask.*/\1/p'
10.10.10.222
4、刪除/etc/fstab文件中所有以#開頭通熄,后面至少跟一個空白字符的行的行首的#和空白字符
[root@test ~]$cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Jun 11 15:36:33 2021
#
# 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=3a7da216-cb2a-40a7-a41d-93f9c162f2a0 /boot xfs defaults 0 0
/dev/mapper/centos-home /home xfs defaults 0 0
/dev/mapper/centos-var /var xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0
[root@test ~]$sed -nE '/^#[[:blank:]]+(.*)/p' /etc/fstab
# /etc/fstab
# Created by anaconda on Fri Jun 11 15:36:33 2021
# 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
[root@test ~]$sed -nE 's/^#[[:blank:]]+(.*)/\1/p' /etc/fstab
/etc/fstab
Created by anaconda on Fri Jun 11 15:36:33 2021
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
5、處理/etc/fstab路徑,使用sed命令取出其目錄名和基名
目錄名:
[root@test ~]$echo /etc/fstab | sed -nE 's@(^/.*/)([[:alpha:]]+$)@\1@p'
/etc/
基名:
[root@test ~]$echo /etc/fstab | sed -nE 's@(^/.*/)([[:alpha:]]+$)@\2@p'
fstab
6能耻、列出ubuntu軟件管理工具apt的一些用法(自由總結)
apt 相當于 apt-get、apt-cache 和 apt-config 中最常用命令選項的集合
apt 具有更精減但足夠的命令選項饿幅,而且參數(shù)選項的組織方式更為有效戒职。此外,啟用的幾個特性也非常有幫助磕秤。
例如:可以在使用 apt 命令安裝或刪除程序時看到進度條,apt 還會在更新存儲庫數(shù)據(jù)庫時提示用戶可升級的軟件包個數(shù)
apt 與 apt-get 有一些類似的命令選項市咆,但它并不能完全向下兼容 apt-get 命令,也即可用 apt 替換部分apt-get 系列命令,但不是全部蒙兰。
用法:
apt install 安裝軟件包
apt remove 移除軟件包
apt purge 移除軟件包及配置文件
apt update 刷新存儲庫索引
apt upgrade 升級所有可升級的軟件包
apt autoremove 自動刪除不需要的包
apt full-upgrade 在升級軟件包時自動處理依賴關系
apt search 搜索應用程序
apt show 顯示安裝細節(jié)
apt list 列出包含條件的包(已安裝搜变,可升級等)
apt edit-sources 編輯源列表
APT包索引配置文件:
/etc/apt/sources.list
/etc/apt/sources.list.d
apt命令操作(如安裝和刪除軟件包)日志文件:
/var/log/dpkg.log
例: 修改阿里云的APT源為清華源
root@ubuntu2004:~# sed -i 's/mirrors.aliyun.com/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.list