当前位置:   article > 正文

1+X云计算平台运维与开发认证(初级)样卷A(含答案)_下列有关nginx配置文件nginx.conf的叙述正确的是

下列有关nginx配置文件nginx.conf的叙述正确的是

单选题(200分):

1、在OSI模型中,HTTP协议工作在第()层,交换机工作在第()层。(10分)

A、7/3

B、7/2(正确答案)

C、6/3

D、6/2

2、Linux有三个查看文件的命令,若希望在查看文件内容过程中可以用光标上下移动来查看文件内容,应使用命令。(10分)

A、cat

B、more

C、less(正确答案)

D、menu

3、以下哪一项最好地描述了何时完成监控项目过程组?(10分)

A、整个项目中持续进行(正确答案)

B、每个可交付成果完成时

C、计划里程碑或项目间隙

D、每个项目阶段结束时

4、以下描述错误的是哪一项?(10分)

A、自建机房需要自己关注所有事情,成本高昂

B、传统IDC分为实体服务器托管和租用两种类型,IDC数据中心提供IP接入、带宽接入、电力供应和网络维护等

C、云计算是一种新的提供资源按需租用的服务模式

D、以上均不对(正确答案)

5、以下关于私有云优势和劣势的描述中,错误的是哪项?(10分)

A、支持定制和遗留应用

B、不影响现有IT管理的流程

C、部署成本高

D、持续运营成本低(正确答案)

6、在bash中,下列哪些语句是赋值语句?(10分)

A、a ="test"

B、$a ="test"

C、a="test"(正确答案)

D、$a="test"

7、在unix系统下执行chmod(“/usr/test/sample”,0753)之后该文件sample的访问权限为?(10分)

A、拥有者可读写执行,同组用户可写可执行,其他用户可读可执行。

B、拥有者可读写执行,同组用户可读写,其他用户可读可执行。

C、拥有者可读写执行,同组用户可读可执行,其他用户可写可执行。(正确答案)

D、拥有者可读写执行,同组用户可读可执行,其他用户可读写。

8、有一个文件ip.txt,每行一条ip记录,共若干行,下面哪个命令可以实现“统计出现次数最多的前3个ip及其次数”?(10分)

A、uniq -c ip.txt│sort -nr│head -n 3

B、sort ip.txt│uniq -c│sort -rn│head -n 3(正确答案)

C、cat ip.txt │count -n│sort -rn│head -n 3

D、cat ip.txt │sort │uniq -c│sort -rn│top -n 3

9、局域网的网络地址192.168.1.0/24,局域网络连接其它网络的网关地址是192.168.1.1。主机192.168.1.20访问172.16.1.0/24网络时,其路由设置正确的是?(10分)

A、route add –net 192.168.1.0 gw 192.168.1.1 netmask 255.255.255.0 metric 1

B、route add –net 172.16.1.0 gw 192.168.1.1 netmask 255.255.255.0 metric 1(正确答案)

C、route add –net 172.16.1.0 gw 172.16.1.1 netmask 255.255.255.0 metric 1

D、route add default 192.168.1.0 netmask 172.168.1.1 metric 1

10、终止一个前台进程可能用到的命令和操作是?(10分)

A、kill

B、ctrl+C(正确答案)

C、shut down

D、halt

11、当前目录下有a和b两个文件,执行命令“ls>c”,请问文件c里面的内容是什么?(10分)

A、a

B、b

C、ab

D、abc(正确答案)

12、你使用命令”vi/etc/inittab”查看该文件的内容,你不小心改动了一些内容,为了防止系统出为,你不想保存所修改的内容,你应该如何操作:(10分)

A、在末行模式下,键入:wq

B、在末行模式下,键入:q!(正确答案)

C、在末行模式下,键入:x!

D、在编辑模式下,键入”ESC”键直接退出vi

13、8个300G的硬盘做RAID 5的容量空间为(10分)

A、1200G

B、1.8T

C、2.1T(正确答案)

D、2400G

14、为了将当前目录下的归档文件myftp. tgz解压缩到/tmp目录下,用户可以使用命令(10分)

A、tar xvzf myftp. tgz –C /tmp(正确答案)

B、tar xvzf myftp. tgz –R /tmp

C、tar vzf myftp. tgz –X /tmp

D、tar xvzf myftp. tgz /tmp

15、下面关于数据库主从复制机制的原理概述,哪个是正确的?(10分)

A、mysql主从复制是将所有的事物操作写到binlog,slave获取binlog读入自己的数据库中。

B、mysql主从复制是将部分的事物操作写到binlog,slave获取binlog读入自己的中继区,然后再进行执行。

C、mysql主从复制是将所有的事物操作写到binlog,slave获取binlog读入自己的中继区,然后再进形执行。(正确答案)

D、mysql主从复制是将所有的事物操作直接从master节点复制到slave节点。

16、一台主机要实现通过局域网与另一个局域网通信,需要做的工作是?(10分)

A、配置域名服务器

B、定义一条本机指向所在网络的路由

C、定义一条本机指向所在网络网关的路由(正确答案)

D、定义一条本机指向目标网络网关的路由

17、在Linux系统中搭建DHCP服务器时,若需要给客户机指定默认网关地址为192.168.1.1,可以在dhcpd.conf配置文件中进行(10分)

A、option default-gate-way 192.168.1.1;

B、option gateways 192.168.1.1;

C、option routers 192.168.1.1;(正确答案)

D、option router-servers 192.168.1.1;

18、在RHEL5系统vi编辑器的末行模式中,若需要将文件中每一行的第一个“Linux”替换为“RHEL5”,可以使用(10分)

A、:s/Linux/RHEL5

B、:s/Linux/RHEL5/g

C、:%s/Linux/RHEL5(正确答案)

