第四周作业

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

1.yum -y install autofs
2.systemctl enable --now autofs
3.systemctl status autofs
4.ls /misc/cd
5.cd /misc/cd

在/etc/yum.repos.d/目录下创建一个以 ***.repo结尾的文件即可。

[24:28]root@VM-8-16-centos yum.repos.d][#cat Personal-configuration-warehouse.repo
[BaseOS]
name=BaseOS
baseurl=file:///misc/cd/BaseOS          #配置本地源仓库
#配置网络源仓库
		https://mirrors.cloud.tencent.com/centos/$releasever/BaseOS/$basearch/os/
		https://mirrors.tuna.tsinghua.edu.cn/centos-vault/$releasever/BaseOS/$basearch/os/
		http://mirrors.aliyun.com/centos-vault/$releasever/BaseOS/$basearch/os/

enable=1
gpgcheck=0


[AppStream]
name=AppStream
baseurl=file:///misc/cd/AppStream
		https://mirrors.cloud.tencent.com/centos/$releasever/AppStream/$basearch/os/
		https://mirrors.tuna.tsinghua.edu.cn/centos-vault/$releasever/AppStream/$basearch/os/
		http://mirrors.aliyun.com/centos-vault/$releasever/AppStream/$basearch/os/
enable=1
gpgcheck=0


[epel]
name=epel
baseurl=http://mirrors.cloud.tencent.com/epel/$releasever/Everything/$basearch/
		https://mirrors.huaweicloud.com/epel/$releasever/Everything/$basearch/
		https://mirrors.tuna.tsinghua.edu.cn/epel/$releasever/Everything/$basearch/

enable=1
gpgcheck=0


[extras]
name=extras
baseurl=https://mirrors.cloud.tencent.com/centos/$releasever/extras/$basearch/os/
		https://repo.huaweicloud.com/centos/$releasever/extras/$basearch/os/
		https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/os/
		http://mirrors.aliyun.com/centos-vault/$releasever/extras/$basearch/os/
enable=1
gpgcheck=0

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

利用编译工具,核心步骤如下:

(1)./configure(脚本)—配置

1通过选项、传递参数,指定安装路径、启用特性等。执行是会参考用户的指定以及Makefile.in文件生成Makefile。

例:源码编译安装,假如nginx总共有100个可用的功能,但我只需呀其中的10个功能,则可以指定要哪10个功能(写上去即可)

2检查依赖到的外部环境,如:依赖的软件名

(2)make 根据Makefile文件,会检测到依赖的环境,构造应用程序----编译

(3)make install 复制文件相对应的路径 ----安装

#找到http2.4.53对应的网址,并下载相对应的包至当前文件下
 3236  2022-03-24 21:11:42 wget  https://dlcdn.apache.org/httpd/httpd-2.4.53.tar.gz
 3237  2022-03-24 21:24:57 ll
 #解压缩至当前文件夹当中
 3238  2022-03-24 21:25:12 tar vxf httpd-2.4.53.tar.gz 
 #进入httpd目录
 3239  2022-03-24 21:25:25 cd httpd-2.4.53/
 #找到对应的文件:  ./configure
 3243  2022-03-24 21:25:58 ls 
 #--prefix(指定安装路径) 
 #指定启用特性(--enable-ssl)
 3244  2022-03-24 21:27:01 ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd  --enable-ssl
 3245  2022-03-24 21:28:36 yum install -y apr-devel
 3246  2022-03-24 21:28:44 ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd  --enable-ssl
 3247  2022-03-24 21:31:03 yum install -y apr-util-devel
 3248  2022-03-24 21:31:12 ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd  --enable-ssl
 #执行:yum provides  *pcre*  //查询该包来自于哪里,一般是devel(开发)
 3249  2022-03-24 21:32:18 yum provides  *pcre*
 3250  2022-03-24 21:34:53 yum install -y pcre2-devel
 3251  2022-03-24 21:35:03 ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd  --enable-ssl
 3252  2022-03-24 21:35:35 yum  -y install mod_ssl-devel
 3253  2022-03-24 21:35:57 yum provides mod_ssl
 3254  2022-03-24 21:36:26 yum install -y mod_ssl
 3255  2022-03-24 21:36:34 ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd  --enable-ssl
 3256  2022-03-24 21:38:03 yum install -y  openssl-devel
 3257  2022-03-24 21:38:15 ./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd  --enable-ssl
 #   编译   ;-j  指cpu核数
 3258  2022-03-24 21:38:50 make -j 4      
 #  安装
 3259  2022-03-24 21:39:59 make install
 3260  2022-03-24 21:40:41 tree /apps/httpd/
 3261  2022-03-24 21:40:45 tree /apps/httpd/ -d
 
[21:41:03 root@VM-8-16-centos httpd-2.4.53][#tree /apps/httpd/ -d
/apps/httpd/
├── bin
├── build
├── cgi-bin
├── error
│   └── include
├── htdocs
├── icons
│   └── small
├── include
├── logs
├── man
│   ├── man1
│   └── man8
├── manual
│   ├── developer
│   ├── faq
│   ├── howto
│   ├── images
│   ├── misc
│   ├── mod
│   ├── platform
│   ├── programs
│   ├── rewrite
│   ├── ssl
│   ├── style
│   │   ├── css
│   │   ├── lang
│   │   ├── latex
│   │   ├── scripts
│   │   └── xsl
│   │       └── util
│   └── vhosts
└── modules

#展示该目录下的所有文件
[21:43:24 root@VM-8-16-centos httpd-2.4.53][#ls
ABOUT_APACHE     ap.d          buildmark.o      config.log     docs         httpd.mak       LAYOUT        Makefile      mod
acinclude.m4     build         CHANGES          config.nice    emacs-style  httpd.spec      libhttpd.dep  Makefile.in   mod
Apache-apr2.dsw  BuildAll.dsp  changes-entries  config.status  httpd        include         libhttpd.dsp  Makefile.win  NOT
Apache.dsw       BuildBin.dsp  CMakeLists.txt   configure      httpd.dep    INSTALL         libhttpd.mak  modules       NWG
apache_probes.d  buildconf     config.layout    configure.in   httpd.dsp    InstallBin.dsp  LICENSE       modules.c     os 
#看Makefile文件
[21:44:30 root@VM-8-16-centos httpd-2.4.53][#ll Makefile 
-rw-r--r-- 1 root root 12130 Mar 24 21:38 Makefile
[21:44:56 root@VM-8-16-centos httpd-2.4.53][#/apps/httpd/
-bash: /apps/httpd/: Is a directory
[21:45:41 root@VM-8-16-centos httpd-2.4.53][#/apps/httpd/
bin/     cgi-bin/ htdocs/  include/ man/     modules/ 
build/   error/   icons/   logs/    manual/  
[21:45:41 root@VM-8-16-centos httpd-2.4.53][#/apps/httpd/b
bin/   build/ 
[21:45:41 root@VM-8-16-centos httpd-2.4.53][#/apps/httpd/bin
-bash: /apps/httpd/bin: Is a directory
[21:46:02 root@VM-8-16-centos httpd-2.4.53][#/apps/httpd/bin/
-bash: /apps/httpd/bin/: Is a directory
#进入指定安装目录的bin目录下
[21:46:06 root@VM-8-16-centos httpd-2.4.53][#/apps/httpd/bin/
ab            checkgid      htcacheclean  htpasswd      logresolve    
apachectl     dbmmanage     htdbm         httpd         rotatelogs    
apxs          fcgistarter   htdigest      httxt2dbm     
[21:46:06 root@VM-8-16-centos httpd-2.4.53][#/apps/httpd/bin/
ab            checkgid      htcacheclean  htpasswd      logresolve    
apachectl     dbmmanage     htdbm         httpd         rotatelogs    
apxs          fcgistarter   htdigest      httxt2dbm     
#启动该服务
[21:46:06 root@VM-8-16-centos httpd-2.4.53][#/apps/httpd/bin/apachectl 
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
[21:47:03 root@VM-8-16-centos httpd-2.4.53][#/apps/httpd/bin/apachectl  start ^C
#为启动方便,把它加入至环境变量中,并重定向到/etc/profile.d/httpd.sh 中
[21:48:45 root@VM-8-16-centos httpd-2.4.53][#echo 'PATH=/apps/httpd/bin/:$PATH' >/etc/profile.d/httpd.sh
[21:49:09 root@VM-8-16-centos httpd-2.4.53][#. /etc/profile.
profile.d/      profile.rpmnew  
#运行该脚本
[21:49:09 root@VM-8-16-centos httpd-2.4.53][#. /etc/profile.d/httpd.sh 
[21:49:36 root@VM-8-16-centos httpd-2.4.53][#apachect start
-bash: apachect: command not found
#启动该脚本
[21:50:00 root@VM-8-16-centos httpd-2.4.53][#apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerName' directive globally to suppress this message
httpd (pid 1567126) already running
[21:50:11 root@VM-8-16-centos httpd-2.4.53][#

以上httpd服务建立好。(地址栏输入当前主机的ip地址。显示 it works!)

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

[22:10:39 root@VM-8-16-centos ~][#ifconfig eth0 | sed -n '2s/^.*inet //;s/ netmask.*//p'
10.0.8.16

[22:44:27 root@VM-8-16-centos ~][#ifconfig eth0 | sed -ne '2s/^.*inet //;s/ netmask.*//p'
10.0.8.16 

[22:48:40 root@VM-8-16-centos ~][#ifconfig eth0 | sed -n '2s/^.*inet //p' | sed -n s/ netmask.*//p'
10.0.8.16 

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

这道题不会操作。



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

#基名
[10:16:30 root@VM-8-16-centos ~][#echo /etc/fatab | sed -nr  's@(.*)/([^/]+)/?@\2@p'
fatab
#目录名
[10:17:09 root@VM-8-16-centos ~][#echo /etc/fatab | sed -nr  's@(.*)/([^/]+)/?@\1@p'
/etc

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

apt	install			安装     
apt	remove		移除
apt	list				列出包含条件的包
apt	update			刷新存储库索引		
apt	upgrade		升级所有可升级的软件包
apt	full-upgrade	升级时自动解决依赖关系
apt	search			搜索应用程序
apt	show			展示安装细节
apt-cache  show	展示的细节比apt   show更详细
apt	depends
apt-cache	depends	查询软件依赖哪些包

dpkg   -S   filename				查找文件来自哪个包


  





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值