## Cấu hình máy ảo - 1 máy DC và 1 máy SQL server - 2x2 (4 cores), 8gb RAM, 60gb disk - 1 máy chạy Sharepoint - 2x2 (4 cores), 16gb RAM, 120gb disk Bài viết này dựa trên cách setup https://gist.github.com/testanull/e1573437f91ec3726ab5041389c6f28d mn nên đọc trước bài này để biết những phần cần setup để folow theo dễ hiểu. ## Domain Controller and SQL Server Setup ### Setup server ![image](https://hackmd.io/_uploads/Hyx1C_S6Ggl.png) Update win và rename thì tuỳ ý đổi. Config DNS như sau: ![image](https://hackmd.io/_uploads/S1SbFSTMxg.png) Lấy ipv4 để nhập vào dưới đây: - Control Panel → Network and Sharing Center → Change adapter settings. - Nhấn chuột phải vào Ethernet (hoặc card mạng đang dùng) → chọn Properties. - Chọn dòng Internet Protocol Version 4 (TCP/IPv4) → nhấn Properties ![image](https://hackmd.io/_uploads/S1WwYHTzel.png) ## Setup DC ![image](https://hackmd.io/_uploads/r1y5YSaMgg.png) - Add role and feature ![](https://hackmd.io/_uploads/rywjlLaD3.png) - Setup domain controller ![](https://hackmd.io/_uploads/Bkccb8Twh.png) Để thêm 3 account sau: ``` sp_farmadmin – tài khoản quản trị farm SharePoint sp_service – tài khoản chạy các dịch vụ SharePoint sql_service – tài khoản chạy dịch vụ SQL Server ``` Mở `Active Directory Users and Computers` -> Click chuột phải vào domain của bạn (ví dụ dc.lab) → New → `Organizational Unit` -> Nhập tên: ServiceAccounts → Nhấn OK. ![image](https://hackmd.io/_uploads/HyJb_MXPex.png) Tạo `sp_farmadmin`: Click chuột phải vào OU ServiceAccounts → New → User. ``` First name: SharePoint Last name: FarmAdmin User logon name: sp_farmadmin -> Nhấn Next. Nhập mật khẩu (ví dụ: P@ssw0rd123!) và: Bỏ chọn “User must change password at next logon” Chọn “Password never expires” -> Nhấn Next → Finish. ``` Tương tự cho `sp_service` và `sql_service` ``` sp_service First name: SharePoint Last name: Service Username: sp_service sql_service First name: SQL Last name: Service Username: sql_service ``` ![image](https://hackmd.io/_uploads/ByTc9fmDxl.png) ## SQL server ### Cài đặt SQL Server 2019 Express ![image](https://hackmd.io/_uploads/SyxbaRTzlx.png) - Setup DNS ![image](https://hackmd.io/_uploads/B1hNpJAzxg.png) - Join domain + Vào System Properties (chuột phải This PC > Properties > Change settings) + Nhấn nút Change... -> Chọn Domain, nhập: dc.lab (domain setup ở DC) -> Nhập tài khoản domain có quyền join (Administrator) + Reset máy ![image](https://hackmd.io/_uploads/HysGqU4vxg.png) - Firewall open port 1433 ``` netsh advfirewall firewall add rule name="SQLPort" dir=in action=allow protocol=TCP localport=1433 ``` Powershell: ``` New-NetFirewallRule -DisplayName "Allow SQL Port 1433" -Direction Inbound -Protocol TCP -LocalPort 1433 -Action Allow ``` ![](https://hackmd.io/_uploads/r1-RLrfFn.png) Cài đặt SQL Server version: SQL Server 2019 Express (https://www.microsoft.com/en-us/download/details.aspx?id=101064) ![](https://hackmd.io/_uploads/H1vasvlY3.png) Trong `Feature Selection` bỏ chọn `Machine Learning Services …` ![image](https://hackmd.io/_uploads/Hkd-yv4wxe.png) Chỉnh account của `SQL Server Database Engine` thành `sql_service` ![image](https://hackmd.io/_uploads/SkBGlv4vee.png) Trong màn hình `Database Engine Configuration` thực hiện chọn `Add` -> nhập `sp_farmadmin`. Danh sách “SQL Server administrators” nên bao gồm: ``` SQL-SERVER\Administrator DC\sp_farmadmin ``` ![image](https://hackmd.io/_uploads/r1ngSvEDxe.png) Sau khi `Next` hết thì success như sau ![image](https://hackmd.io/_uploads/H1xWLw4vge.png) ### Cấu hình SQL Server Thực hiện `Install SQL Server Mangement Tools` ![](https://hackmd.io/_uploads/H1nWnvet3.png) Khi click vào ở trên thì sẽ được open 1 trang web như dưới và chọn vào phần tô đỏ để download. ![](https://hackmd.io/_uploads/ryfB2vgYn.png) Sau khi tải về thì mở lên và connect như sau: - `Server Name` -> `SQL-SERVER\SQLEXPRESS` - `Authentication` giữ nguyên `Windows Authentication` và connect Change role cho cho tài khoản `sp_farmadmin` là `dbcreator` và `securityadmin` ![](https://hackmd.io/_uploads/BJXv8OeFh.png) Thực hiện bật TCP/IP cho SQL Server: ![image](https://hackmd.io/_uploads/HytePoNDxl.png) ![image](https://hackmd.io/_uploads/Skv5aoNPle.png) ## Sharepoint ![image](https://hackmd.io/_uploads/SJxOO6TQgl.png) Join domain như ở bước setup SQL server Để add account `sp_farmadmin` vào nhóm `Administrators` thì đầu tiên login bằng tài khoản local admin trước (Administrator) Thực hiện add account `sp_farmadmin` vào group `Administrator` tại `Computer Management` → `Local Users and Groups` → `Groups` → mở nhóm Administrators -> Nhấn `Add`. Sau đó nhập `sp_farmadmin` -> Nhấn `Check Names → OK → OK` ![image](https://hackmd.io/_uploads/HJOnF_EDlg.png) Add thành công thì logout tài khoản local admin và đăng nhập bằng tài khoản `sp_farmadmin` để thực hiện setup sharepoint. ### Cài đặt SharePoint 2019 Download sharepoint tại `https://www.microsoft.com/en-us/download/details.aspx?id=57462` ![image](https://hackmd.io/_uploads/HJGO3qVwlx.png) Sau khi tải xong file chạy `PrerequisiteInstaller.exe` ![image](https://hackmd.io/_uploads/ry6qn5NDxx.png) Chạy xong thì restart máy và tiếp tục chạy `setup.exe` và nhập key. Cài xong lại tiếp tục restart máy. ``` Enterprise Trial: M692G-8N2JP-GG8B2-2W2P7-YY7J6 Standard trial product key: F2DPD-HPNPV-WHKMK-G7C38-2G22J ``` ![image](https://hackmd.io/_uploads/Hk5ckjVPee.png) ### Cấu hình Sharepoint Chạy SharePoint Products Configuration Wizard - Tạo New Farm ![image](https://hackmd.io/_uploads/rkOOgsNDeg.png) - Database server chỗ này nhập ip đừng nhập hostname và dùng farm service account `sp_service@dc.lab` ![image](https://hackmd.io/_uploads/HJ2s-pEPeg.png) - Server role: Single-Server Farm ![image](https://hackmd.io/_uploads/B1N8M6VDgx.png) Tới đây chọn Next là xong. ![image](https://hackmd.io/_uploads/B1weXaEvxe.png) Request tới http://sp:41296/default.aspx ![image](https://hackmd.io/_uploads/S1NOFaEvxg.png) Vậy là đã cấu hình xong `Central Administration`. Bây giờ đến phần chạy `Initial Farm Configuration Wizard`. Thực hiện login Sharepoint bằng tài khoản `Administrator`. Dùng `sp_farmadmin` sẽ bị denied. Nhấp vào phần `Configuration Wizards` (góc dưới bên phải) -> → `Launch the Farm Configuration Wizard` ![image](https://hackmd.io/_uploads/Sy4r8jHwgg.png) Tiếp tục chọn `Start the Wizard`. ![image](https://hackmd.io/_uploads/r1qhLjrveg.png) Khi vào được tới giao diện như dưới đây thì chọn và nhập như sau: ![image](https://hackmd.io/_uploads/ByvODjBvle.png) - Chọn `User Profile Service Application` (bắt buộc) - Tích `Use existing managed account` (account sp_service) - Ngoài ra có thể tick thêm những cái như: - App Management Service - Workflow Service - Business Data Connectivity Service - Search Service (nếu cần) Ở đây mình hầu hết là để mặc định chỉ xem đã chọn `User Profile Service Application` và dùng account là `sp_service` hay chưa. Sau khi ấn `Next` và chờ thì nếu có lỗi như dưới đây thì có thể vào `Timer Job Status ` để xem tiến trình hoàn thành chưa. ![image](https://hackmd.io/_uploads/HkWZz2Svgl.png) ![image](https://hackmd.io/_uploads/HJ4mz2rPee.png) Sau khi cấu hình các Service xong, wizard sẽ hỏi bạn tạo một site collection đầu tiên: - Web Path: / (tức là root site: http://sp:port/) - Template: chọn một trong các loại: - Team Site – Dành cho làm việc nhóm (có lịch, tài liệu, task list…) - Communication Site – Dành cho truyền thông nội bộ, trình bày nội dung đẹp hơn. Chỉ cần: Đặt Title, URL (mặc định là /), chọn template phù hợp rồi OK để hoàn tất. ![image](https://hackmd.io/_uploads/rJ4bunBDlg.png) Để check setup thành công chưa thì sau khi hoàn tất bước trên thì truy cập vào http://sp và login nếu hiện thị ra home page như dưới đây thì đã thành công. ![image](https://hackmd.io/_uploads/SypfqhBvgg.png) Tới đây nên snapshot cả 2 máy: `SQL` và `SharePoint`. Sau đó Apply bản vá bảo mật mong muốn cho SharePoint. ### Ref: https://gist.github.com/testanull/e1573437f91ec3726ab5041389c6f28d