D、:%s/Linux/RHEL5/g

19、您需要制作一个要在web上公开的PDF文件,该文件会被客户通过浏览器下载数百万次,哪种选项最具有成本效益?(10分)

A、将文件存储在S3 Standard中(正确答案)

B、将文件存储在S3 Standard-IA中

C、将文件存储在Glacier中

D、将文件存储在EFS中

20、下面哪个不是docker容器的驱动程序?(10分)

A、XFS(正确答案)

B、ZFS

C、Btrfs

D、Device mapper

多选题(300分):

1、下面属于测试用例黑盒技术的是(15分)

 A、等价类划分(正确答案)

 B、边界值分析(正确答案)

 C、错误推测(正确答案)

 D、因果图(正确答案)

2、批量删除当前目录下后缀名为.c的文件。如a.c、b.c。(15分)

 A、rm *.c(正确答案)

 B、find . -name "*.c" -maxdepth 1 | xargs rm(正确答案)

 C、find . -name "*.c" | xargs rm

 D、以上都不正确

3、进程间通讯方式有哪些?(15分)

 A、管道(正确答案)

 B、消息队列(正确答案)

 C、共享内存(正确答案)

 D、文件和记录锁定(正确答案)

4、下面有关bash配置文件,说法正确的是?(15分)

 A、.bash_logout:退出shell时,要执行的命令(正确答案)

 B、.bash_profile:每个用户都可使用该文件输入专用于自己使用的shell信息,当用户登录时,该文件仅仅执行一次!默认情况下(正确答案)

 C、/etc/bash.bashrc 该文件包含专用于个人的bash shell的bash信息,当登录时以及每次打开新的shell时,该文件被读取

 D、/etc/profile:此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行(正确答案)

5、将文件file1复制为file2可以用下面哪些命令(15分)

 A、cp file1 file2(正确答案)

 B、cat file1 >file2(正确答案)

 C、cat < file1 >file2(正确答案)

 D、dd if=file1 of=file2(正确答案)

6、Docker中Cgroup的功能是什么?(15分)

 A、资源限制(正确答案)

 B、优先级分配(正确答案)

 C、资源统计(正确答案)

 D、任务控制(正确答案)

7、下列有关Nginx配置文件nginx.conf的叙述正确的是(15分)

 A、nginx进程数设置为CPU总核心数最佳(正确答案)

 B、虚拟主机配置多个域名时,各域名间应用逗号隔开

 C、sendfile on;表示为开启高效文件传输模式,对于执行下载操作等相关应用时,应设置为on

 D、设置工作模式与连接数上限时,应考虑单个进程最大连接数(最大连接数=连接数*进程数)(正确答案)

8、下面有关Ext2和ext3文件系统的描述,错误的是?(15分)

 A、ext2/ext3文件系统使用索引节点来记录文件信息,包含了一个文件的长度、创建及修改时间、权限、所属关系、磁盘中的位置等信息(正确答案)

 B、ext3增加了日志功能,即使在非正常关机后,系统也不需要检查文件系统

 C、ext3文件系统能够极大地提高文件系统的完整性,避免了意外宕机对文件系统的破坏

 D、ext3支持 1EB 的文件系统,以及 16TB 的文件。(正确答案)

9、Linux系统上,下面哪些文件是与用户管理相关的配置文件(15分)

 A、/etc/passwd(正确答案)

 B、/etc/shadow(正确答案)

 C、/etc/group(正确答案)

 D、/etc/password

10、在Linux系统,关于硬链接的描述正确的是(15分)

 A、跨文件系统

 B、不可以跨文件系统(正确答案)

 C、为链接文件创建新的i节点

 D、链接文件的i节点与被链接文件的i节点相同(正确答案)

11、linux 创建文件的命令有(15分)

 A、ls

 B、touch(正确答案)

 C、cat

 D、vi/vim(正确答案)

12、进程间通讯方式有哪些?(15分)

 A、管道(正确答案)

 B、消息队列(正确答案)

 C、共享内存(正确答案)

 D、文件和记录锁定(正确答案)

13、云服务器可用的镜像类型有哪几个?(15分)

 A、公有镜像(正确答案)

 B、自定义镜像(正确答案)

 C、服务市场镜像(正确答案)

 D、个人镜像

14、包年包月的云主机和按需付费的不同之处在于?(15分)

 A、按需付费的云主机稳定性更好

 B、包年包月的云主机费用单价更低(正确答案)

 C、包年包月的云主机在到期后会进入回收站一段时间,避免数据损失(正确答案)

 D、以上皆无

15、以下关于云主机的磁盘部分,描述正确的是?(15分)

 A、当数据盘、系统盘为本地盘时,硬件配置(CPU,内存)不可升降(正确答案)

 B、当数据盘、系统盘为云硬盘时,提供硬件配置(CPU,内存)调整功能(正确答案)

 C、无论如何,配置不允许调整,因为有损失数据的风险

 D、以上皆无

16、创建云主机时,可以购买的网络带宽有哪几个计费标准?(15分)

 A、按使用流量计费(正确答案)

 B、按带宽计费(正确答案)

 C、按时长计费

 D、以上皆无

17、在AWS中,哪些安全方面是客户的责任?(15分)

 A、安全组和ACL(访问控制列表)设置(正确答案)

 B、退役存储设备

 C、EC2实例操作系统上的补丁管理(正确答案)

 D、IAM凭证的生命周期管理(正确答案)

18、以下哪项是Amazon VPC子网的特征?(15分)

 A、每个子网跨越至少2个可用区,以提高高可用性环境

 B、每个子网映射到单个可用区(正确答案)

 C、/25的CIDR块掩码是支持的最小范围

 D、默认情况下,所有子网都可以相互路由,无论它们是私有还是公共(正确答案)

