TỔNG QUAN VỀ ĐỀ TÀI
GIỚI THIỆU
Nano Server có kích thước cài đặt nhỏ hơn 92% so với tùy chọn cài đặt giao diện đồ họa người dùng Windows Server (GUI) Những lợi ích vượt trội này sẽ thuyết phục bạn bắt đầu sử dụng Nano cho các khối lượng công việc trên Windows Server.
Hệ điều hành Bare-metal giúp người dùng giảm thiểu việc cập nhật và khởi động lại, đồng thời giảm bề mặt tấn công so với GUI Windows Server nhờ vào việc truy cập các vai trò máy chủ từ bên ngoài Nano Với kích thước nhỏ gọn, Nano dễ dàng di chuyển giữa các máy chủ, trung tâm dữ liệu và các địa điểm vật lý, đồng thời hỗ trợ các khối lượng công việc Windows Server phổ biến như máy chủ Hyper-V Nano được thiết kế để quản lý hoàn toàn từ xa, nhưng cũng bao gồm một giao diện quản lý cục bộ tối thiểu, gọi là "Nano Server Recovery Console", cho phép thực hiện các tác vụ cấu hình ban đầu.
Docker là nền tảng cung cấp công cụ và dịch vụ cho các lập trình viên và quản trị hệ thống để phát triển, thực thi và chạy ứng dụng trong các vùng chứa (container) Nó cho phép xây dựng, triển khai và chạy ứng dụng một cách dễ dàng trên nền tảng ảo hóa với nguyên tắc "Build once, run anywhere" Thay vì cài đặt môi trường chạy cho ứng dụng, người dùng chỉ cần sử dụng Docker, giúp ứng dụng hoạt động độc lập mà không ảnh hưởng đến môi trường hiện tại của máy Docker hỗ trợ nhiều hệ điều hành như Linux, Microsoft Windows và Apple OS X.
IIS, hay còn gọi là Internet Information Services, là phần mềm đi kèm với các phiên bản Windows, cung cấp dịch vụ cho máy chủ chạy trên hệ điều hành này Nó cho phép phân tán thông tin lên Internet và bao gồm nhiều dịch vụ khác nhau như Web Server và FTP Server.
FTP (Giao thức truyền tập tin) là phương thức phổ biến để trao đổi tập tin qua mạng sử dụng giao thức TCP/IP, bao gồm cả Internet và Intranet Hoạt động của FTP yêu cầu sự kết nối giữa hai máy tính: một máy chủ và một máy khách.
Mỗi thiết bị trên mạng Internet giao tiếp qua địa chỉ IP (Internet Protocol) Để dễ dàng sử dụng và ghi nhớ, chúng ta sử dụng tên miền (domain name) để xác định các thiết bị Hệ thống tên miền (Domain Name System) giúp chuyển đổi tên miền thành địa chỉ IP.
Khi cần liên hệ với các máy chủ, người dùng có thể sử dụng tên miền dễ nhớ như www.microsoft.com hay www.ibm.com, thay vì phải ghi nhớ địa chỉ IP phức tạp với dãy số dài.
Trước khi hệ thống DNS ra đời, người ta sử dụng file Host.txt để lưu trữ thông tin về tên host và địa chỉ IP của tất cả các máy trong mạng, với file này được lưu trên từng máy để hỗ trợ việc truy xuất Tuy nhiên, việc cập nhật file Host.txt trên tất cả các máy mỗi khi có sự thay đổi về tên host hoặc địa chỉ IP gây ra nhiều khó khăn Để khắc phục vấn đề này, vào năm 1984, Paul Mockpetris tại Viện Khoa học Thông tin USC đã phát triển Hệ thống tên miền (DNS) nhằm quản lý tên miền một cách hiệu quả hơn.
Thông qua tìm hiểu về tổng quan ở chương I, làm cơ sở đề xuất phân tích thiết kế hệ thống sẽ được trình bày trong chương tiếp theo
PHÂN TÍCH THIẾT KẾ HỆ THỐNG
SƠ ĐỒ MẠNG
1 Sơ đồ mạng trên VMWare
2 Sơ đồ mạng trên google Engine
TRIỂN KHAI
TRIỂN KHAI TRÊN VMWare
- Sử dụng VyOS làm router, gồm có 3 network adapter o Network adapter (NAT) dùng để đi internet o Network adapter 2 (192.168.5.1) dùng cho phòng IT o Network apdater 3 (172.16.5.1) dung cho phòng kế toán
- Nanoserver được xem như là 1 server cục bộ
- Các chức năng đã triển khai trên nano server o Web Server (IIS) o DNS Server
To install Windows Nano Server, first mount the Windows Server 2016 ISO file to a physical drive Since the drives of Windows Server 2016 are fixed for operation on Hyper-V, it is necessary to set up a separate drive specifically for VMware.
NanoServer o Mount file C:\Program Files (x86)\VMware\VMware
To begin the installation process, mount the Windows Server 2016 ISO file and run the setup.exe file Alternatively, you can execute the command `./setup.exe /a` using CMD Next, copy the NanoServerImageGenerator folder from the mounted ISO to a new directory Finally, import this folder into PowerShell to complete the setup.
Import-Module \NanoServerImageGenerator.psd1 o Sủ dụng powershell hoặc windows terminal để chạy New-NanoServerImage -Edition Datacenter -MediaPath G:\ -BasePath \Base -TargetPath
.\NanoServer\NanoServerTest.vhdx -DeploymentType Guest -ComputerName NanoVM -Storage -Package Microsoft- NanoServer-IIS-Package, Microsoft-NanoServer-DNS-Package
-DriverPath /VMWareTools/Drivers Ở đây TargetPath là nơi lưu file Windows nano server MediaPath là địa chỉ ổ đĩa mà vừa mount file windows server
2016 iso ra Package là các package mà mình cần cài vào Nano Server, ở đây đang cài IIS và DNS (vào ổ đĩa vừa mount > NanoServer >
To create a package, you need to define the package name and specify the DrivePath, which points to the mounted VMWare directory After obtaining the vhdx file, it is essential to convert it to a vmdk format, as VMWare operates with vmdk files You can accomplish this conversion using the qemu-img tool with the following command: `./qemu-img.exe convert -p \NanoServer\NanoServer.vhd -O vmdk \NanoServer\NanoServer.vmdk`.
Tiếp đến import file vmdk qua VMWare
Chọn sang BIOS thay vì UEFI
Chọn đến file vmdk vừa mới convert
Mở file vmx trong folder máy ảo VMWare lên
Sửa card mạng sang vmxnet3
- Cấu hình IP tĩnh cho nanoServer
Setup firewall cho phép ping đến
Inbound Firewall rules > Virtual Machine Monitoring (Echo Request – ICMPv4 – In)
Nhấn F4 để đổi sang trạng thái allow
Remote powershell, nanoServer không hỗ trợ GUI, chỉ thao tác bằng lệnh, do đó dung lượng của NanoServer rất nhẹ khoảng 1GB khi đã cài đặt IIS + DNS Server
Remote powershell bằng cách dùng powershell trên máy khác và tiến hành remote vào windows nano server để thực hiện các lệnh trên nano server
Có thể dùng powershell ISE để dễ thao tác
Enter-PSSession -ComputerName 192.168.5.4 -Credential ~\Administrator
Sau khi remote thành công, sẽ có phần IP hoặc hostname ở trước phần nhập lệnh
$s = New-PSSession -ComputerName "192.168.5.4" -Credential ~\Administrator
Lệnh trên dùng để khởi tạo session và gán session đó vào biến $s
Copy-Item -ToSession $s -Path C:\Config\applicationHost.config -Destination
Lệnh trên dung để copy file vào nanoServer, nếu muốn copy file từ nanoServer về máy thì thay -ToSession thành -FromSession
- Cấu hình website trên IIS o Import-Module IISAdministration dùng để Import các module
To manage websites in IIS, use the command `Get-IISSite` to retrieve a list of added sites To remove a site named "Nhom05-FTP", execute `Remove-IISSite -Name "Nhom05-FTP"` To add a new website called "Nhom05" that listens on port 80 and has a physical path of "C:\webserver", use the command `New-IISSite -Name "Nhom05" -BindingInformation "*:80:" -PhysicalPath "C:\webserver"` Additionally, enable the DNS Server Full Role feature by running `Enable-WindowsOptionalFeature -Online -FeatureName DNS-Server-Full-Role`.
To manage DNS servers effectively, use the command `Get-WindowsOptionalFeature -Online` to list all available features For DNS server management, utilize `Get-DnsServer` to retrieve DNS server information To create a primary zone, implement the command `Add-DnsServerPrimaryZone -ZoneName nhom05.org -ZoneFile nhom05.org.dns` To add an A record, use `Add-DnsServerResourceRecordA -Name www -ZoneName nhom05.org -IPv4Address 192.168.5.4` Additionally, you can create a secondary zone with `Add-DnsServerSecondaryZone -Name "nhom05.org" -ZoneFile`.
"nhom05.org.dns" -MasterServers 192.168.5.4 o Remove-DnsServerZone "nhom05.org" -PassThru -Verbose
- Cấu hình DNS để windows nano server có thể đi phân giải tên miền internet o Get-DNSClient o Set-DnsClientServerAddress -InterfaceIndex 2
-ServerAddresses ("8.8.8.8","8.8.4.4") o ipconfig /all o ping google.com
- Kết quả của website + DNS
- 2 máy trạm windows server 2016, windows 7 sử dụng network adapter
- 1 máy trạm windows 7 sử dụng network adapter
TRIỂN KHAI TRÊN GOOGLE ENGINE
1 Thông tin về máy ảo của google Engine
- Sử dụng Docker để tạo 1 môi trưởng máy ảo khác
- Cài đặt docker o Mở powershell với quyền administator o [Net.ServicePointManager]::SecurityProtocol [Net.SecurityProtocolType]::Tls12 o Register-PSRepository -Default o Install-Module -Name DockerMsftProvider -Force
- Pull image từ docker hub về o Docker pull mcr.microsoft.com/windows/nanoserver:10.0.14393.2363 o Docker pull nanoserver/iis-php o Docker pull nanoserver/iis
- Chạy nền container từ image o Docker run -it -d mcr.microsoft.com/windows/nanoserver:10.0.14393.2363 o Docker ps -a Để xem tất cả container đã tạo
To access a Windows Nano Server Docker container, use the command `docker exec -it powershell` For a simpler setup, utilize Docker Compose to build and run the container Begin by creating the necessary directory structure, and in the Dockerfile, create a new image that copies the files from the website directory into the virtual machine.
# Metadata indicating an image maintainer.
#LABEL maintainer="ntnguyen.19it5@vku.udn.vn"
# Creates an HTML file and adds content to this file.
To copy the website files to the specified directory, use the command `COPY /website c:/inetpub/wwwroot` in the Docker configuration The `docker-compose.yml` file includes the following content: version "3.3" and defines the service `iis-basic` This service has a container named `iis-basic`, built from the context of the current directory using the specified `Dockerfile` The image used is `nanoserver/iis-basic`, and it is configured to expose the necessary ports.
- 80:80 tty: true networks: default: external: name: nat o Build và up image lên: docker-compose up –build -d o Docker ps để xem docker container đã chạy chưa
- Thêm PHP vào IIS o Tạo cấu trúc thư mục như sau o Ở file Dockerfile có nội dung như sau:
FROM nanoserver/iis-php:latest
# Metadata indicating an image maintainer.
#LABEL maintainer="ntnguyen.19it5@vku.udn.vn" iis-php: container_name: iis-php build: context: / dockerfile: Dockerfile image: nanoserver/iis-website-php:latest ports:
- 8080:80 tty: true networks: default: external: name: nat o Ở file index.php
o Build và up image lên: docker-compose up –build -d o Vào localhost:8080/index.php
- Trỏ tên miền về VPS o Sử dụng CloudFlare để quản lý tên miền dễ dàng hơn o Thêm record A vào o Giờ có thể truy cập vào website qua tên miền
http://qtm-nhom05.uknteam.site
http://qtm-nhom05.uknteam.site:8080
- Thao tác với CLI nhiều hơn thay vì thao tác với GUI ở trên windows server
- Hiểu biết thêm về NanoServer
- Thành thạo docker cli nhiều hơn
2 Kết quả chưa đạt được:
Unable to deploy the FTP Server due to issues with Windows Nano Server, which is preventing the update of IISAdministrator A question regarding this problem has been posted on Stack Overflow for assistance: [Update IISAdministration with PowerShell](https://stackoverflow.com/questions/70179598/update-iisadministration-with-powershell).