added build instructions

This commit is contained in:
Shreyas Zare
2023-03-05 17:13:42 +05:30
parent 38f821742d
commit 1c84c95d67

76
build.md Normal file
View File

@@ -0,0 +1,76 @@
# Build Instructions
## For Windows
To build the Technitium DNS Server Windows Setup, you need to install [Microsoft Visual Studio Community 2022 (VS2022)](https://visualstudio.microsoft.com/vs/) and [Inno Setup](https://jrsoftware.org/isinfo.php) on your computer. Once you have it installed, follow the steps below:
1. Open VS2022 and use the "Clone a repository" option to clone the [TechnitiumLibrary](https://github.com/TechnitiumSoftware/TechnitiumLibrary) project using the `https://github.com/TechnitiumSoftware/TechnitiumLibrary.git` URL. Once the repository is cloned and opened in VS2022, select the build mode to "Release" from the dropdown box in the toolbar and use the Build > Build Solution menu to build it.
2. Open VS2022 and use the "Clone a repository" option to clone the [DnsServer](https://github.com/TechnitiumSoftware/DnsServer) project using the `https://github.com/TechnitiumSoftware/DnsServer.git` URL. Once the repository is cloned and opened in VS2022, right click on the `DnsServerSystemTrayApp` project and click on the Publish menu to open the publish page. Click the Publish button on it to publish the project in `DnsServer\DnsServerWindowsSetup\publish` folder. Similarly, right click on the `DnsServerWindowsService` project and click on the Publish menu to open publish page and use the Publish button to publish the project in the same folder as that of the previous project.
3. Open the `DnsServer\DnsServerWindowsSetup\DnsServerSetup.iss` file in Inno Setup and click on the Build > Compile menu to generate a Windows setup in `DnsServerWindowsSetup\Release` folder that you can then use to install Technitium DNS Server.
## For Linux
Follow the instructions given below to build and install the DNS server from source.
1. Install prerequisites like curl and git.
```
$ sudo apt update
$ sudo apt install curl git -y
```
2. Configure [Microsoft Software Repository](https://learn.microsoft.com/en-us/windows-server/administration/linux-package-repository-for-microsoft-software) to be able to install ASP.NET SDK.
- Ubuntu 22.04
```
$ curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
$ sudo apt-add-repository https://packages.microsoft.com/ubuntu/22.04/prod
$ sudo apt update
```
- Raspberry Pi OS
```
$ curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ sudo apt-add-repository https://packages.microsoft.com/debian/11/prod
$ sudo apt update
```
3. Install ASP.NET Core 7 runtime and `libmsquic` for DNS-over-QUIC support.
```
$ sudo apt install dotnet-sdk-7.0 libmsquic -y
```
Note! The `libmsquic` package requires openssl v1.1.1 and is not yet compatible with openssl v3.x. You can follow [this blog post](https://blog.technitium.com/2023/02/configuring-dns-over-quic-and-https3.html) to know how to get it configured correctly. If you do not plan to use DNS-over-QUIC or HTTP/3 support then you can skip installing `libmsquic` altogether.
4. Clone the source code for both [TechnitiumLibrary](https://github.com/TechnitiumSoftware/TechnitiumLibrary) and [DnsServer](https://github.com/TechnitiumSoftware/DnsServer) into the current folder.
```
$ git clone --depth 1 https://github.com/TechnitiumSoftware/TechnitiumLibrary.git TechnitiumLibrary
$ git clone --depth 1 https://github.com/TechnitiumSoftware/DnsServer.git DnsServer
```
5. Build the TechnitiumLibrary source.
```
$ dotnet build TechnitiumLibrary/TechnitiumLibrary.ByteTree/TechnitiumLibrary.ByteTree.csproj -c Release
$ dotnet build TechnitiumLibrary/TechnitiumLibrary.Net/TechnitiumLibrary.Net.csproj -c Release
```
6. Build the DnsServer source.
```
$ dotnet publish DnsServer/DnsServerApp/DnsServerApp.csproj -c Release
```
7. Install the DNS server as a systemd service.
```
$ sudo mkdir -p /opt/technitium/dns
$ sudo cp -r DnsServer/DnsServerApp/bin/Release/publish/* /opt/technitium/dns
$ sudo cp /opt/technitium/dns/systemd.service /etc/systemd/system/dns.service
$ sudo systemctl stop systemd-resolved
$ sudo systemctl disable systemd-resolved
$ sudo systemctl enable dns.service
$ sudo systemctl start dns.service
$ sudo rm /etc/resolv.conf
$ echo "nameserver 127.0.0.1" | sudo tee /etc/resolv.conf
```
8. Open the DNS server web console in a web browser using `http://<server-ip-address>:5380/` URL and set a login password to complete the installation.