19、UNIX系统由哪几部分组成?(15分)

 A、Kernel(内核)(正确答案)

 B、Shell(外壳)(正确答案)

 C、工具及应用程序(正确答案)

 D、虚拟机

20、Neutron服务包括下面哪些组件。(15分)

 A、neutron-server(正确答案)

 B、neutron-agent

 C、OpenStack网络插件和代理(正确答案)

 D、消息队列(正确答案)

实操题:

1、网络管理(70分)

在eNSP中使用S5700交换机进行配置,通过一条命令划分vlan 2、vlan 3、vlan 1004,通过端口组的方式配置端口1-5为access模式,并添加至vlan2中。配置端口10为trunk模式,并放行vlan3。创建三层vlan 2,配置IP地址为:172.16.2.1/24,创建三层vlan1004,配置IP地址为:192.168.4.2/30。通过命令添加默认路由,下一跳为192.168.4.1。(使用完整命令)

  1. [Huawei]vlan batch 2 3 1004
  2. [Huawei]port-group 1
  3. [Huawei-port-group-1]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/5
  4. [Huawei-port-group-1]port link-type access
  5. [Huawei-port-group-1]port default vlan 2
  6. [Huawei]interface GigabitEthernet 0/0/10
  7. [Huawei-GigabitEthernet0/0/10]port link-type trunk
  8. [Huawei-GigabitEthernet0/0/10]port trunk allow-pass vlan 3
  9. [Huawei]interface Vlanif 2
  10. [Huawei-Vlanif2]ip address 172.16.2.1 24
  11. [Huawei]interface Vlanif 1004
  12. [Huawei-Vlanif1004]ip address 192.168.4.2 30
  13. [Huawei]ip route-static 0.0.0.0 0 192.168.4.1

2、yum源管理(60分)

当前有一个centos7.2-1511.iso的镜像文件,使用这个文件配置yum源,要求将这个镜像文件挂载在/opt/centos目录。还存在一个ftp源,IP地址为192.168.100.200,ftp共享的目录为/opt,/opt目录中存在一个iaas目录(该目录下存在一个repodata目录)请问如何配置自己的local.repo文件,使得可以使用这两个地方的软件包,安装软件。请将local.repo文件的内容以文本形式提交到答题框。

  1. [root@xserver1 ~]# cat /etc/yum.repos.d/local.repo
  2. [centos]
  3. name=centos
  4. baseurl=file:///opt/centos
  5. enabled=1
  6. gpgcheck=0
  7. [iaas]
  8. name=iaas
  9. baseurl=ftp://192.168.100.200/iaas 
  10. enabled=1
  11. gpgcheck=0

3、数据库管理(70分)

