linux作业--第四周
1、自建yum仓库,分别为网络源和本地源
所有Yum仓库的配置文件均需以 .repo 结尾并存放在/etc/yum.repos.d/目录中的
[base] : yum仓库唯一标识符,避免与其它仓库冲突。
name=name : yum仓库的名称描述,易于识别仓库用处。
baseurl=file:///mnt/cdrom :提供方式包括FTP(ftp://..)、HTTP(http://..)、本地(file:///..)
enabled=1 : 设置此源是否可用,1为可用,0为禁用。
gpgcheck=1 : 设置此源是否校验检查包的来源和完整性,1为校验,0为不校验。
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 :若设置校验请指定公钥文件地址。
配置网络源
1.查看yum源配置文件
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo
[root@localhost yum.repos.d]mkdir backup
[root@localhost yum.repos.d]mv *.repo backup 将centos自带的官方源备份
2.配置网络源
[root@localhost yum.repos.d]# vim CentOS-Base.repo
[base]
name=Base Repo
baseurl=https://mirrors.aliyun.com/centos/7/os/x86_64/
gpgcheck=0
enabled=1
[epel]
name=epel 7 Release 7
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
gpgcheck=0
enabled=1
[root@localhost yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
(1/5): base/group_gz | 153 kB 00:00:00
(2/5): epel/group_gz | 96 kB 00:00:00
(3/5): epel/updateinfo | 1.0 MB 00:00:00
(4/5): base/primary_db | 6.1 MB 00:00:01
(5/5): epel/primary_db | 7.0 MB 00:00:01
Determining fastest mirrors
repo id repo name status
base Base Repo 10,072
epel epel 7 Release 7 13,685
repolist: 23,757
注:显示配置成功
配置本地源
1.挂载光盘至某目录,例如/mnt/cdrom
[root@localhost ~]# mount /dev/sr0 /mnt/cdrom
mount: /dev/sr0 is write-protected, mounting read-only
2.查看仓库
[root@localhost ~]# cd /mnt/cdrom
[root@localhost cdrom]# ls
CentOS_BuildTag EFI EULA GPL images isolinux LiveOS Packages repodata RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 TRANS.TBL
3.创建配置文件
[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[CentOS7]
name=CentOS 7
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
注:配置完成
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
1.下载源码:
[root@localhost ~]# wget https://dlcdn.apache.org//httpd/httpd-2.4.51.tar.bz2
2.解压源码:
[root@localhost ~]# tar xvf httpd-2.4.51.tar.bz2 -C test/
[root@localhost ~]# cd test/
[root@localhost test]# ls
httpd-2.[root@localhost test]# cd httpd-2.4.51/
[root@localhost httpd-2.4.51]# ls
ABOUT_APACHE apache_probes.d BuildBin.dsp CMakeLists.txt docs httpd.mak InstallBin.dsp libhttpd.mak modules README ROADMAP test
acinclude.m4 ap.d buildconf config.layout emacs-style httpd.spec LAYOUT LICENSE NOTICE README.CHANGES server VERSIONING
Apache-apr2.dsw build CHANGES configure httpd.dep include libhttpd.dep Makefile.in NWGNUmakefile README.cmake srclib
Apache.dsw BuildAll.dsp changes-entries configure.in httpd.dsp INSTALL libhttpd.dsp Makefile.win os README.platforms support
4.51
3.编译
1.先安装相关包
[root@localhost ~]# yum install gcc make autoconf apr-devel apr-util-devel pcredevel openssl-devel redhat-rpm-config
2.开始编译
[root@localhost httpd-2.4.51]# ./configure

注:显示./configure执行成功 接着执行 make && make install

注:到此编译结束
关闭防火墙与SElinux
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
关闭SELinux
[root@localhost ~]# vim /etc/selinux/config

3.启动服务
[root@localhost ~]# /usr/local/apache2/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
查看结果

4.配置环境变量
[root@localhost ~]#echo 'PATH=/usr/local/apache2/bin:$PATH' > /etc/profile.d/httpd.sh
[root@localhost ~]#chmod a+x httpd.sh
[root@localhost ~]#. /etc/profile.d/httpd.sh
5.运行
[root@localhost ~]#apachectl start
3、利用sed 取出ifconfig命令中本机的IPv4地址
[root@localhost ~]# ifconfig eth0 | sed -rn '2s/.*inet ([0-9.]+).*/\1/p'
192.168.42.200
4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
[root@localhost ~]# sed -ri.bak '/^#/s/^#//' /etc/fstab
5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
[root@localhost ~]# echo /etc/sysconfig/network-scripts/ifcfg-eth0 | sed -nr 's@^(.*)/(.*)@\1@p'
/etc/sysconfig/network-scripts
[root@localhost ~]# echo /etc/sysconfig/network-scripts/ifcfg-eth0 | sed -nr 's@^(.*)/(.*)@\2@p'
ifcfg-eth0
6、列出ubuntu软件管理工具apt的一些用法(自由总结)
一、安装软件包
[root@localhost ~]# apt install tree
二、删除软件包
[root@localhost ~]# apt remove tree
三、列出仓库软件包
[root@localhost ~]# apt list
四、搜索软件包
[root@localhost ~]# apt search tree
五、查看某个软件包的详细信息
[root@localhost ~]# apt show tree
六、刷新存储库索引
[root@localhost ~]# apt update
七、升级所有可升级的软件包
[root@localhost ~]# apt upgrade
八、移除软件包及配置文件
[root@localhost ~]# apt purge
linux作业--第四周的更多相关文章
- 20135302魏静静——linux课程第四周实验及总结
linux课程第四周实验及总结 一.实验 我选择的是第20号系统调用,getpid 代码如下: /* getpid.c */ #include <unistd.h> #include &l ...
- Linux内核分析作业第四周
系统调用的三个层次 一.用户态.内核态和中断 用户通过库函数与系统调用联系起来. 1.内核态 在高的执行级别下,代码可以执行特权指令,访问任意的物理地址,这时的CPU就对应内核态 2.用户态: 在低级 ...
- Linux作业(三)-shell统计某文章中出现频率最高的N个单词并排序输出出现次数
Linux课上的作业周三交,若有考虑不周到的地方,还请多多不吝赐教. shell处理文本相关的经常使用命令见此博客 # #假设输入两个參数 则第一个为统计单词的个数.第二个为要统计的文章 #假设输入一 ...
- linux作业
第二单元 (1)以root用户登录GNOME图形界面 语言支持选择为汉语 (2)使用快捷键切换到虚拟终端2,使用普通用户身份登录,查看系统提示符 (3)使用命令退出虚拟终端2上登录的用户 (4)使用快 ...
- linux 内核 第四周 扒开系统调用的三层皮 上
姬梦馨 原创作品 http://mooc.study.163.com/course/USTC-1000029000 一.用户态.内核态和中断处理过程 用户通过库函数与系统调用联系起来:库函数帮我们把系 ...
- 2019-11-8 Linux作业 李宗盛
linux系统的特点:完全免费,高效,安全稳定.支持多种硬件平台.有好的用户界面.强大的网络功能.支持多任务多用户. linux一般有三个主要部分:内核.命令解释层.实用工具. 那合适系统的心脏,是运 ...
- 怎么理解linux作业(job),与进程(process)的关系
1.相关概念: shell :命令解释器,其实就是一个脚本语言解释器,有很多种(bash,ash,tcsh等),最常用的是bash. job(作业): 是相对shell 来说的,在shell中执行一条 ...
- gentoo(贱兔) Linux作业系统的基本使用
emerge是gentoo linux的portage包管理器的命令行工具emerge的基础使用:emerge 软件包名:安装某软件包 emerge nanoemerge --ask 软件包名:交互式 ...
- Artix Linux作业系统的使用~
Artix(阿蒂克斯)Linux 与Gentoo(贱兔) Linux真是夫唱妇随.由于Artix(阿蒂克斯)逃离Systemd,投入到了openrc温暖的怀抱,从而使得每安装一个软体,你还得额外为其安 ...
随机推荐
- AT2395 [ARC071C] TrBBnsformBBtion
基于观察,可以发现以下两条性质: A 可以到 BB,BB 也可以到 A,对 B <-> AA 也是同理的. 可以通过这两个操作交换相邻元素. 对于前者,只需证明 BB 可以到 A 即可,不 ...
- Atcoder ARC-060
ARC060(2020.7.8) A 背包板子 B 首先感觉这个东西应该不能直接 \(O(1)\) 算出来,那么复杂度应该就是 \(O(\log n), O(\sqrt{n}), O(\sqrt{n} ...
- JS介绍、意义
HTML和CSS 京东 网页.网站和应用程序 网页:单独的一个页面 网站:一些列相关的页面组成到一起 应用程序:可以和用户产生交互,并实现某种功能. 演示JavaScript的强大 http://im ...
- PHP中的一些常用函数收集
<?php //===============================时间日期=============================== //y返回年最后两位,Y年四位数,m月份数字 ...
- LaunchScreen&LaunchImage
优先级:LaunchScreen > LaunchImage 在xcode配置了,不起作用 1.清空xcode缓存 2.直接删掉程序 重新运行 如果是通过LaunchImage设置启动界面,那么 ...
- 深入Java微服务之网关系列1:什么是网关
前言 近来,在想着重构一个新的产品.准备采用微服务的技术解决方案,来搭建基础设施框架.网关,是一个必不可少的组件.那么,网关到底是什么? 其又有什么特点或者特性,成为微服务必不可少的组件呢?今天, ...
- nodejs并行无关联
var async = require('async'); //串行无关联series//串行有关联waterfall//并行:parallel //会把各个函数的执行结果一起放到最后的回调中asyn ...
- 个人觉得好用的Idea插件
Intellij IDEA插件 排名不分先后 1. Codota 代码智能提示插件 只要打出首字母就能联想出一整条语句,这也太智能了,还显示了每条语句使用频率.原因是它学习了我的项目代码,总结出了我的 ...
- Office RTF远程模板注入
远程模板插入 ProofPoin最近写了一篇文章,报告中提到近年来RTF模板注入进行office钓鱼攻击的数量增加.之前还没怎么了解过RTF模板注入的,现在和小编一起去看看吧(笑hhh). 相 ...
- python 百宝箱
百宝箱 1. 正则表达式 删除缓存文件 os.system("/sbin/fuser -k .nfs*") os.system("rm -rf .nfs*") ...