Setup VirtualBox VM and networking
Install Windows Server 2019 x64 Core on e.g. VirtualBox (out of scope of this post), using 32 GB dynamic VDI disk, 1 GB of RAM and UEFI. You can tweak RAM size and resize virtual disk later.
You will need to configure host-only network interface, which will allow connections between virtual and host machines. Of cause, there are more virtual networking options.
Assuming that DHCP server of host-only interface is configured to lease IP addresses starting with 192.168.56.101, you should add the following line to /etc/hosts (on Linux) or C:\Windows\System32\drivers\etc\hosts (on Windows):
192.168.56.101 dnn980.hostname.local
If you’ll need multilanguage website, it is good to have separate alias for each of target languages:
192.168.56.101 dnn980.hostname.local
192.168.56.101 de.dnn980.hostname.local
192.168.56.101 ru.dnn980.hostname.local
...
Install IIS
List of currently installed features:
Get-WindowsFeature
Install IIS and ASP.NET:
Install-WindowsFeature Web-Server
Install-WindowsFeature Web-Asp-Net45
Install SQL Server Express/Developer
Get and run the SQL Express 2019 downloader:
wget https://go.microsoft.com/fwlink/?linkid=866658 -UseBasicParsing -OutFile sqlexpress.exe
./sqlexpress.exe
Proceed with GUI wizard from now to download real installer.
After downloading real installer, find and run SETUP.EXE - this will require some command-line switches.
Good old GUI wizard:
./SETUP.EXE /UIMODE=EnableUIOnServerCore /Action=Install
Command-line:
./SETUP.EXE /Q /Action=Install /SECURITYMODE=SQL /SAPWD="MyP@$$w0rd" /TCPENABLED=1 /FEATURES=SQLEngine /ADDCURRENTUSERASSQLADMIN
Create the database for DNN
Create folder to store databases:
mkdir C:\Databases
Configure permissions:
$acl = Get-Acl "C:\Databases"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("NT Service\MSSQLSERVER", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$acl.SetAccessRule($accessRule)
Set-Acl "C:\Databases" $acl
Create the CreateDnn980Database.sql file somewhere:
use master;
go
create database Dnn980
on (name = N'Dnn980', filename = N'C:\Databases\Dnn980.mdf')
log on (name = N'Dnn980_log', filename = N'C:\Databases\Dnn980_log.ldf');
go
alter authorization on database::Dnn980 to sa
go
Execute it:
Invoke-SqlCmd -ServerInstance "(local)" -InputFile "CreateDnn980Database.sql"
Configure firewall
Get the current rules, e.g. related to ICMP:
Get-NetFirewallRule | Where Name -like "*ICMP*"
Allow ping:
Set-NetFirewallRule -Name FPS-ICMP4-ERQ-In -Enabled True -Profile Any -Action Allow
Allow external connections to IIS via HTTP (port 80):
This is done by default by adding webserver role, rule names IIS-WebServerRole-HTTP-In-TCP and IIS-WebServerRole-HTTPS-In-TCP.
Allow inbound SMB for shared folders:
Set-NetFirewallRule -Name FPS-SMB-In-TCP -Enabled True -Profile Any -Action Allow
Download and unpack DNN
wget https://github.com/dnnsoftware/Dnn.Platform/releases/download/v9.6.2/DNN_Platform_9.6.2_Install.zip -UseBasicParsing -OutFile dnn980.zip
Expand-Archive dnn980.zip -DestinationPath C:\Dnn980
rm dnn980.zip
Add website and application pool in IIS
Import-Module IISAdministration
New-IISSite -Name dnn980.hostname.local -BindingInformation "*:80:dnn980.hostname.local" -Protocol http -PhysicalPath C:\Dnn980
You can easily manipulate binding information for the website using New-WebBinding and Remove-WebBinding commandlets:
Import-Module WebAdministration
Remove-WebBinding -Name dnn980.hostname.local -HostHeader dnn980.hostname.local
New-WebBinding -Name dnn980.hostname.local -port 443 -Protocol https -HostHeader dnn980.hostname.local
But this will not create the application pool for the new website!
Create new application pool and bind it to the website:
Import-Module WebAdministration
New-WebAppPool -Name "dnn980.hostname.local"
Set-ItemProperty "IIS:\Sites\dnn980.hostname.local" -Name "applicationPool" -Value "dnn980.hostname.local"
Check:
Import-Module WebAdministration
ls "IIS:\AppPools"
This will list all websites and corresponding application pools.
Configure file system permissions
$acl = Get-Acl "C:\Dnn980"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS_IUSRS", "ReadAndExecute", "ContainerInherit,ObjectInherit", "None", "Allow")
$acl.SetAccessRule($accessRule)
Set-Acl "C:\Dnn980" $acl
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("IIS APPPOOL\dnn980.hostname.local", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$acl.SetAccessRule($accessRule)
Set-Acl "C:\Dnn980" $acl
Check:
Get-Acl "C:\Dnn980" | Format-List
Share website folder
You will probably need the website folder to be accessible via share, so you can setup automatic deployment of build output from IDE into it.
Install-WindowsFeature FS-SMB1-SERVER
# Optional?
# Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol
New-SMBShare -Name "Dnn980" -Path "C:\Dnn980" -FullAccess "Administrator"
Test this by trying to access share by IP like that: \\192.168.56.101\Dnn980.
Run DNN install
Access http://dnn980.hostname.local from a web browser on host machine and follow installation wizard!
Database setup form fields:
- Database Setup
-
Custom
- Database Type
-
SQL Server/SQL Server Express Database
- Server Name
-
(local)
- Database Name
-
Dnn980
- Database Username
-
sa
Extra
Install Far file manager
wget far-manager.ru/files/Far_Manager_v3.0_build_4455.zip -UseBasicParsing -OutFile far.zip
Expand-Archive far.zip -DestinationPath .
./Far30b4455.x64.20151115.msi
Now you will probably want to add far command to the PATH.
Most simple way to do it is via regedit. User environment variables are at HKCU\Environment, system variables are at HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment.
Multiple console windows
Press Ctrl+Alt+Del, select Task Manager, then run cmd.exe or powershell.exe via menu.
TODO
-
Separate initial configuration and adding new DNN instances
-
Create separate database owner for each database
-
Configure firewall to allow external connections to the SQL Server: https://docs.microsoft.com/en-us/sql/sql-server/install/configure-the-windows-firewall-to-allow-sql-server-access?view=sql-server-ver15
-
Further integration (probably out of scope): vm-scripts,
/etc/fstabentries for shares, deploy build output to the share, etc.