使用VMWare创建两台centos7系统的虚拟机,安装数据库服务,并将两台数据库配置为主从数据库模式(master和slave)。配置完成后,在从节点,执行show status slave\G查看从节点的复制状态。将查看从节点服务状态的返回结果以文本形式提交到答题框。(数据库用户名root,密码000000;关于数据库的命令均使用小写)

  1. Xserver1:
  2. [root@xserver1 ~]# yum install -y mariadb mariadb-server
  3. [root@xserver1 ~]# vim /etc/hosts
  4. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  5. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  6. 192.168.200.30 xserver1
  7. 192.168.200.40 xserver2
  8. [root@xserver1 ~]# systemctl restart mariadb
  9. [root@xserver1 ~]# mysql_secure_installation
  10. /usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
  11. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
  12. SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
  13. In order to log into MariaDB to secure it, we'll need the current
  14. password for the root user. If you've just installed MariaDB, and
  15. you haven't set the root password yet, the password will be blank,
  16. so you should just press enter here.
  17. Enter current password for root (enter for none):
  18. OK, successfully used password, moving on...
  19. Setting the root password ensures that nobody can log into the MariaDB
  20. root user without the proper authorisation.
  21. Set root password? [Y/n] y
  22. New password:
  23. Re-enter new password:
  24. Password updated successfully!
  25. Reloading privilege tables..
  26. ... Success!
  27. By default, a MariaDB installation has an anonymous user, allowing anyone
  28. to log into MariaDB without having to have a user account created for
  29. them. This is intended only for testing, and to make the installation
  30. go a bit smoother. You should remove them before moving into a
  31. production environment.
  32. Remove anonymous users? [Y/n] y
  33. ... Success!
  34. Normally, root should only be allowed to connect from 'localhost'. This
  35. ensures that someone cannot guess at the root password from the network.
  36. Disallow root login remotely? [Y/n] n
  37. ... skipping.
  38. By default, MariaDB comes with a database named 'test' that anyone can
  39. access. This is also intended only for testing, and should be removed
  40. before moving into a production environment.
  41. Remove test database and access to it? [Y/n] y
  42. - Dropping test database...
  43. ... Success!
  44. - Removing privileges on test database...
  45. ... Success!
  46. Reloading the privilege tables will ensure that all changes made so far
  47. will take effect immediately.
  48. Reload privilege tables now? [Y/n] y
  49. ... Success!
  50. Cleaning up...
  51. All done! If you've completed all of the above steps, your MariaDB
  52. installation should now be secure.
  53. Thanks for using MariaDB!
  54. [root@xserver1 ~]# vim /etc/my.cnf
  55. [mysqld]
  56. datadir=/var/lib/mysql
  57. socket=/var/lib/mysql/mysql.sock
  58. # Disabling symbolic-links is recommended to prevent assorted security risks
  59. symbolic-links=0
  60. # Settings user and group are ignored when systemd is used.
  61. # If you need to run mysqld under a different user or group,
  62. # customize your systemd unit file for mariadb according to the
  63. # instructions in http://fedoraproject.org/wiki/Systemd
  64. log_bin = mysql-bin
  65. binlog_ignore_db = mysql
  66. server_id = 30
  67. [mysqld_safe]
  68. log-error=/var/log/mariadb/mariadb.log
  69. pid-file=/var/run/mariadb/mariadb.pid
  70. #
  71. # include all files from the config directory
  72. #
  73. !includedir /etc/my.cnf.d
  74. [root@xserver2 ~]# systemctl restart mariadb
  75. [root@xserver1 ~]# mysql -uroot -p000000
  76. Welcome to the MariaDB monitor. Commands end with ; or \g.
  77. Your MariaDB connection id is 9
  78. Server version: 5.5.44-MariaDB-log MariaDB Server
  79. Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
  80. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  81. MariaDB [(none)]> grant all privileges on *.* to root@'%' identified by '000000';
  82. Query OK, 0 rows affected (0.00 sec)
  83. MariaDB [(none)]> grant replication slave on *.* to 'user'@'xserver2' identified by '000000';
  84. Query OK, 0 rows affected (0.00 sec)
  85. Xserver2:
  86. [root@xserver2 ~]# yum install -y mariadb mariadb-server
  87. [root@xserver2 ~]# vim /etc/hosts
  88. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  89. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  90. 192.168.200.30 xserver1
  91. 192.168.200.40 xserver2
  92. [root@xserver2 ~]# systemctl restart mariadb
  93. [root@xserver2 ~]# mysql_secure_installation
  94. /usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
  95. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
  96. SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
  97. In order to log into MariaDB to secure it, we'll need the current
  98. password for the root user. If you've just installed MariaDB, and
  99. you haven't set the root password yet, the password will be blank,
  100. so you should just press enter here.
  101. Enter current password for root (enter for none):
  102. OK, successfully used password, moving on...
  103. Setting the root password ensures that nobody can log into the MariaDB
  104. root user without the proper authorisation.
  105. Set root password? [Y/n] y
  106. New password:
  107. Re-enter new password:
  108. Password updated successfully!
  109. Reloading privilege tables..
  110. ... Success!
  111. By default, a MariaDB installation has an anonymous user, allowing anyone
  112. to log into MariaDB without having to have a user account created for
  113. them. This is intended only for testing, and to make the installation
  114. go a bit smoother. You should remove them before moving into a
  115. production environment.
  116. Remove anonymous users? [Y/n] y
  117. ... Success!
  118. Normally, root should only be allowed to connect from 'localhost'. This
  119. ensures that someone cannot guess at the root password from the network.
  120. Disallow root login remotely? [Y/n] n
  121. ... skipping.
  122. By default, MariaDB comes with a database named 'test' that anyone can
  123. access. This is also intended only for testing, and should be removed
  124. before moving into a production environment.
  125. Remove test database and access to it? [Y/n] y
  126. - Dropping test database...
  127. ... Success!
  128. - Removing privileges on test database...
  129. ... Success!
  130. Reloading the privilege tables will ensure that all changes made so far
  131. will take effect immediately.
  132. Reload privilege tables now? [Y/n] y
  133. ... Success!
  134. Cleaning up...
  135. All done! If you've completed all of the above steps, your MariaDB
  136. installation should now be secure.
  137. Thanks for using MariaDB!
  138. [root@xserver2 ~]# systemctl restart mariadb
  139. [root@xserver2 ~]# vim /etc/my.cnf
  140. [mysqld]
  141. datadir=/var/lib/mysql
  142. socket=/var/lib/mysql/mysql.sock
  143. # Disabling symbolic-links is recommended to prevent assorted security risks
  144. symbolic-links=0
  145. # Settings user and group are ignored when systemd is used.
  146. # If you need to run mysqld under a different user or group,
  147. # customize your systemd unit file for mariadb according to the
  148. # instructions in http://fedoraproject.org/wiki/Systemd
  149. log_bin = mysql-bin
  150. binlog_ignore_db = mysql
  151. server_id = 40
  152. [mysqld_safe]
  153. log-error=/var/log/mariadb/mariadb.log
  154. pid-file=/var/run/mariadb/mariadb.pid
  155. #
  156. # include all files from the config directory
  157. #
  158. !includedir /etc/my.cnf.d
  159. [root@xserver2 ~]# systemctl restart mariadb
  160. [root@xserver2 ~]# mysql -uroot -p000000
  161. MariaDB [(none)]> change master to master_host='xserver1',master_user='user',master_password='000000';
  162. Query OK, 0 rows affected (0.00 sec)
  163. MariaDB [(none)]> start slave;
  164. Query OK, 0 rows affected (0.01 sec)
  165. MariaDB [(none)]> show slave status\G
  166. *************************** 1. row ***************************
  167. Slave_IO_State: Waiting for master to send event
  168. Master_Host: xserver1
  169. Master_User: user
  170. Master_Port: 3306
  171. Connect_Retry: 60
  172. Master_Log_File: mysql-bin.000001
  173. Read_Master_Log_Pos: 606
  174. Relay_Log_File: mariadb-relay-bin.000002
  175. Relay_Log_Pos: 890
  176. Relay_Master_Log_File: mysql-bin.000001
  177. Slave_IO_Running: Yes
  178. Slave_SQL_Running: Yes
  179. Replicate_Do_DB:
  180. Replicate_Ignore_DB:
  181. Replicate_Do_Table:
  182. Replicate_Ignore_Table:
  183. Replicate_Wild_Do_Table:
  184. Replicate_Wild_Ignore_Table:
  185. Last_Errno: 0
  186. Last_Error:
  187. Skip_Counter: 0
  188. Exec_Master_Log_Pos: 606
  189. Relay_Log_Space: 1186
  190. Until_Condition: None
  191. Until_Log_File:
  192. Until_Log_Pos: 0
  193. Master_SSL_Allowed: No
  194. Master_SSL_CA_File:
  195. Master_SSL_CA_Path:
  196. Master_SSL_Cert:
  197. Master_SSL_Cipher:
  198. Master_SSL_Key:
  199. Seconds_Behind_Master: 0
  200. Master_SSL_Verify_Server_Cert: No
  201. Last_IO_Errno: 0
  202. Last_IO_Error:
  203. Last_SQL_Errno: 0
  204. Last_SQL_Error:
  205. Replicate_Ignore_Server_Ids:
  206. Master_Server_Id: 30
  207. 1 row in set (0.00 sec)

