软件包管理

查找/var 目录下不属于root、lp、gdm的所有文件

find /var ! \( -user root -o -user lp -o -user gdm \)

统计/etc/init.d/functions文件中每个单词的出现次数,并排序

egrep -o "\<[[:alpha:]]+\>" /etc/init.d/functions|sort|uniq -c|sort -n
sed -r 's/[^[:alpha:]]+/\n/g' /etc/init.d/functions |sort |uniq -c |sort -n

利用sed取出ifconfig命令中本机IPV4地址

[root@localhost ~]# ifconfig|grep 'inet '|sed -n '1p'|sed 's/^.*inet //g'|sed 's/ *netmask.*$//g'
192.168.88.160

yum

yum list            #列出可安装软件
yum install         #安装软件
yum update          #更新软件
yum remove          #删除软件
yum info            #查看软件包信息
yum clean all      #清除缓存
 

创建yum仓库

[Based]                                     #yum的ID,必须唯一
name=CentOS-$releasever - Base              #描述信息
baseurl=https://mirrors.aliyun.com/centos/7.3.1611/         #镜像服务器地址
gpgcheck=0                                                  #取消验证                
#--enablerepo=[repo]        激活一个或多个仓库(支持通配符)
#--disablerepo=[repo]       禁掉一个或多个仓库(支持通配符) 

安装软件包

yum -y install tree ftp lftp telnet

编写系统初始化脚本

[root@localhost ~]#vi reset.sh
#!/bin/bash
#
#****************************************************************************************
#Author          :                              Tery.xu
#QQ              :                              937543378
#Date            :                              2019-04-15
#FileName        :                              reset.sh
#URL             :                              https://www.jianshu.com/u/4ad081c39248
#Description     :                              The test script
#Copyright (C)   :                              2019  All rights reserved
#****************************************************************************************
echo "PS1='\[\e[1;32m\][\u@\h \w]\\$\[\e[0m\]' " >> /root/\.bashrc
echo "[Based]\n                                    
name=CentOS-$releasever - Base\n              
baseurl=https://mirrors.aliyun.com/centos/7.3.1611/\n        
gpgcheck=0\n" >> /etc/yum.repo.d/Based.repo
yum repolist
echo "vi=vim" >>/root/\.bashrc  

源码编译Apache

[root@localhost ~]#yum grouplist
[root@localhost ~]#yum -y groupinstall Development Tools
[root@localhost ~]#rz
rz waiting to receive.
Starting zmodem transfer.  Press Ctrl+C to cancel.
Transferring httpd-2.4.25.tar.bz2...
  100%    6248 KB    6248 KB/sec    00:00:01       0 Errors  
[root@localhost ~]#ls
 httpd-2.4.25.tar.bz2
 [root@localhost ~]#tar xvf httpd-2.4.25.tar.bz2 
 [root@localhost ~]#cd httpd-2.4.25/
 [root@localhost ~/httpd-2.4.25]#rpm -q httpd 
httpd-2.4.6-88.el7.centos.x86_64
[root@localhost ~/httpd-2.4.25]#yum -y remove httpd
[root@localhost ~/httpd-2.4.25]#./configure 
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... no
configure: error: APR not found.  Please read the documentation.
[root@localhost ~/httpd-2.4.25]#yum -y install apr-devel
[root@localhost ~/httpd-2.4.25]#yum -y install apr-util-devel
[root@localhost ~/httpd-2.4.25]#yum -y install pcre-devel
[root@localhost ~/httpd-2.4.25]#./configure
[root@localhost ~/httpd-2.4.25]#make
[root@localhost ~/httpd-2.4.25]#make install
[root@localhost ~/httpd-2.4.25]#apachectl start

你可能感兴趣的:(软件包管理)