linux cpu占用率如何看
281
2022-09-30
练习题4
1、自建yum仓库,分别为网络源和本地源
#神奇的光盘挂载目录 #CentOS [root@centos7 ~]#rpm -q autofs || yum -y install autofs [root@centos7 ~]#systemctl enable --now autofs 本地源 [root@centos7 ~]mount /dev/cdrom /mnt/cdrom [root@centos7 ~]#vim /etc/yum.repos.d/centos7.repo [CentOS7] name=CentOS 7 baseurl=file:///mnt/cdrom gpgcheck=0 enabled=1 网络源 # 1、配置yum源 [root@centos8 ~]#vim /etc/yum.repos.d/base.repo [base] name=CentOS baseurl=file:///misc/cd https://mirrors.tuna.tsinghua.edu.cn/centos/7/os/x86_64/ https://mirrors.aliyun.com/centos/7/os/x86_64/ https://mirrors.cloud.tencent.com/centos/7/os/x86_64/ https://repo.huaweicloud.com/centos/7/os/x86_64/ gpgcheck=0 [extras] name=extras baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/extras/x86_64/ https://mirrors.aliyun.com/centos/7/extras/x86_64/ https://mirrors.cloud.tencent.com/centos/7/extras/x86_64/ https://repo.huaweicloud.com/centos/7/extras/x86_64/ gpgcheck=0 [epel] name=epel baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/x86_64/ https://mirrors.aliyun.com/epel/7/x86_64/ https://mirrors.cloud.tencent.com/epel/7/x86_64/ https://mirrors.huaweicloud.com/epel/7/x86_64/ gpgcheck=0 # 2、查看源 [root@centos7 yum.repos.d]# yum repolist Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: * epel: mirrors.huaweicloud.com * extras: repo.huaweicloud.com repo id repo name status base CentOS 10,072 epel epel 13,692 extras extras 500 repolist: 24,264
2、编译安装http2.4,实现可以正常访问,并将编译步骤和结果提交。
#安装前准备:关闭防火墙和SELinux #1 安装相关包 [root@centos7 ~]# yum -y install gcc make autoconf apr-devel apr-util-devel pcredevel openssl-devel redhat-rpm-config #2 下载并解压缩包 [root@centos7 ~]# wget --no-check-certificate [root@centos7 ~]# tar xvf -C /usr/local/src #3 配置 [root@centos7 ~]# cd /usr/local/src/httpd-2.4.51/ [root@centos7 ./configure --prefix=/apps/--sysconfdir=/etc/--enable-ssl #4 编译并安装 [root@centos7 make -j 4 && make install #5 配置环境 [root@centos7 echo 'PATH=/apps/> /etc/profile.d/httpd.sh [root@centos7 . /etc/profile.d/httpd.sh #6 运行 [root@centos7 apachectl start #7 指定用apache用户运行 [root@centos7 useradd -r -s /sbin/nologin -d /var/-c Apache -u 48 apache [root@centos7 vim /etc/httpd/httpd.conf user apache group apache #8 配置生效和验证 [root@centos7 apachectl restart #9 查看进程 [root@centos7 ps aux |grep httpd root 20194 0.0 0.1 103772 3340 ? Ss 23:03 0:00 /apps/-k start apache 20318 0.0 0.2 392684 4396 ? Sl 23:05 0:00 /apps/-k start apache 20319 0.0 0.2 392684 4396 ? Sl 23:05 0:00 /apps/-k start apache 20320 0.0 0.2 392684 4396 ? Sl 23:05 0:00 /apps/-k start root 20403 0.0 0.0 112808 968 pts/1 S+ 23:05 0:00 grep --color=auto 取出ifconfig命令中本机的IPv4地址
[root@centos7 ~]# ifconfig ens33 | sed -nr '2s@^[^0-9]+([0-9.]+).*$@\1@p' 10.0.0.150
4、删除/etc/fstab文件中所有以#开头,后面至少跟一个空白字符的行的行首的#和空白字符
[root@centos7 ~]# sed -ri 's/^#[[:space:]]+(.*$)/\1/g' /etc/fstab
5、处理/etc/fstab路径,使用sed命令取出其目录名和基名
#取目录名 [root@centos7 yum.repos.d]# echo "/etc/fstab" |sed -r 's#(^/.*/)([^/]+/?)#\1#' /etc/ [root@centos7 yum.repos.d]# echo /etc/fstab/ | sed -rn 's#(.*)/([^/]+)/?#\1#p' /etc 取基名 [root@centos7 yum.repos.d]# echo /etc/fstab/ | sed -rn 's#(.*)/([^/]+)/?#\2#p' fstab [root@centos7 yum.repos.d]# echo "/etc/fstab" |sed -r 's#(^/.*/)([^/]+/?)#\2#' fstab
6、列出ubuntu软件管理工具apt的一些用法(自由总结)
#1 安装软件包 [root@localhost ~]# apt install tree #2 删除软件包 [root@localhost ~]# apt remove tree #3 列出仓库软件包 [root@localhost ~]# apt list #4 搜索软件包 [root@localhost ~]# apt search nginx #5 查看某个软件包的详细信息 [root@localhost ~]# apt show nginx #6 更新包索引 [root@localhost ~]# apt update
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~