4、Linux存储LVM管理(60分)

使用VMware软件和提供的CentOS-7-x86_64-DVD-1511.iso创建虚拟机,自行配置好网络并多添加一块大小为20G的硬盘,使用fdisk命令对该硬盘进形分区,要求分出三个大小为5G的分区。使用这三个分区,创建名xcloudvg的卷组。然后创建名xcloudlv的逻辑卷,大小为12G,最后用xfs文件系统对逻辑卷进行格式化并挂载到/mnt目录下。将上述所有操作命令和返回结果以文本形式提交到答题框。

  1. [root@xserver1 ~]# fdisk /dev/sdb
  2. Welcome to fdisk (util-linux 2.23.2).
  3. Changes will remain in memory only, until you decide to write them.
  4. Be careful before using the write command.
  5. Device does not contain a recognized partition table
  6. Building a new DOS disklabel with disk identifier 0xd41e2ca5.
  7. Command (m for help): n
  8. Partition type:
  9. p primary (0 primary, 0 extended, 4 free)
  10. e extended
  11. Select (default p): p
  12. Partition number (1-4, default 1):
  13. First sector (2048-41943039, default 2048):
  14. Using default value 2048
  15. Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +5G
  16. Partition 1 of type Linux and of size 5 GiB is set
  17. Command (m for help): n
  18. Partition type:
  19. p primary (1 primary, 0 extended, 3 free)
  20. e extended
  21. Select (default p):
  22. Using default response p
  23. Partition number (2-4, default 2):
  24. First sector (10487808-41943039, default 10487808):
  25. Using default value 10487808
  26. Last sector, +sectors or +size{K,M,G} (10487808-41943039, default 41943039): +5G
  27. Partition 2 of type Linux and of size 5 GiB is set
  28. Command (m for help): n
  29. Partition type:
  30. p primary (2 primary, 0 extended, 2 free)
  31. e extended
  32. Select (default p):
  33. Using default response p
  34. Partition number (3,4, default 3):
  35. First sector (20973568-41943039, default 20973568):
  36. Using default value 20973568
  37. Last sector, +sectors or +size{K,M,G} (20973568-41943039, default 41943039): +5G
  38. Partition 3 of type Linux and of size 5 GiB is set
  39. Command (m for help): w
  40. The partition table has been altered!
  41. Calling ioctl() to re-read partition table.
  42. Syncing disks.
  43. [root@xserver1 ~]# pvcreate /dev/sdb[1-3]
  44. Physical volume "/dev/sdb1" successfully created
  45. Physical volume "/dev/sdb2" successfully created
  46. Physical volume "/dev/sdb3" successfully created
  47. [root@xserver1 ~]# vgcreate xcloudvg /dev/sdb[1-3]
  48. Volume group "xcloudvg" successfully created
  49. [root@xserver1 ~]# lvcreate -L +12G -n xcloudlv xcloudvg
  50. Logical volume "xcloudlv" created.
  51. [root@xserver1 ~]# mkfs.xfs /dev/mapper/xcloudvg-xcloudlv
  52. meta-data=/dev/mapper/xcloudvg-xcloudlv isize=256 agcount=4, agsize=786432 blks
  53. = sectsz=512 attr=2, projid32bit=1
  54. = crc=0 finobt=0
  55. data = bsize=4096 blocks=3145728, imaxpct=25
  56. = sunit=0 swidth=0 blks
  57. naming =version 2 bsize=4096 ascii-ci=0 ftype=0
  58. log =internal log bsize=4096 blocks=2560, version=2
  59. = sectsz=512 sunit=0 blks, lazy-count=1
  60. realtime =none extsz=4096 blocks=0, rtextents=0
  61. [root@xserver1 ~]# mount /dev/mapper/xcloudvg-xcloudlv /mnt/

5、openstack管理(80分)

