2021-01-14

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

1.png

本地源:服务端
1.yum -y install httpd 安装httpd
2.systemctl enable --now httpd 永久开启httpd
3.sudo systemctl stop firewalld 关闭防火墙
4.mkdir /var/www/html/centos/8 -pv 在该目录下创建文件夹
5.mount /dev/sr0 /mnt/ 将光盘挂载到/mnt/下
6.cp -a /mnt/* /var/www/html/centos/8 将光盘上的文件拷贝到8目录下
客户端:
/etc/yum.repos.d/下创建后缀为repo的文件![33.png](https://upload-
34.png

2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
安装前准备:安装前准备:关闭防火墙和SELinux
systemctl stop firewalld.servicev
vim /etc/selinux/config
SELINUX=disabled

1 安装包

[root@centos8 ~]#dnf -y install gcc make apr-devel apr-util-devel pcre-devel
openssl-devel redhat-rpm-config

2 下载并解压缩包

wget https://downloads.apache.org//httpd/httpd-2.4.46.tar.bz2
[root@centos8 ~]#tar xvf httpd-2.4.43.tar.bz2 -C /usr/local/src

3 配置

[root@centos8 ~]#cd /usr/local/src/httpd-2.4.43/
[root@centos8 httpd-2.4.43]#./configure --prefix=/apps/httpd24 --
sysconfdir=/etc/httpd24 --enable-ssl

4 编译并安装

[root@centos8 httpd-2.4.43]#make -j 4 && make install

5 配置环境

[root@centos8 ~]#echo 'PATH=/apps/httpd24/bin:$PATH' > /etc/profile.d/httpd24.sh
[root@centos8 ~]#. /etc/profile.d/httpd24.sh

6运行

[root@centos8 ~]#apachectl

7 指定用apache用户运行

[root@centos8 ~]#useradd -r -s /sbin/nologin -d /var/www -c Apache -u 48 apache
[root@centos8 ~]#vim /etc/httpd24/httpd.conf
user apache
group apache

7生效和验证

[root@centos8 ~]#apachectl restart

查看

[root@centos8 ~]#ps aux

3、利用sed 取出ifconfig命令中本机的IPv4地址
ifconfig ens160 |sed -n '2p'|tr -s ' ' '#'|cut -d# -f3
ifconfig ens160 | sed -n '2p'| sed 's/^.inet //' |sed 's/ .//'
ifconfig ens160 | sed -rn '2s/(.inet )([0-9].)( netmask.)/\2/p'
ifconfig ens160 |sed -rn '2s/[0-9]+([0-9.]+) .
$/\1/p'

4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
sed -nr '/#[[:blank:]]+/s/#[[:blank:]]+(,*)/\1/p' /data/fstab

5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
echo /etc/fstab | sed -nr 's/(.*)/([/]+)/?/\1/p' echo /etc/fstab | sed -nr 's/^(.*)/([^/]+)/?/\2/p'

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • WK6 自建yum仓库,分别为网络源和本地源https://www.jianshu.com/p/07991a58a...
    大梦淋漓阅读 395评论 1 0
  • VIM Vim is a highly configurable text editor built to mak...
    宣雄民阅读 315评论 0 0
  • 开启Docker远程连接后,在开发和学习时都能带来便利,但请不要将此方式用在外部网络环境,以免带来安全问题,下图是...
    wxyj_gufeng阅读 671评论 0 0
  • [1] 多核CPU和单核CPU的优点和缺点,是否所有程序在多核CPU上运行速度都快?为什么? 优点:多线程 在一个...
    a狂飙的蜗牛阅读 1,821评论 0 0
  • 一、文件/文件夹管理 ls 列出当前目录文件(不包括隐含文件)ls -a 列出当前目录文件(包括隐含文件)ls -...
    BerL1n阅读 7,759评论 0 78