康乐_SH

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1、自建yum仓库,分别为网络源和本地源
配置本地源(centos7光驱源):
1.挂载光驱至/mnt/cdrom

mount /dev/cdrom /mnt/cdrom

2.修改镜像源配置文件

vim /etc/yum.repos.d/centos7.repo
[CentOS7]
name=CentOS 7
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1

3.清理yum缓存

yum clean all
yum makecache

配置网络源(centos7阿里云):

1.备份yum源镜像文件

mv CentOS-Base.repo CentOS-Base.repo.bak

2.下载阿里云yum源镜像配置文件

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3.清理yum缓存

yum clean all
yum makecache

配置网络源和本地源(Centos8)

vim /etc/yum.repos.d/base.repo
[BaseOS]
name=BaseOS
baseurl=file:///misc/cd/BaseOS
baseurl=https://repo.huaweicloud.com/centos/$releasever/
gpgcheck=1
gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial                                                          
[AppStream]
name=AppStream
baseurl=file:///misc/cd/AppStream
baseurl=https://mirrors.huaweicloud.com/epel/$releasever/x86_64
gpgcheck=0
[epel]
name=EPEL
baseurl=http://mirrors.aliyun.com/epel/$releasever/Everything/$basearch
gpgcheck=0
enabled=1
[extras]
name=extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os
gpgcheck=0

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

1.安装相关包

yum install gcc make autoconf apr-devel apr-util-devel pcrdevel openssl-devel redhat-rpm-confige

2.下载httpd安装包并解压缩

wget https://dlcdn.apache.org//httpd/httpd-2.4.52.tar.bz2 --no-check-certificate
tar xvf httpd-2.4.52.tar.bz2 -C /usr/local/src/

3.配置

cd /usr/local/src/httpd-2.4.52/
./configure --prefix=/apps/httpd --sysconfdir=/etc/httpd --enable-ssl

4.编译并安装

make && make install

5.配置环境

echo 'PATH=/apps/httpd/bin:$PATH' > /etc/profile.d/httpd.sh
. /etc/profile.d/httpd.sh

6.运行apache

apachectl start

7.查看进程

ps aux|grep httpd

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

ifconfig eth0|sed -n '2p'|sed -nr 's#(.*inet)(.*)(.*netmask.*)#\2#p'
10.0.0.150

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

sed -r 's/^#[[:space:]]*//' /etc/fstab


/etc/fstab
Created by anaconda on Fri Dec 3 07:57:29 2021

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.

UUID=0962b57e-f628-4d58-9345-7b2f9aeb94ca / xfs defaults 0 0
UUID=857dafd5-a92f-4f6a-bf06-b2a5ef3239f6 /boot ext4 defaults 1 2
UUID=2aa8c67e-2768-484f-90e5-860a3a58e467 /data xfs defaults 0 0
UUID=ef5b3393-dc3f-4507-8321-7b75ea06a989 none swap defaults 0 0
UUID=dcbee5a2-5c24-4de0-939e-259dc3f959f8 /mnt ext4 defaults
UUID=78530e66-05ef-4345-b5b0-5c3232f0e047 /data/mysql ext4 defaults

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

echo "/etc/fstab"| sed -r 's#^/(.*)/(.*)#\1#'
etc
echo "/etc/fstab"| sed -r 's#^/(.*)/(.*)#\2#'
fstab

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

apt install 安装软件包
apt remove 移除软件包
apt purge 移除软件包以及配置文件
apt list 列出包含条件的包
apt search 搜索应用程序
apt show 显示安装细节
apt upgrade 升级所有可升级的包
apt update 刷新存储库索引

posted on 2022-01-12 17:36  康乐_SH  阅读(42)  评论(0编辑  收藏  举报