使用VMWare创建两台CentOS7.2的操作系统,自行配置网络与IP,使用提供的软件包,安装OpenStack平台。安装完成后,使用curl命令查询http://192.168.100.10/dashboard/auth/login/。将curl命令的查询结果以文本形式提交到答题框。

  1. 准备工作:
  2. 创建两台CentOS7的系统,添加两块网卡(仅主机和net8),磁盘给个100就行了,一台controller节点仅主机地址:192.168.100.10,net8地址:192.168.200.10
  3. compute节点仅主机地址:192.168.100.20,net8地址:192.168.200.20
  4. controller和compute
  5. 设置controller主机名:
  6. [root@localhost ~]# hostnamectl set-hostname controller
  7. 生效主机名:
  8. [root@localhost ~]# bash
  9. 设置compute主机名:
  10. [root@localhost ~]# hostnamectl set-hostname compute
  11. 生效主机名:
  12. [root@localhost ~]# bash
  13. 设置域名解析配置/etc/hosts文件添加两行内容(controller)
  14. [root@controller ~]# vi /etc/hosts
  15. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  16. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  17. 192.168.100.10 controller
  18. 192.168.100.20 compute
  19. 设置域名解析配置/etc/hosts文件添加两行内容(compute
  20. [root@compute ~]# vi /etc/hosts
  21. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  22. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  23. 192.168.100.10 controller
  24. 192.168.100.20 compute
  25. controller:
  26. controller节点作为本地yum源在/etc/yum.repos.d/创建localhost.repo源文件,删除原来源
  27. [root@controller ~]# rm -rf /etc/yum.repos.d/*
  28. [root@controller ~]# vi /etc/yum.repos.d/local.repo
  29. [centos]
  30. name=centos
  31. baseurl=file:///opt/centos
  32. gpgcheck=0
  33. enabled=1
  34. [iaas]
  35. name=iaas
  36. baseurl=file:///opt/iaas-repo
  37. gpgcheck=0
  38. enabled=1
  39. 挂载镜像到指定创建的目录
  40. [root@controller ~]# mkdir /opt/{centos,iaas}
  41. [root@controller ~]# mount -o loop CentOS-7-x86_64-DVD-1511.iso /opt/centos
  42. mount: /dev/loop1 is write-protected, mounting read-only
  43. [root@controller ~]# mount -o loop XianDian-IaaS-v2.2.iso /opt/iaas
  44. mount: /dev/loop2 is write-protected, mounting read-only
  45. 安装vsftpd服务配置vsftpd文件/etc/vsftpd/vsftpd.conf添加anon_root=/opt,并重启服务
  46. [root@controller ~]# yum install -y vsftpd
  47. [root@controller ~]# vim /etc/vsftpd/vsftpd.conf
  48. anon_root=/opt
  49. [root@controller ~]# systemctl restart vsftpd
  50. [root@controller ~]# systemctl enable vsftpd
  51. Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
  52. 关闭防火墙与配置/etc/selinux/conf设置为SELINUX=disabled
  53. [root@controller ~]# systemctl stop firewalld
  54. [root@controller ~]# systemctl disable firewalld
  55. [root@controller ~]# vim /etc/selinux/config
  56. # This file controls the state of SELinux on the system.
  57. # SELINUX=permissive
  58. # enforcing - SELinux security policy is enforced.
  59. # permissive - SELinux prints warnings instead of enforcing.
  60. # disabled - No SELinux policy is loaded.
  61. SELINUX=disabled
  62. # SELINUXTYPE= can take one of three two values:
  63. # targeted - Targeted processes are protected,
  64. # minimum - Modification of targeted policy. Only selected processes are protected.
  65. # mls - Multi Level Security protection.
  66. SELINUXTYPE=targeted
  67. 在controller节点配置就行了
  68. 先安装脚本文件,然后编辑环境变量文件/etc/xiandian/openrc.sh
  69. [root@controller ~]# yum install -y iaas-xiandian
  70. [root@controller ~]# vim /etc/xiandian/openrc.sh
  71. ##--------------------system Config--------------------##
  72. ##Controller Server Manager IP. example:x.x.x.x
  73. HOST_IP=192.168.100.10 #controller节点IP
  74. ##Controller Server hostname. example:controller
  75. HOST_NAME=controller #controller节点主机名
  76. ##Compute Node Manager IP. example:x.x.x.x
  77. HOST_IP_NODE=192.168.100.20 #compute节点IP
  78. ##Compute Node hostname. example:compute
  79. HOST_NAME_NODE=compute #compute节点主机名
  80. ##--------------------Rabbit Config ------------------##
  81. ##user for rabbit. example:openstack
  82. RABBIT_USER=openstack #rabbit用户名字
  83. ##Password for rabbit user .example:000000
  84. RABBIT_PASS=000000 #rabbit用户的密码
  85. ##--------------------MySQL Config---------------------##
  86. ##Password for MySQL root user . exmaple:000000
  87. DB_PASS=000000 #数据库root用户密码
  88. ##--------------------Keystone Config------------------##
  89. ##Password for Keystore admin user. exmaple:000000
  90. DOMAIN_NAME=demo #域名字
  91. ADMIN_PASS=000000 #keystone中admin用户密码
  92. DEMO_PASS=000000 #域的密码
  93. ##Password for Mysql keystore user. exmaple:000000
  94. KEYSTONE_DBPASS=000000 #数据库中keystone的密码
  95. ##--------------------Glance Config--------------------##
  96. ##Password for Mysql glance user. exmaple:000000
  97. GLANCE_DBPASS=000000 #数据库中glance的密码
  98. ##Password for Keystore glance user. exmaple:000000
  99. GLANCE_PASS=000000 #keystone中glance用户密码
  100. ##--------------------Nova Config----------------------##
  101. ##Password for Mysql nova user. exmaple:000000
  102. NOVA_DBPASS=000000 #数据库中nova的密码
  103. ##Password for Keystore nova user. exmaple:000000
  104. NOVA_PASS=000000 #keystone中nova用户密码
  105. ##--------------------Neturon Config-------------------##
  106. ##Password for Mysql neutron user. exmaple:000000
  107. NEUTRON_DBPASS=000000 #数据库中neutron的密码
  108. ##Password for Keystore neutron user. exmaple:000000
  109. NEUTRON_PASS=000000 #keystone中neutron用户密码
  110. ##metadata secret for neutron. exmaple:000000
  111. METADATA_SECRET=000000 #元数据密码
  112. ##External Network Interface. example:eth1
  113. INTERFACE_NAME=eno33554960 #外部网卡nat(net8)名称
  114. ##First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
  115. minvlan=101 #虚拟局域网第一个RANGE模式ID
  116. ##Last Vlan ID in VLAN RANGE for VLAN Network. example:200
  117. maxvlan=200 #虚拟局域网最后一个RANGE模式ID
  118. ##--------------------Cinder Config--------------------##
  119. ##Password for Mysql cinder user. exmaple:000000
  120. CINDER_DBPASS=000000 #数据库中cinder的密码
  121. ##Password for Keystore cinder user. exmaple:000000
  122. CINDER_PASS=000000 #keystone中cinder用户密码
  123. ##Cinder Block Disk. example:md126p3
  124. BLOCK_DISK=sdb #空白的分区名称(未使用的硬盘)
  125. ##--------------------Trove Config--------------------##
  126. ##Password for Mysql Trove User. exmaple:000000
  127. TROVE_DBPASS=000000 #数据库中Trove的密码
  128. ##Password for Keystore Trove User. exmaple:000000
  129. TROVE_PASS=000000 #keystone中Trove用户密码
  130. ##--------------------Swift Config---------------------##
  131. ##Password for Keystore swift user. exmaple:000000
  132. SWIFT_PASS=000000 #keystone中swift用户密码
  133. ##The NODE Object Disk for Swift. example:md126p4.
  134. OBJECT_DISK=sdc #空白的分区名称(未使用的硬盘)
  135. ##The NODE IP for Swift Storage Network. example:x.x.x.x.
  136. STORAGE_LOCAL_NET_IP=192.168.100.10 #swift节点IP
  137. ##--------------------Heat Config----------------------##
  138. ##Password for Mysql heat user. exmaple:000000
  139. HEAT_DBPASS=000000 #数据库中heat的密码
  140. ##Password for Keystore heat user. exmaple:000000
  141. HEAT_PASS=000000 #keystone中heat用户密码
  142. ##--------------------Ceilometer Config----------------##
  143. ##Password for Mysql ceilometer user. exmaple:000000
  144. CEILOMETER_DBPASS=000000 #数据库中ceilometer的密码
  145. ##Password for Keystore ceilometer user. exmaple:000000
  146. CEILOMETER_PASS=000000 #keystone中ceilometer用户密码
  147. ##--------------------AODH Config----------------##
  148. ##Password for Mysql AODH user. exmaple:000000
  149. AODH_DBPASS=000000 #数据库中AODH的密码
  150. ##Password for Keystore AODH user. exmaple:000000
  151. AODH_PASS=000000 #keystone中AODH用户密码
  152. # 将已经配置好的环境变量文件传输到compute节点这样就不用在配置一次了
  153. [root@controller ~]# scp /etc/xiandian/openrc.sh 192.168.200.20:/etc/xiandian/
  154. The authenticity of host '192.168.200.20 (192.168.200.20)' can't be established.
  155. ECDSA key fingerprint is 6e:45:7c:82:2c:6c:84:af:7e:16:72:51:e6:fd:af:a9.
  156. Are you sure you want to continue connecting (yes/no)? yes
  157. Warning: Permanently added '192.168.200.20' (ECDSA) to the list of known hosts.
  158. root@192.168.200.20's password: #这里密码的compute节点的登录密码
  159. openrc.sh
  160. 执行脚本(顺序别乱了)
  161. [root@controller ~]# iaas-pre-host.sh #该脚本意思是配置准备环境
  162. # 执行上面第一个脚本后重启centos系统
  163. [root@controller ~]# iaas-install-mysql.sh #安装并配置mysql数据库服务
  164. [root@controller ~]# iaas-install-keystone.sh #安装并配置keystone认证服务
  165. [root@controller ~]# iaas-install-glance.sh #安装并配置glance镜像服务
  166. [root@controller ~]# iaas-install-nova-controller.sh #安装并配置nova计算服务
  167. [root@controller ~]# iaas-install-neutron-controller.sh #安装并配置neutron网络服务
  168. [root@controller ~]# iaas-install-neutron-controller-gre.sh #安装neutron的一种网络模式
  169. [root@controller ~]# iaas-install-cinder-controller.sh #安装并配置cinder快存储服务
  170. [root@controller ~]# iaas-install-swift-controller.sh #安装并配置swift对象存储服务
  171. [root@controller ~]# iaas-install-dashboard.sh #安装并配置dashboard仪表盘
  172. compute
  173. 配置ftp源
  174. [root@compute ~]# rm -rf /etc/yum.repos.d/*
  175. [root@compute ~]# vi /etc/yum.repos.d/local.repo
  176. [centos]
  177. name=centos
  178. baseurl=ftp://192.168.100.10/centos
  179. gpgcheck=0
  180. enabled=1
  181. [iaas]
  182. name=iaas
  183. baseurl=ftp://192.168.100.10/iaas/iaas-repo
  184. gpgcheck=0
  185. enabled=1
  186. 关闭防火墙与配置/etc/selinux/conf设置为SELINUX=disabled
  187. [root@compute ~]# systemctl stop firewalld
  188. [root@compute ~]# systemctl disable firewalld
  189. [root@compute ~]# vim /etc/selinux/config
  190. # This file controls the state of SELinux on the system.
  191. # SELINUX=permissive
  192. # enforcing - SELinux security policy is enforced.
  193. # permissive - SELinux prints warnings instead of enforcing.
  194. # disabled - No SELinux policy is loaded.
  195. SELINUX=disabled
  196. # SELINUXTYPE= can take one of three two values:
  197. # targeted - Targeted processes are protected,
  198. # minimum - Modification of targeted policy. Only selected processes are protected.
  199. # mls - Multi Level Security protection.
  200. SELINUXTYPE=targeted
  201. 执行脚本(顺序别乱了)
  202. [root@compute~]# iaas-pre-host.sh #该脚本意思是配置准备环境
  203. # 执行上面第一个脚本后重启centos系统
  204. [root@compute~]# iaas-install-nova-compute.sh #安装并配置nova计算服务
  205. [root@compute~]# iaas-install-neutron-compute.sh #安装并配置neutron网络服务
  206. [root@compute~]# iaas-install-neutron-compute-gre.sh #安装neutron的一种网络模式
  207. [root@compute~]# iaas-install-cinder-compute.sh #安装并配置cinder快存储服务
  208. [root@compute~]# iaas-install-swift-compute.sh #安装并配置swift对象存储服务
  209. 到这里OpenStack脚本部署完成
  210. (以下命令和结果是提交答案)
  211. [root@controller ~]# curl http://192.168.100.10/dashboard/auth/login/

6、Docker管理(80分)

假设当前存在docker镜像mysql:latest,将该镜像上传至本地,然后将该镜像推送至本地仓库(假设仓库地址为192.168.100.100:5000),从私有仓库中拉取mariadb:v10.3.18镜像。运行mysql镜像,要求将内部3306端口映射到外部的13306端口,提供交互接口,后台运行,容器名为xmysql。最后将mysql镜像和创建的容器删除。依次提交操作命令。

  1. [root@master ~]# docker load -i ./images/mysql:latest
  2. [root@master ~]# docker tag mysql:latest 192.168.100.100:5000/mysql:latest
  3. [root@master ~]# docker push 192.168.100.100:5000/mysql:latest
  4. [root@master ~]# docker pull 192.168.100.100:5000/mariadb:v10.3.18
  5. [root@master ~]# docker run -p 13306:3306 -it -d --name xmysql mysql:latest
  6. a80bc41e564a4377755fcc13cd9b06abc954839b1203fce8614133578b9b2939
  7. [root@master ~]# docker rmi 192.168.100.100:5000/mysql:latest
  8. [root@master ~]# docker rm -f xmysql

7、WordPress应用系统(80分)

使用提供的软件包和vmware提供的centos7.2操作系统,完成LNMP+WordPress部署。部署完成后,进行登录,最后提交WordPress首页和后台管理界面。(设置WordPress名称为自己的姓名+BLOG,例如张三,则WordPress首页显示张三BLOG,答案的截图需体现这点)

# lnmp+wordpress实验只在xserver1上一台虚拟机做即可

  1. 1、关闭防火墙和selinux
  2. [root@localhost ~]# systemctl stop firewalld
  3. [root@localhost ~]# setenforce 0
  4. 2、配置yum源
  5. [root@localhost ~]# rm -rf /etc/yum.repos.d/CentOS-*
  6. [root@localhost ~]# mkdir /opt/centos
  7. [root@localhost ~]# mount -o loop CentOS-7-x86_64-DVD-1511.iso /opt/centos/
  8. mount: /dev/loop0 is write-protected, mounting read-only
  9. [root@localhost ~]# vi /etc/yum.repos.d/local.repo
  10. [centos]
  11. name=centos
  12. baseurl=file:///opt/centos
  13. enabled=1
  14. gpgcheck=0
  15. [lnmp]
  16. name=lnmp
  17. baseurl=file:///root/lnmp
  18. enabled=1
  19. gpgcheck=0
  20. [root@localhost ~]# yum repolist
  21. 3、安装nginx,配置nginx,重启nginx
  22. [root@localhost ~]# yum install -y nginx
  23. [root@localhost ~]# vi /etc/nginx/conf.d/default.conf
  24. location / {
  25. root /usr/share/nginx/html;
  26. index index.html index.htm index.php; # 在"location /"index后加index.php
  27. }
  28. ......
  29. # 把location ~ \.php$ 那几行#注释删除,fastcgi_param那行$符号前面改为/usr/share/nginx/html
  30. location ~ \.php$ {
  31. root html;
  32. fastcgi_pass 127.0.0.1:9000;
  33. fastcgi_index index.php;
  34. fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
  35. include fastcgi_params;
  36. }
  37. [root@localhost ~]# systemctl restart nginx
  38. 4、安装mariadb数据库并配置
  39. [root@localhost ~]# yum install -y mariadb maraidb-server
  40. [root@localhost ~]# systemctl restart mariadb
  41. [root@localhost ~]# mysql_secure_installation # 初始化数据库
  42. [root@localhost ~]# mysql -uroot -p000000
  43. MariaDB [(none)]> create database lnmp;
  44. MariaDB [(none)]> grant all privileges on *.* to root@'%' identified by '000000' ;
  45. Query OK, 0 rows affected (0.00 sec)
  46. 5、安装php并配置
  47. [root@localhost ~]# yum install -y php-fpm php-mysql
  48. [root@localhost ~]# vi /etc/php-fpm.d/www.conf
  49. ...... # 找到user=group= , 把它们改成user=nginx,group=nginx
  50. user = nginx
  51. group = nginx
  52. [root@localhost ~]# systemctl restart php-fpm
  53. 6、配置wordpress
  54. [root@localhost ~]# yum install -y unzip
  55. [root@localhost ~]# unzip wordpress-4.7.3-zh_CN.zip
  56. [root@localhost ~]# rm -rf /usr/share/nginx/html/*
  57. [root@localhost ~]# cp -rvf wordpress/* /usr/share/nginx/html/
  58. [root@localhost ~]# chown -R nginx:nginx /usr/share/nginx/html/
  59. [root@localhost ~]# cd /usr/share/nginx/html/
  60. [root@localhost html]# vi wp-config.php
  61. // ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
  62. /** WordPress数据库的名称 */
  63. define('DB_NAME', 'lnmp'); # 数据库名称改为lnmp(上面配置mariadb时创建的数据库)
  64. /** MySQL数据库用户名 */
  65. define('DB_USER', 'root'); # 数据库用户名改为root
  66. /** MySQL数据库密码 */
  67. define('DB_PASSWORD', '000000'); # 数据库密码改为上面初始化数据库时候配置的密码
  68. 7、然后打开浏览器访问你的 IP 地址,配置题目要求的站点标题,配置完成

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/192032
推荐阅读
相关标签
  

闽ICP备14008679号