明20210821

文本处理与软件管理

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

本地源:

 

 

 

 

 

 

 

网络源:

[root@openvpn ~]# cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-6.8 - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.8/os/$basearch/
http://mirrors.aliyuncs.com/centos-vault/6.8/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos-vault/6.8/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6.8 - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.8/updates/$basearch/
http://mirrors.aliyuncs.com/centos-vault/6.8/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos-vault/6.8/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6.8 - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.8/extras/$basearch/
http://mirrors.aliyuncs.com/centos-vault/6.8/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos-vault/6.8/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centos-vaultplus]
name=CentOS-6.8 - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.8/centos-vaultplus/$basearch/
http://mirrors.aliyuncs.com/centos-vault/6.8/centos-vaultplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos-vault/6.8/centos-vaultplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6.8 - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.8/contrib/$basearch/
http://mirrors.aliyuncs.com/centos-vault/6.8/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos-vault/6.8/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos-vault/RPM-GPG-KEY-CentOS-6

 

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

cat /etc/redhat-release 

dnf -y install lrzsz

136 rz -be
137 tar -xf httpd-2.4.49.tar.gz
138 yum install gcc openssl-devel pcre-devel apr-devel apr-util-devel -y
139 cd httpd-2.4.49/
140 ./configure
141 make && make install
142 ll
143 make
144 yum -y install gcc automake autoconf libtool make
145 make && make install
146 #dnf install gcc make autoconf apr-devel apr-util-devel pcrdevel openssl-devel redhat-rpm-confige
147 dnf install gcc make autoconf apr-devel apr-util-devel pcrdevel openssl-devel redhat-rpm-confige
148 cd
149 tar -xvf httpd-2.4.49.tar.gz -C /usr/local/src/
150 cd /usr/local/src/
151 ll
152 cd httpd-2.4.49/
153 mkdir -vp /apps/httpd
154 ./configure --prefix=/apps/httpd/ --sysconfdir=/etc/httpd --enable-ssl
155 make -j 4 && make install
156 dnf install gcc make autoconf apr-devel apr-util-devel pcrdevel openssl-devel redhat-rpm-confie
157 dnf install redhat-rpm-confie
158 dnf install redhat-rpm-config
159 make -j 4 && make install
160 echo `PATH=/apps/httpd/bin:$PATH` > /etc/profile.d/httpd.sh
161 . /etc/profile.d/httpd.sh
162 cd
163*
164 ./etc/profile.d/httpd.sh
165 . /etc/profile.d/httpd.sh
166 echo `PATH=/apps/httpd/bin:$PATH` > /etc/profile.d/httpd.sh
167 . /etc/profile.d/httpd.sh
168 /apps/httpd/bin/apachectl start
169 useradd -r -s /sbin/nologin -d /var/www -c Apache -u 48 apache
170 /apps/httpd/bin/apachectl restart
171 ps aux
172 netstat -antlp

 

3、利用sed 取出ifconfig命令中本机的IPv4地址

[root@10-100-13-200 ~]# ifconfig eth0 | sed -nr "2s/[^0-9]+([0-9.]+).*/\1/p"
10.100.13.200


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

 

[root@10-100-13-200 ~]# sed -nr 's/^#[[:space:]]+(.*)/\1/p' /etc/fstab
/etc/fstab
Created by anaconda on Fri Jun 5 04:06:04 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.


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

 [root@10-100-14-129 ~]# echo /etc/fstab | sed -nr 's#(.*)/.*$#\1#p'

/etc
[root@10-100-14-129 ~]# echo /etc/fstab | sed -nr 's#.*/([^/]+)/?$#\1#p'
fstab

 

6、列出ubuntu软件管理工具apt的一些用法(自由总结)

apt-get 是常用的命令行工具,
apt install 安装软件包
apt remove 移除软件包
apt purge 移除软件包及配置文件
apt update 刷新存储库索引
apt upgrade 升级所有可升级的软件包
apt autoremove 自动删除不需要的包
apt full-upgrade 在升级软件中自动处理依赖关系
apt search 搜索应用程序
apt show 显示安装细节

 

posted on 2021-09-23 17:07  明20210821  阅读(26)  评论(0编辑  收藏  举报

导航