1+X云计算平台运维与开发认证(初级)样卷A(含答案)

单选题(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。(使用完整命令)

[Huawei]vlan batch 2 3 1004

[Huawei]port-group 1
[Huawei-port-group-1]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/5
[Huawei-port-group-1]port link-type access
[Huawei-port-group-1]port default vlan 2

[Huawei]interface GigabitEthernet 0/0/10
[Huawei-GigabitEthernet0/0/10]port link-type trunk
[Huawei-GigabitEthernet0/0/10]port trunk allow-pass vlan 3

[Huawei]interface Vlanif 2
[Huawei-Vlanif2]ip address 172.16.2.1 24

[Huawei]interface Vlanif 1004
[Huawei-Vlanif1004]ip address 192.168.4.2 30

[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文件的内容以文本形式提交到答题框。

[root@xserver1 ~]# cat /etc/yum.repos.d/local.repo

[centos]
name=centos
baseurl=file:///opt/centos
enabled=1
gpgcheck=0

[iaas]
name=iaas
baseurl=ftp://192.168.100.200/iaas 
enabled=1
gpgcheck=0

3、数据库管理(70分)

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

Xserver1:
[root@xserver1 ~]# yum install -y mariadb mariadb-server

[root@xserver1 ~]# vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.30  xserver1
192.168.200.40  xserver2

[root@xserver1 ~]# systemctl restart mariadb
[root@xserver1 ~]# mysql_secure_installation 
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

[root@xserver1 ~]# vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
log_bin = mysql-bin	
binlog_ignore_db = mysql
server_id = 30

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

[root@xserver2 ~]# systemctl restart mariadb
[root@xserver1 ~]# mysql -uroot -p000000
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 5.5.44-MariaDB-log MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> grant all privileges on *.* to root@'%' identified by '000000';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant replication slave on *.* to 'user'@'xserver2' identified by '000000';
Query OK, 0 rows affected (0.00 sec)


Xserver2:
[root@xserver2 ~]# yum install -y mariadb mariadb-server

[root@xserver2 ~]# vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.200.30  xserver1
192.168.200.40  xserver2

[root@xserver2 ~]# systemctl restart mariadb
[root@xserver2 ~]# mysql_secure_installation 
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

[root@xserver2 ~]# systemctl restart mariadb
[root@xserver2 ~]# vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
log_bin = mysql-bin
binlog_ignore_db = mysql
server_id = 40

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

[root@xserver2 ~]# systemctl restart mariadb
[root@xserver2 ~]# mysql -uroot -p000000
MariaDB [(none)]> change master to master_host='xserver1',master_user='user',master_password='000000';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> start slave;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> show slave status\G 
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: xserver1
                  Master_User: user
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000001
          Read_Master_Log_Pos: 606
               Relay_Log_File: mariadb-relay-bin.000002
                Relay_Log_Pos: 890
        Relay_Master_Log_File: mysql-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 606
              Relay_Log_Space: 1186
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 30
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目录下。将上述所有操作命令和返回结果以文本形式提交到答题框。

[root@xserver1 ~]# fdisk /dev/sdb 
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xd41e2ca5.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 
First sector (2048-41943039, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039): +5G
Partition 1 of type Linux and of size 5 GiB is set

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): 
Using default response p
Partition number (2-4, default 2): 
First sector (10487808-41943039, default 10487808): 
Using default value 10487808
Last sector, +sectors or +size{K,M,G} (10487808-41943039, default 41943039): +5G
Partition 2 of type Linux and of size 5 GiB is set

Command (m for help): n
Partition type:
   p   primary (2 primary, 0 extended, 2 free)
   e   extended
Select (default p): 
Using default response p
Partition number (3,4, default 3): 
First sector (20973568-41943039, default 20973568): 
Using default value 20973568
Last sector, +sectors or +size{K,M,G} (20973568-41943039, default 41943039): +5G
Partition 3 of type Linux and of size 5 GiB is set

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

[root@xserver1 ~]# pvcreate /dev/sdb[1-3]
  Physical volume "/dev/sdb1" successfully created
  Physical volume "/dev/sdb2" successfully created
  Physical volume "/dev/sdb3" successfully created

[root@xserver1 ~]# vgcreate xcloudvg /dev/sdb[1-3]
  Volume group "xcloudvg" successfully created

[root@xserver1 ~]# lvcreate -L +12G -n xcloudlv xcloudvg
  Logical volume "xcloudlv" created.

[root@xserver1 ~]# mkfs.xfs /dev/mapper/xcloudvg-xcloudlv 
meta-data=/dev/mapper/xcloudvg-xcloudlv isize=256    agcount=4, agsize=786432 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0        finobt=0
data     =                       bsize=4096   blocks=3145728, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

[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命令的查询结果以文本形式提交到答题框。

准备工作:
创建两台CentOS7的系统,添加两块网卡(仅主机和net8),磁盘给个100就行了,一台controller节点仅主机地址:192.168.100.10,net8地址:192.168.200.10
compute节点仅主机地址:192.168.100.20,net8地址:192.168.200.20

controller和compute:
设置controller主机名:
[root@localhost ~]# hostnamectl set-hostname controller
生效主机名:
[root@localhost ~]# bash

设置compute主机名:
[root@localhost ~]# hostnamectl set-hostname compute
生效主机名:
[root@localhost ~]# bash


设置域名解析配置/etc/hosts文件添加两行内容(controller)
[root@controller ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.10 controller
192.168.100.20 compute

设置域名解析配置/etc/hosts文件添加两行内容(compute)
[root@compute ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.10 controller
192.168.100.20 compute



controller:
controller节点作为本地yum源在/etc/yum.repos.d/创建localhost.repo源文件,删除原来源
[root@controller ~]# rm -rf /etc/yum.repos.d/*
[root@controller ~]# vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/iaas-repo
gpgcheck=0
enabled=1

挂载镜像到指定创建的目录
[root@controller ~]# mkdir /opt/{centos,iaas}
[root@controller ~]# mount -o loop CentOS-7-x86_64-DVD-1511.iso  /opt/centos
mount: /dev/loop1 is write-protected, mounting read-only
[root@controller ~]# mount -o loop XianDian-IaaS-v2.2.iso  /opt/iaas
mount: /dev/loop2 is write-protected, mounting read-only

安装vsftpd服务配置vsftpd文件/etc/vsftpd/vsftpd.conf添加anon_root=/opt,并重启服务
[root@controller ~]# yum install -y vsftpd
[root@controller ~]# vim /etc/vsftpd/vsftpd.conf 
anon_root=/opt
[root@controller ~]# systemctl restart vsftpd
[root@controller ~]# systemctl enable vsftpd	
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.

关闭防火墙与配置/etc/selinux/conf设置为SELINUX=disabled
[root@controller ~]# systemctl stop firewalld
[root@controller ~]# systemctl disable firewalld
[root@controller ~]# vim /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX=permissive
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

在controller节点配置就行了
先安装脚本文件,然后编辑环境变量文件/etc/xiandian/openrc.sh
[root@controller ~]# yum install -y iaas-xiandian
[root@controller ~]# vim /etc/xiandian/openrc.sh 
##--------------------system Config--------------------##
##Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.100.10						#controller节点IP

##Controller Server hostname. example:controller
HOST_NAME=controller							#controller节点主机名

##Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=192.168.100.20					#compute节点IP

##Compute Node hostname. example:compute
HOST_NAME_NODE=compute					#compute节点主机名

##--------------------Rabbit Config ------------------##
##user for rabbit. example:openstack							
RABBIT_USER=openstack						#rabbit用户名字

##Password for rabbit user .example:000000
RABBIT_PASS=000000							#rabbit用户的密码

##--------------------MySQL Config---------------------##
##Password for MySQL root user . exmaple:000000
DB_PASS=000000								#数据库root用户密码

##--------------------Keystone Config------------------##
##Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=demo							#域名字
ADMIN_PASS=000000							#keystone中admin用户密码
DEMO_PASS=000000							#域的密码

##Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=000000						#数据库中keystone的密码

##--------------------Glance Config--------------------##
##Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=000000						#数据库中glance的密码

##Password for Keystore glance user. exmaple:000000
GLANCE_PASS=000000							#keystone中glance用户密码

##--------------------Nova Config----------------------##
##Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=000000							#数据库中nova的密码

##Password for Keystore nova user. exmaple:000000
NOVA_PASS=000000							#keystone中nova用户密码

##--------------------Neturon Config-------------------##
##Password for Mysql neutron user. exmaple:000000
NEUTRON_DBPASS=000000						#数据库中neutron的密码

##Password for Keystore neutron user. exmaple:000000
NEUTRON_PASS=000000						#keystone中neutron用户密码

##metadata secret for neutron. exmaple:000000
METADATA_SECRET=000000						#元数据密码

##External Network Interface. example:eth1
INTERFACE_NAME=eno33554960					#外部网卡nat(net8)名称

##First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
minvlan=101									#虚拟局域网第一个RANGE模式ID

##Last Vlan ID in VLAN RANGE for VLAN Network. example:200
maxvlan=200									#虚拟局域网最后一个RANGE模式ID

##--------------------Cinder Config--------------------##
##Password for Mysql cinder user. exmaple:000000
CINDER_DBPASS=000000						#数据库中cinder的密码

##Password for Keystore cinder user. exmaple:000000
CINDER_PASS=000000							#keystone中cinder用户密码

##Cinder Block Disk. example:md126p3
BLOCK_DISK=sdb								#空白的分区名称(未使用的硬盘)

##--------------------Trove Config--------------------##
##Password for Mysql Trove User. exmaple:000000
TROVE_DBPASS=000000						#数据库中Trove的密码

##Password for Keystore Trove User. exmaple:000000
TROVE_PASS=000000							#keystone中Trove用户密码

##--------------------Swift Config---------------------##
##Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000							#keystone中swift用户密码

##The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=sdc								#空白的分区名称(未使用的硬盘)

##The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.100.10			#swift节点IP

##--------------------Heat Config----------------------##
##Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=000000							#数据库中heat的密码

##Password for Keystore heat user. exmaple:000000
HEAT_PASS=000000							#keystone中heat用户密码

##--------------------Ceilometer Config----------------##
##Password for Mysql ceilometer user. exmaple:000000
CEILOMETER_DBPASS=000000					#数据库中ceilometer的密码

##Password for Keystore ceilometer user. exmaple:000000
CEILOMETER_PASS=000000						#keystone中ceilometer用户密码

##--------------------AODH Config----------------##
##Password for Mysql AODH user. exmaple:000000
AODH_DBPASS=000000							#数据库中AODH的密码

##Password for Keystore AODH user. exmaple:000000
AODH_PASS=000000							#keystone中AODH用户密码

 # 将已经配置好的环境变量文件传输到compute节点这样就不用在配置一次了
[root@controller ~]# scp /etc/xiandian/openrc.sh 192.168.200.20:/etc/xiandian/
The authenticity of host '192.168.200.20 (192.168.200.20)' can't be established.
ECDSA key fingerprint is 6e:45:7c:82:2c:6c:84:af:7e:16:72:51:e6:fd:af:a9.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.200.20' (ECDSA) to the list of known hosts.
root@192.168.200.20's password: 			#这里密码的compute节点的登录密码
openrc.sh    

执行脚本(顺序别乱了)   
[root@controller ~]# iaas-pre-host.sh				        #该脚本意思是配置准备环境
# 执行上面第一个脚本后重启centos系统

[root@controller ~]# iaas-install-mysql.sh			    	#安装并配置mysql数据库服务
[root@controller ~]# iaas-install-keystone.sh		     	#安装并配置keystone认证服务
[root@controller ~]# iaas-install-glance.sh				    #安装并配置glance镜像服务
[root@controller ~]# iaas-install-nova-controller.sh		#安装并配置nova计算服务
[root@controller ~]# iaas-install-neutron-controller.sh 	#安装并配置neutron网络服务
[root@controller ~]# iaas-install-neutron-controller-gre.sh #安装neutron的一种网络模式 
[root@controller ~]# iaas-install-cinder-controller.sh		#安装并配置cinder快存储服务
[root@controller ~]# iaas-install-swift-controller.sh		#安装并配置swift对象存储服务

[root@controller ~]# iaas-install-dashboard.sh			    #安装并配置dashboard仪表盘  



compute:
配置ftp源
[root@compute ~]# rm -rf /etc/yum.repos.d/*
[root@compute ~]# vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=ftp://192.168.100.10/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://192.168.100.10/iaas/iaas-repo
gpgcheck=0
enabled=1
关闭防火墙与配置/etc/selinux/conf设置为SELINUX=disabled
[root@compute ~]# systemctl stop firewalld
[root@compute ~]# systemctl disable firewalld
[root@compute ~]# vim /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX=permissive
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

执行脚本(顺序别乱了)
[root@compute~]# iaas-pre-host.sh				        #该脚本意思是配置准备环境
# 执行上面第一个脚本后重启centos系统

[root@compute~]# iaas-install-nova-compute.sh		    #安装并配置nova计算服务
[root@compute~]# iaas-install-neutron-compute.sh	 	#安装并配置neutron网络服务
[root@compute~]# iaas-install-neutron-compute-gre.sh    #安装neutron的一种网络模式 
[root@compute~]# iaas-install-cinder-compute.sh		    #安装并配置cinder快存储服务
[root@compute~]# iaas-install-swift-compute.sh		    #安装并配置swift对象存储服务   

到这里OpenStack脚本部署完成

(以下命令和结果是提交答案)
[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镜像和创建的容器删除。依次提交操作命令。

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

7、WordPress应用系统(80分)

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

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

1、关闭防火墙和selinux
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0

2、配置yum源
[root@localhost ~]# rm -rf /etc/yum.repos.d/CentOS-* 
[root@localhost ~]# mkdir /opt/centos
[root@localhost ~]# mount -o loop CentOS-7-x86_64-DVD-1511.iso /opt/centos/
mount: /dev/loop0 is write-protected, mounting read-only
[root@localhost ~]# vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=file:///opt/centos
enabled=1
gpgcheck=0
[lnmp]
name=lnmp
baseurl=file:///root/lnmp
enabled=1
gpgcheck=0

[root@localhost ~]# yum repolist 

3、安装nginx,配置nginx,重启nginx
[root@localhost ~]# yum install -y nginx
[root@localhost ~]# vi /etc/nginx/conf.d/default.conf 
    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm index.php;  # 在"location /"的index后加index.php
    }

    ...... 
# 把location ~ \.php$ 那几行#注释删除,fastcgi_param那行$符号前面改为/usr/share/nginx/html
    location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;
        include        fastcgi_params;
    }

[root@localhost ~]# systemctl restart nginx

4、安装mariadb数据库并配置
[root@localhost ~]# yum install -y mariadb maraidb-server
[root@localhost ~]# systemctl restart mariadb
[root@localhost ~]# mysql_secure_installation  # 初始化数据库
[root@localhost ~]# mysql -uroot -p000000
MariaDB [(none)]> create database lnmp;    
MariaDB [(none)]> grant all privileges on *.* to root@'%' identified by '000000' ;
Query OK, 0 rows affected (0.00 sec)

5、安装php并配置
[root@localhost ~]# yum install -y php-fpm php-mysql
[root@localhost ~]# vi /etc/php-fpm.d/www.conf 
......  # 找到user= 和 group=  , 把它们改成user=nginx,group=nginx

user = nginx 
group = nginx

[root@localhost ~]# systemctl restart php-fpm

6、配置wordpress
[root@localhost ~]# yum install -y unzip 
[root@localhost ~]# unzip wordpress-4.7.3-zh_CN.zip 
[root@localhost ~]# rm -rf /usr/share/nginx/html/*
[root@localhost ~]# cp -rvf  wordpress/* /usr/share/nginx/html/
[root@localhost ~]# chown -R  nginx:nginx  /usr/share/nginx/html/
[root@localhost ~]# cd /usr/share/nginx/html/
[root@localhost html]# vi wp-config.php
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'lnmp');        # 数据库名称改为lnmp(上面配置mariadb时创建的数据库)

/** MySQL数据库用户名 */
define('DB_USER', 'root');        # 数据库用户名改为root

/** MySQL数据库密码 */
define('DB_PASSWORD', '000000');  # 数据库密码改为上面初始化数据库时候配置的密码


7、然后打开浏览器访问你的 IP 地址,配置题目要求的站点标题,配置完成



  • 9
    点赞
  • 74
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值