通过OSS和ROS创建Sharepoint 2013

资源编排ROS支持在模板中定义所需的阿里云资源(例如ECS实例、RDS数据库实例)、资源间的依赖关系等。ROS的编排引擎将根据模板自动完成所有资源的创建和配置,实现自动化部署及运维。本文介绍如何通过OSS以及ROS服务快速创建Sharepoint 2013。

说明

本文示例由阿里云用户肖伊提供,仅供参考。

前提条件

步骤一:在Bucket中上传sharepoint.exe文件

  1. 登录OSS管理控制台

  2. 单击Bucket 列表,然后单击目标Bucket名称。

  3. 在左侧导航栏,选择文件管理 > 文件列表

  4. 上传已下载的sharepoint.exe文件。

    上传时,将文件ACL设置为公共读,其他参数保留默认配置,关于上传文件的具体步骤,请参见上传文件

  5. 获取文件URL。

    文件上传完成后,单击sharepoint.exe文件右侧的详情,然后单击复制文件URLfileurl

步骤二:通过ROS新建资源栈

  1. 选择模板。

    1. 登录资源编排控制台

    2. 在左侧导航栏,单击资源栈

    3. 在页面左上角的地域下拉列表,选择华东1(杭州)

    4. 资源栈列表页面,单击创建资源栈,然后在下拉列表中选择使用ROS

    5. 选择模板页面,指定模板为选择已有模板、模板录入方式选择输入模板、在ROS模板内容的JSON页签输入以下内容,然后单击下一步

      {
        "ROSTemplateFormatVersion": "2015-09-01",
        "Description": "One simple ECS instance with SharePoint Foundation2013, default image is win2008r2_sp1_x64_ent_zh-cn_40G_alibase_20200116.vhd,The user needs to specify the instance type ",
        "Parameters": {
          "VpcCidrBlock": {
            "Type": "String",
            "Description": {
              "en": "The IP address range of the VPC in the CIDR Block form; <br>you can use the following IP address ranges: <br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>",
              "zh-cn": "专有网络IP地址段范围,<br>您可以使用以下的IP地址段:<br><font color='green'>[10.0.0.0/8]</font><br><font color='green'>[172.16.0.0/12]</font><br><font color='green'>[192.168.0.0/16]</font>"
            },
            "AllowedValues": [
              "192.168.0.0/16",
              "172.16.0.0/12",
              "10.0.0.0/8"
            ],
            "Label": {
              "en": "VPC CIDR Block",
              "zh-cn": "专有网络网段"
            },
            "Default": "192.168.0.0/16"
          },
          "VSwitchCidrBlock": {
            "Type": "String",
            "Description": {
              "zh-cn": "创建的虚拟交换机的子网,必须是所属专有网络的子网段,并且没有被其他交换机占用。",
              "en": "Subnet of the created virtual switch,must be a sub-network segment of the proprietary network and is not occupied by other VSwitches."
            },
            "Label": {
              "zh-cn": "交换机网段",
              "en": "VSwitch CIDR Block"
            },
            "Default": "192.168.0.0/16"
          },
          "ZoneId": {
            "Type": "String",
            "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId",
            "Description": {
              "en": "Availability zone ID,<br><b>note: <font color='blue'>Before selecting, please confirm that the Availability Zone supports the specification of creating ECS resources</font></b>",
              "zh-cn": "可用区ID,<br><b>注: <font color='blue'>选择可用区前请确认该可用区是否支持创建ECS资源的规格</font></b>"
            },
            "Label": {
              "zh-cn": "交换机可用区",
              "en": "VSwitch Available Zone"
            }
          },
          "SharePointDownloadPath": {
            "Label": {
              "zh-cn": "SharePoint镜像下载路径",
              "en": "SharePoint Image Download Path"
            },
            "Type": "String",
            "Description": {
              "zh-cn": "SharePoint Foundation2013镜像下载路径,详见: <a href='https://docs.microsoft.com/zh-cn/OfficeUpdates/sharepoint-updates' target='_blank'><b><font color='blue'>SharePoint Foundation2013镜像下载路径</b></font></a>",
              "en": "SharePoint Foundation2013 image download path, see detail: <a href='https://docs.microsoft.com/en-us/OfficeUpdates/sharepoint-updates' target='_blank'><b><font color='blue'>SharePoint Foundation2013 image download path</b></font></a>"
            }
          },
          "ImageId": {
            "Default": "win2008r2_sp1_x64_ent_zh-cn_40G_alibase_20200116.vhd",
            "Label": {
              "zh-cn": "镜像",
              "en": "Image ID"
            },
            "Type": "String",
            "Description": {
              "zh-cn": "镜像ID,关于SharePoint Foundation2013系统要求,详见: <a href='https://docs.microsoft.com/zh-cn/sharepoint/install/hardware-and-software-requirements-0' target='_blank'><b><font color='blue'>SharePoint Foundation2013系统要求</b></font></a>",
              "en": "Image ID, About SharePoint Foundation2013 system requirements, see detail: <a href='https://docs.microsoft.com/en-us/sharepoint/install/hardware-and-software-requirements-0' target='_blank'><b><font color='blue'>SharePoint Foundation2013 system requirements</b></font></a>"
            }
          },
          "InstanceType": {
            "Type": "String",
            "Description": {
              "zh-cn": "填写VSwitch可用区下可使用的规格;<br>通用规格:<font color='red'><b>ecs.c5.large</b></font><br>注:可用区可能不支持通用规格<br>规格详见:<a href='https://help.aliyun.com/document_detail/25378.html' target='_blank'><b><font color='blue'>实例规格族</font></a></b>",
              "en": "Fill in the specifications that can be used under the VSwitch availability zone;</b></font><br>general specifications:<font color='red'><b>ecs.c5.large</b></font><br>note: a few zones do not support general specifications<br>see detail: <a href='https://www.alibabacloud.com/help/en/doc-detail/25378.html' target='_blank'><b><font color='blue'>Instance Specification Family</font></a></b>"
            },
            "Label": {
              "zh-cn": "实例规格",
              "en": "Instance Type"
            },
            "AssociationProperty": "ALIYUN::ECS::Instance::InstanceType",
            "AssociationPropertyMetadata": {
              "ZoneId": "ZoneId"
            }
          },
          "Password": {
            "NoEcho": true,
            "Type": "String",
            "Description": {
              "en": "Server login password, Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).",
              "zh-cn": "服务器登录密码,长度为8~30个字符,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。"
            },
            "AllowedPattern": "[0-9A-Za-z\\_\\-\\&:;'<>,=%`~!@#\\(\\)\\$\\^\\*\\+\\|\\{\\}\\[\\]\\.\\?\\/]+$",
            "Label": {
              "zh-cn": "实例密码",
              "en": "Instance Password"
            },
            "ConstraintDescription": {
              "en": "Length 8-30, must contain three(Capital letters, lowercase letters, numbers, ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ Special symbol in).",
              "zh-cn": "长度为8~30个字符,必须包含三项(大写字母、小写字母、数字、 ()`~!@#$%^&*_-+=|{}[]:;'<>,.?/ 中的特殊符号)。"
            },
            "MinLength": 8,
            "MaxLength": 30
          }
        },
        "Metadata": {
          "ALIYUN::ROS::Interface": {
            "ParameterGroups": [
              {
                "Parameters": [
                  "VpcCidrBlock",
                  "VSwitchCidrBlock"
                ],
                "Label": {
                  "default": "VPC"
                }
              },
              {
                "Parameters": [
                  "ZoneId",
                  "ImageId",
                  "SharePointDownloadPath",
                  "InstanceType",
                  "Password"
                ],
                "Label": {
                  "default": "ECS"
                }
              }
            ],
            "TemplateTags": [
              "acs:example:Windows应用服务:ROS_OOS创建SharePoint2013的windows实例"
            ]
          }
        },
        "Resources": {
          "RosWaitCondition": {
            "Type": "ALIYUN::ROS::WaitCondition",
            "Properties": {
              "Timeout": 2700,
              "Count": 2,
              "Handle": {
                "Ref": "RosWaitConditionHandle"
              }
            },
            "Metadata": {
              "ALIYUN::ROS::Designer": {
                "id": "47058b03-d345-4071-bcdb-9bc2888899be"
              }
            }
          },
          "EcsVswitch": {
            "Type": "ALIYUN::ECS::VSwitch",
            "Properties": {
              "VpcId": {
                "Ref": "EcsVpc"
              },
              "ZoneId": {
                "Ref": "ZoneId"
              },
              "CidrBlock": {
                "Ref": "VSwitchCidrBlock"
              }
            },
            "Metadata": {
              "ALIYUN::ROS::Designer": {
                "id": "3f1d6b20-25eb-4a1c-a40f-1f764b157bd6"
              }
            }
          },
          "SharePointServer": {
            "Type": "ALIYUN::ECS::Instance",
            "Properties": {
              "VpcId": {
                "Ref": "EcsVpc"
              },
              "UserData": {
                "Fn::Replace": [
                  {
                    "ros-notify": {
                      "Fn::GetAtt": [
                        "RosWaitConditionHandle",
                        "PowerShellCurlCli"
                      ]
                    }
                  },
                  {
                    "Fn::Join": [
                      "",
                      [
                        "[powershell]\r\n",
                        "New-Item -Path \"C:\\Install_dir\" -Force -type directory \r\n",
                        "$ossName = 'ros-template-resources' \r\n",
                        "$client = new-object System.Net.WebClient \r\n",
                        "$client.DownloadFile(\"",
                        {
                          "Ref": "SharePointDownloadPath"
                        },
                        "\", 'C:\\Install_dir\\SharePoint.exe') \r\n",
                        "$client.DownloadFile(\"https://$ossName.oss-cn-beijing.aliyuncs.com/SharePoint/AppFabric1.1-RTM-KB2671763-x64-ENU.exe\", 'C:\\Install_dir\\AppFabric1.1-RTM-KB2671763-x64-ENU.exe')\r\n",
                        "$client.DownloadFile(\"https://$ossName.oss-cn-beijing.aliyuncs.com/SharePoint/MicrosoftIdentityExtensions-64.msi\", 'C:\\Install_dir\\MicrosoftIdentityExtensions-64.msi')\r\n",
                        "$client.DownloadFile(\"https://$ossName.oss-cn-beijing.aliyuncs.com/SharePoint/setup_msipc_x64.msi\", 'C:\\Install_dir\\setup_msipc_x64.msi')\r\n",
                        "$client.DownloadFile(\"https://$ossName.oss-cn-beijing.aliyuncs.com/SharePoint/sqlncli.msi\", 'C:\\Install_dir\\sqlncli.msi')\r\n",
                        "$client.DownloadFile(\"https://$ossName.oss-cn-beijing.aliyuncs.com/SharePoint/Synchronization.msi\", 'C:\\Install_dir\\Synchronization.msi')\r\n",
                        "$client.DownloadFile(\"https://$ossName.oss-cn-beijing.aliyuncs.com/SharePoint/WcfDataServices.exe\", 'C:\\Install_dir\\WcfDataServices.exe')\r\n",
                        "$client.DownloadFile(\"https://$ossName.oss-cn-beijing.aliyuncs.com/SharePoint/Windows6.1-KB974405-x64.msu\", 'C:\\Install_dir\\Windows6.1-KB974405-x64.msu')\r\n",
                        "$client.DownloadFile(\"https://$ossName.oss-cn-beijing.aliyuncs.com/SharePoint/WindowsServerAppFabricSetup_x64.exe\", 'C:\\Install_dir\\WindowsServerAppFabricSetup_x64.exe')\r\n",
                        "cd C:\\Install_dir \r\n",
                        "New-Item \"install_sharepoint.bat\" -type File \r\n",
                        "Add-Content install_sharepoint.bat \"C:\" \r\n",
                        "Add-Content install_sharepoint.bat 'powershell.exe C:\\Install_dir\\Install_SharePoint.ps1' \r\n",
                        "New-Item \"Install_SharePoint.ps1\" -type File \r\n",
                        "Add-Content Install_SharePoint.ps1 'if(Test-Path \"C:\\Install_dir\\finished.log\"){' \r\n",
                        "Add-Content Install_SharePoint.ps1 \"cd C:\\Install_dir \" \r\n",
                        "Add-Content Install_SharePoint.ps1 \"}else{ \" \r\n",
                        "Add-Content Install_SharePoint.ps1 'Start-Process C:\\Install_dir\\2013\\Setup.exe -args \"/config C:\\Install_dir\\2013\\Files\\SetupSilent\\config.xml\" -Wait'\r\n",
                        "Add-Content Install_SharePoint.ps1 'cd C:\\Install_dir'\r\n",
                        "Add-Content Install_SharePoint.ps1 'New-Item \"finish.log\" -type File'\r\n",
                        "Add-Content Install_SharePoint.ps1 'Remove-Item \"C:\\Install_dir\\SharePoint.exe\"' \r\n",
                        "Add-Content Install_SharePoint.ps1 'Remove-Item \"C:\\Install_dir\\2013\\*\" -recurse' \r\n",
                        "Add-Content Install_SharePoint.ps1 'schtasks /delete /TN \"install_sharepoint\" /f'\r\n",
                        "Add-Content Install_SharePoint.ps1 'ros-notify'\r\n",
                        "Add-Content Install_SharePoint.ps1 \"}\" \r\n",
                        "Start-Process C:\\Install_dir\\SharePoint.exe  -args \"/extract:C:\\Install_dir\\2013 /quiet\" -Wait \r\n",
                        "Start-Process C:\\Install_dir\\2013\\prerequisiteinstaller.exe -args \"/continue /unattended\" -Wait \r\n",
                        "Start-Process C:\\Install_dir\\2013\\prerequisiteinstaller.exe  -args \"/SQLNCli:C:\\Install_dir\\sqlncli.msi /continue /unattended\" -Wait\r\n",
                        "Start-Process C:\\Install_dir\\2013\\prerequisiteinstaller.exe  -args \"/IDFX:C:\\Install_dir\\Windows6.1-KB974405-x64.msu /continue /unattended\" -Wait\r\n",
                        "Start-Process C:\\Install_dir\\2013\\prerequisiteinstaller.exe  -args \"/Sync:C:\\Install_dir\\Synchronization.msi /continue /unattended\" -Wait\r\n",
                        "Start-Process C:\\Install_dir\\2013\\prerequisiteinstaller.exe -args \"/AppFabric:C:\\Install_dir\\WindowsServerAppFabricSetup_x64.exe /continue /unattended\" -Wait \r\n",
                        "Start-Process C:\\Install_dir\\MicrosoftIdentityExtensions-64.msi -args \"/quiet\" -Wait \r\n",
                        "Start-Process C:\\Install_dir\\2013\\prerequisiteinstaller.exe -args \"/continue /unattended\" -Wait \r\n",
                        "Start-Process C:\\Install_dir\\2013\\prerequisiteinstaller.exe -args \"/WCFDataServices:C:\\Install_dir\\WcfDataServices.exe /continue /unattended\" -Wait \r\n",
                        "Start-Process C:\\Install_dir\\2013\\prerequisiteinstaller.exe -args \"/KB2671763:C:\\Install_dir\\AppFabric1.1-RTM-KB2671763-x64-ENU.exe /continue /unattended\" -Wait\r\n",
                        "schtasks /create /TN \"install_sharepoint\" /RU administrator /RP \"",
                        {
                          "Ref": "Password"
                        },
                        "\" /SC ONSTART /TR \"C:\\Install_dir\\install_sharepoint.bat\" \r\n",
                        "ros-notify \r\n",
                        "shutdown /r /f /t 1 \r\n"
                      ]
                    ]
                  }
                ]
              },
              "SecurityGroupId": {
                "Ref": "EcsSecurityGroup"
              },
              "VSwitchId": {
                "Ref": "EcsVswitch"
              },
              "ImageId": {
                "Ref": "ImageId"
              },
              "InstanceType": {
                "Ref": "InstanceType"
              },
              "Password": {
                "Ref": "Password"
              }
            },
            "Metadata": {
              "ALIYUN::ROS::Designer": {
                "id": "62ed3480-152b-40d3-946d-4d19c0de7530"
              }
            }
          },
          "EcsVpc": {
            "Type": "ALIYUN::ECS::VPC",
            "Properties": {
              "CidrBlock": {
                "Ref": "VpcCidrBlock"
              },
              "VpcName": "Vpc-sharepoint"
            },
            "Metadata": {
              "ALIYUN::ROS::Designer": {
                "id": "4dfdcadf-d55e-4085-af95-79d40005c3da"
              }
            }
          },
          "EcsSecurityGroup": {
            "Type": "ALIYUN::ECS::SecurityGroup",
            "Properties": {
              "SecurityGroupIngress": [
                {
                  "Priority": 1,
                  "PortRange": "3389/3389",
                  "NicType": "intranet",
                  "SourceCidrIp": "0.0.0.0/0",
                  "IpProtocol": "tcp"
                }
              ],
              "VpcId": {
                "Ref": "EcsVpc"
              }
            },
            "Metadata": {
              "ALIYUN::ROS::Designer": {
                "id": "f1c13fc6-e74d-477c-be14-9e24fd583b55"
              }
            }
          },
          "RosWaitConditionHandle": {
            "Type": "ALIYUN::ROS::WaitConditionHandle",
            "Metadata": {
              "ALIYUN::ROS::Designer": {
                "id": "d3d24118-a044-4f1d-9684-758480e50a31"
              }
            }
          }
        },
        "Outputs": {
          "InstanceId": {
            "Value": {
              "Fn::GetAtt": [
                "SharePointServer",
                "InstanceId"
              ]
            }
          },
          "PublicIp": {
            "Value": {
              "Fn::GetAtt": [
                "SharePointServer",
                "PublicIp"
              ]
            }
          },
          "SecurityGroupId": {
            "Value": {
              "Fn::GetAtt": [
                "EcsSecurityGroup",
                "SecurityGroupId"
              ]
            }
          },
          "VpcName": {
            "Value": {
              "Fn::GetAtt": [
                "EcsVpc",
                "VpcId"
              ]
            }
          }
        }
      }
  2. 配置模板。

    1. 配置模板参数页面,填写资源栈名称,然后按以下要求完成各配置项。

      区域

      参数

      说明

      VPC

      专有网络网段

      选中192.168.0.0/16

      交换机网段

      填写192.168.0.0/24

      ECS

      交换机可用区

      按需选择交换机可用区,例如可用区G。

      镜像

      创建ECS使用的镜像ID。

      SharePoint镜像下载路径

      填写sharepoint.exe的文件URL。您可以从步骤一种获取文件URL。

      实例规格

      按需选择实例规格,例如ecs.c5.large。

      实例密码

      自定义ECS实例登录密码。

    2. 单击创建

      创建资源栈大约需要40分钟。

  3. 登录ECS实例。

    1. 单击已创建的资源栈。

    2. 单击资源页签,单击SharePointServerALIYUN::ECS::Instance资源ID。

      instance
    3. 在ECS管理控制台,单击该实例右侧的远程连接,然后单击Workbench远程连接下的立即登录

  4. 体验SharePoint。

    1. 打开SharePoint 2013管理中心,输入默认用户名administrator与ECS实例登录密码。

      root
  5. 在SharePoint管理站点,体验SharePoint多种功能。

    SharePoint