当前位置: 首页 > news >正文

rhce 9 考题与解析笔记

本人于4月份完成 rhce 考试,以下是我的备考时刷的题,每题都有附上解题步骤和验证方式,祝大家考试顺利!

一、安装和配置Ansible

题目要求:

解题步骤:

1、安装所需的软件包

# 登录到 root 用户安装ansible
$ ssh control
$ su -
$ yum -y install ansible-core

2、创建静态文件清单

[greg@system2 ~]$ mkdir ansible
[greg@system2 ~]$ cd ansible
[greg@system2 ansible]$ vim inventory
[dev]
node1[test]
node2[prod]
node3
node4[balancers]
node5[webservers:children]
prod

3、创建配置文件

[greg@system2 ansible]$ vim ansible.cfg
[defaults]
inventory=/home/greg/ansible/inventory
remote user= greg
roles_path=/home/greg/ansible/roles:/usr/share/ansible/roles
collections_paths=/home/greg/ansible/collections[privilege_escalation]
become=True
become_method=sudo
become_user=root
become ask_pass=False

验证:

[greg@system2 ansible]$  ansible all -m ping
二、配置软件仓库

题目要求:

解题步骤:

1) 写一个 adhoc.sh 脚本在各个节点上安装yum存储库:

$ vim adhoc.sh
ansible all -m yum_repository -a "name='name1' description='description1' baseurl='baseurl1' gpgcheck=1 gpgkey='gpgkey1'enabled='yes'"ansible all -m yum_repository -a "name='name2' description='description2' baseurl='baseurl2' gpgcheck=1 gpgkey='gpgkey2'enabled='yes'"

2) 写一个 yum.yml 的palybook在各个节点上安装yum存储库:

$ vim yum.yaml
---
- name: set repohosts: 192.168.178.118tasks:- name: add base repoyum_repository:name: basedescription: CentOS-$releasever - Base - mirrors.aliyun.combaseurl: http://mirrors.aliyun.com/centos/$releasever/os/$basearch/gpgcheck: yesgpgkey: http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7enabled: yes$ ansible-playbook yum.yml

验证:

登录到各个节点、检查是否已完成 yum 仓库配置、检查各节点是否可以正常安装应用

$ ansible all -m shell -a 'ls /etc/yum.repos.d'
node2 | CHANGED | rc=0 >>
EX294_BASE.repo
………………$ ansible all -m shell -a "cat /etc/yum.repos.d/EX294_BASE.repo"$ ansible all -m yum -a 'name="wget" state="present"'
三、安装软件包

题目要求:

解题步骤:

$ vim packages.yml
---
- name: install packageshosts: dev,test,prodtasks: - name: install php mariadb tftpyum:name:- php- mariadb- tftpstate: present- name: install package grouphosts: devtasks:- name: install RPM Development tools groupyum:name: "@RPM Development Tools"state: present- name: upgrade all packageshosts: devtasks:- name: yum updateyum:name: '*'state: latest

验证:登录到远程主机检查是否安装了对应的软件/软件包组

# 验证是否安装了各个软件包
$ rpm -q mariadb
mariadb-5.5.68-1.el7.x86_64
$ rpm -q php
php-5.4.16-48.el7.x86_64
$ rpm -q tftp
tftp-5.2-22.el7.x86_64$ ansible dev,test,prod -m shell -a "rpm -qa | grep -e 'php' -e 'mariadb' -e 'tftp'"# 查看是否安装了软件包组
$ yum grouplist
$ ansible dev -m shell -a 'yum grouplist | grep Development'
四、配置计划任务

题目要求:

解题步骤:

$ cat crond.yml
---
- name: create crontabhosts: testtasks:- name: create user
http://www.xdnf.cn/news/443485.html

相关文章:

  • 16 - VDMA之视频转发实验
  • 用HBuilder运行小程序到微信开发者工具
  • SQL注入 ---04
  • OpenHarmony 开源鸿蒙南向开发——linux下使用make交叉编译第三方库——wget
  • 【C/C++】高阶用法_笔记
  • 负进制转换
  • 前端~三维地图(cesium)动态材质扩散圆环
  • 高等数学第七章---微分方程(§7.4-§7.5可降阶的高阶微分方程、二阶线性微分方程)
  • 在window中 js 编写一个全局触发事件并携带参数
  • EC600X 开发板介绍
  • 从入门到精通:阿里云/腾讯云服务器深度优化实践
  • bfs-最小步数问题
  • 基于单片机的车灯智能控制系统设计与实现
  • 技术选型不当,如何避免影响项目进展
  • 【python编程从入门到到实践】第七章用户输入和while循环
  • 黑马k8s(六)
  • 解决SQL Server SQL语句性能问题(9)——合理使用表分区
  • CentOS7原有磁盘扩容实战记录(LVM非LVM)【针对GPT分区】
  • QMK RGB矩阵灯效配置详解:从理论到实践(实操部分)
  • 共享代理IP vs 动态IP:企业级业务场景的选型深度解析
  • 通过Ollama读取模型
  • attention_weights = torch.ones_like(prompt_embedding[:, :, 0]):切片操作获取第二维度,第三维度
  • 速查 Linux 常用指令 II
  • 初识C++:类和对象(上)
  • Nexus首次亮相迪拜 TOKEN2049:以“手机 + 钱包 + 公链 + RWA”生态系统引领未来区块链基建
  • C++GO语言微服务之Dockerfile docker-compose②
  • Screen Mirroring App:轻松实现手机与电视的无缝投屏
  • idea springboot 配置文件 中文显示
  • OpenHarmony平台驱动开发(十七),UART
  • DFS算法的学习