From 831b35ecf806ecf2de536af7cca70cc4c261448a Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 18 Mar 2023 17:15:12 +0530 Subject: [PATCH 1/2] build.md: updated to add docker instructions. --- build.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/build.md b/build.md index d2baaee0..8024eab0 100644 --- a/build.md +++ b/build.md @@ -41,7 +41,7 @@ $ sudo apt update $ 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. +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, or you intend to build a docker image 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. ``` @@ -61,6 +61,9 @@ $ dotnet publish DnsServer/DnsServerApp/DnsServerApp.csproj -c Release ``` 7. Install the DNS server as a systemd service. + +Note! Skip this step if you wish to build and use docker image. + ``` $ sudo mkdir -p /opt/technitium/dns $ sudo cp -r DnsServer/DnsServerApp/bin/Release/publish/* /opt/technitium/dns @@ -73,4 +76,25 @@ $ 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://:5380/` URL and set a login password to complete the installation. +8. Build and run docker image. + +Note! Skip this step if you have already installed the DNS server as a systemd service in previous step. + +Note! Before proceeding to build a docker image, it is required that you have installed docker and docker-compose on your computer. + +Follow the commands given below to build a docker image for the DNS server. + +``` +$ cd DnsServer +$ sudo docker build -t technitium/dns-server:latest . +``` + +You can now run the image that you have build using docker-compose as shown below. You should edit the `docker-compose.yml` file if you wish to edit the container's configuration before running it. + +``` +$ sudo systemctl stop systemd-resolved +$ sudo systemctl disable systemd-resolved +$ sudo docker-compose up -d +``` + +9. Open the DNS server web console in a web browser using `http://:5380/` URL and set a login password to complete the installation. From b16a2b76643b6365b65ed654a59a51fdb7d31840 Mon Sep 17 00:00:00 2001 From: Shreyas Zare Date: Sat, 18 Mar 2023 17:20:53 +0530 Subject: [PATCH 2/2] build.md: minor changes. --- build.md | 58 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/build.md b/build.md index 8024eab0..f9458a47 100644 --- a/build.md +++ b/build.md @@ -16,48 +16,48 @@ Follow the instructions given below to build and install the DNS server from sou 1. Install prerequisites like curl and git. ``` -$ sudo apt update -$ sudo apt install curl git -y +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 Core SDK. You can follow the instructions given in the link to add the software repository on your distro as shown in examples below: - 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 +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 +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 SDK and `libmsquic` for DNS-over-QUIC support. ``` -$ sudo apt install dotnet-sdk-7.0 libmsquic -y +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, or you intend to build a docker image 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 +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 +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 +dotnet publish DnsServer/DnsServerApp/DnsServerApp.csproj -c Release ``` 7. Install the DNS server as a systemd service. @@ -65,36 +65,36 @@ $ dotnet publish DnsServer/DnsServerApp/DnsServerApp.csproj -c Release Note! Skip this step if you wish to build and use docker image. ``` -$ 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 +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. Build and run docker image. Note! Skip this step if you have already installed the DNS server as a systemd service in previous step. -Note! Before proceeding to build a docker image, it is required that you have installed docker and docker-compose on your computer. +Note! Before proceeding to build a docker image, it is required that you have installed `docker` and `docker-compose` on your computer. Follow the commands given below to build a docker image for the DNS server. ``` -$ cd DnsServer -$ sudo docker build -t technitium/dns-server:latest . +cd DnsServer +sudo docker build -t technitium/dns-server:latest . ``` You can now run the image that you have build using docker-compose as shown below. You should edit the `docker-compose.yml` file if you wish to edit the container's configuration before running it. ``` -$ sudo systemctl stop systemd-resolved -$ sudo systemctl disable systemd-resolved -$ sudo docker-compose up -d +sudo systemctl stop systemd-resolved +sudo systemctl disable systemd-resolved +sudo docker-compose up -d ``` 9. Open the DNS server web console in a web browser using `http://:5380/` URL and set a login password to complete the installation.