Install .NET 8 on Ubuntu 22.04 using Microsoft package feed

Remove the existing .NET packages from your distribution. You want to start over and ensure that you don’t install them from the wrong repository.

sudo apt remove 'dotnet*' 'aspnet*' 'netstandard*'

Configure your package manager to ignore the .NET packages from the distribution’s repository. It’s possible that you’ve installed .NET from both repositories, so you want to choose one or the other.

touch /etc/apt/preferences
nano /etc/apt/preferences
Package: dotnet* aspnet* netstandard*
Pin: origin "<your-package-source>"
Pin-Priority: -10

Make sure to replace <your-package-source> with your distribution’s package source, for example, on Ubuntu you may use archive.ubuntu.com in the US.

Use the apt-cache policy command to find the source:

apt-cache policy '~ndotnet.*' | grep -v microsoft | grep '/ubuntu' | cut -d"/" -f3 | sort -u
# Get Ubuntu version
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)

# Download Microsoft signing key and repository
wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb

# Install Microsoft signing key and repository
sudo dpkg -i packages-microsoft-prod.deb

# Clean up
rm packages-microsoft-prod.deb

# Update packages
sudo apt update
sudo apt-get update && \
  sudo apt-get install -y dotnet-sdk-8.0

References
https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu-2204
https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu
https://learn.microsoft.com/en-us/dotnet/core/install/linux-package-mixup?pivots=os-linux-redhat

Install NVIDIA Driver and sign the Kernel module on Fedora 39

sudo dnf install kmodtool akmods mokutil openssl

sudo kmodgenca -a
sudo mokutil --import /etc/pki/akmods/certs/public_key.der

You will be asked to enter a password, it doesn’t have to be very strong, just make sure to remember it. You’ll only need it once during  these steps.

sudo reboot

After reboot you will see MOK Manager interface and will be asked to enroll the key.
First select “Enroll MOK“.
Then “Continue“.
Hit “Yes” and enter the password.
Then select “OK” and your device will reboot again.

sudo dnf install gcc kernel-headers kernel-devel akmod-nvidia xorg-x11-drv-nvidia xorg-x11-drv-nvidia-libs xorg-x11-drv-nvidia-libs.i686
sudo akmods --force
sudo dracut --force
sudo reboot
lsmod | grep -i nvidia

References
https://blog.monosoul.dev/2022/05/17/automatically-sign-nvidia-kernel-module-in-fedora-36/
https://rpmfusion.org/Howto/NVIDIA#Current_GeForce.2FQuadro.2FTesla

Setting Up Apache2 with Advanced Features on Ubuntu

In the modern world of web development, Apache2 stands as one of the most robust, reliable, and widely used web servers. This blog post aims to guide you through the installation and configuration of Apache2 on an Ubuntu system, enabling a range of advanced features to maximize its capabilities.

Prerequisites

  • Ubuntu Server (18.04/20.04/22.04 LTS recommended)
  • Terminal access (SSH or direct)
  • Sudo privileges

Step 1: Installing Apache2

Open your terminal and run the following command to install Apache2:

apt-get -y install apache2

The -y flag automatically confirms the installation, saving you from having to do so manually.

Step 2: Enabling Modules

Apache2 is highly modular, allowing you to enable or disable various features according to your needs. To enable a range of advanced modules, execute the following commands:

sudo a2enmod proxy
sudo a2enmod ssl
sudo a2enmod proxy_http
sudo a2enmod proxy_ajp
sudo a2enmod rewrite
sudo a2enmod deflate
sudo a2enmod headers
sudo a2enmod proxy_balancer
sudo a2enmod proxy_connect
sudo a2enmod proxy_html
sudo a2enmod remoteip
sudo a2enmod proxy_fcgi
sudo a2enmod proxy_wstunnel
sudo a2enmod expires

Important: Remember to restart the Apache server after installing new modules for the changes to take effect

Step 3: Editing Configuration File

To apply custom configurations to Apache2, you’ll need to edit its main configuration file. Use the nano editor to open it:

nano /etc/apache2/apache2.conf

Here you can add or modify directives according to your specific needs. After making the desired changes, save and exit the file.

Step 4: Managing the Apache2 Service

After making all the changes, it’s important to restart the Apache2 service for the new configurations to take effect:

sudo systemctl restart apache2

Additionally, you can stop or start Apache2 using the following commands:

  • To stop the service:
    sudo systemctl stop apache2
  • To start the service:
    sudo systemctl start apache2

Conclusion

You’ve successfully installed Apache2 and enabled a host of advanced features, setting a solid foundation for whatever web-based projects you plan to host. This flexible, modular setup ensures you have all the tools you need to build a robust, high-performance web server.

Install the .NET SDK on Fedora

In the ever-evolving world of web development, security is paramount. Here we provide a step-by-step guide to not only installing the .NET Software Development Kit (SDK) on Fedora, but also generating an SSL Certificate for your .NET apps, thus ensuring secure connections between client and server.

Part 1: Installing the .NET SDK on Fedora

Our first step is to install the .NET SDK. The .NET SDK is a set of libraries and tools that allow developers to create .NET apps and libraries. It is the foundation for building applications and libraries with .NET Core.

Here’s how you can install the .NET SDK on your Fedora system:

  1. Open a terminal window.
  2. Input the following command:
    sudo dnf install dotnet-sdk-7.0
  3. Press Enter. You might be asked for your password; if so, provide it and press Enter again.
  4. Let the installation process finish.

After the completion of the above steps, the .NET SDK should be installed successfully on your Fedora system.

Part 2: Creating an SSL Certificate for Your .NET Apps

Creating an SSL certificate for your .NET applications can enhance the security of your applications. Here’s how you can generate an SSL certificate:

  1. First, we need to install Easy-RSA, a CLI utility to build and manage a PKI CA. Run this command:
    sudo dnf install easy-rsa
  2. Now, navigate to the home directory and create a new directory .easyrsa with permissions set to 700:
    cd ~
    mkdir .easyrsa
    chmod 700 .easyrsa
  3. Copy the Easy-RSA scripts to our newly created directory:
    cd .easyrsa
    cp -r /usr/share/easy-rsa/3/* ./
  4. Initialize the Public Key Infrastructure:
    ./easyrsa init-pki
  5. We need to set some variables for our certificate. Create a new file called vars and add the following details in it (You can modify these details according to your requirement):
    cat << EOF > vars
    set_var EASYRSA_REQ_COUNTRY "US"
    set_var EASYRSA_REQ_PROVINCE "Texas"
    set_var EASYRSA_REQ_CITY "Houston"
    set_var EASYRSA_REQ_ORG "Development"
    set_var EASYRSA_REQ_EMAIL "[email protected]"
    set_var EASYRSA_REQ_OU "LocalDevelopment"
    set_var EASYRSA_ALGO "ec"
    set_var EASYRSA_DIGEST "sha512"
    EOF
  6. Now build the CA with nopass option to not secure the CA key with a passphrase:
    ./easyrsa build-ca nopass
    
  7. Copy the generated certificate to the trusted CA directory and update the CA trust on your system:
    sudo cp ./pki/ca.crt /etc/pki/ca-trust/source/anchors/easyrsaca.crt
    sudo update-ca-trust
  8. Generate a new key and a certificate signing request for localhost:
    mkdir req
    cd req
    openssl genrsa -out localhost.key
    openssl req -new -key localhost.key -out localhost.req -subj /C=US/ST=Texas/L=Houston/O=Development/OU=LocalDevelopment/CN=localhost
    cd ..
  9. Import the certificate signing request and sign it:
    ./easyrsa import-req ./req/localhost.req localhost
    ./easyrsa sign-req server localhost
  10. Now, move the server certificate and key to a new directory .certs and convert the certificate to PKCS#12 format:
    cd ~
    mkdir .certs
    cp .easyrsa/pki/issued/localhost.crt .certs/localhost.crt
    cp .easyrsa/req/localhost.key .certs/localhost.key
    cd .certs
    openssl pkcs12 -export -out localhost.pfx -inkey localhost.key -in localhost.crt
  11. Lastly, add the path and the password for the certificate in the .bashrc file so the .NET Core Kestrel server can find it (replace YOUR_USERNAME with your actual username and PASSWORD with the password you want to use for your certificate):
    cat << EOF >> ~/.bashrc
    # .NET
    export ASPNETCORE_Kestrel__Certificates__Default__Password="PASSWORD"
    export ASPNETCORE_Kestrel__Certificates__Default__Path="/home/YOUR_USERNAME/.certs/localhost.pfx"
    EOF

And that’s it! You’ve now installed the .NET SDK and generated an SSL certificate for your .NET apps. Your applications are not only more secure but also more professional, creating trust with users who value their data privacy and security.

Install Fedora Linux on Asus ROG Strix

Hello Linux enthusiasts! Today, we are going to guide you through the process of installing Fedora Linux on the Asus ROG Strix, a gaming beast that’s known for its performance, style, and power. Let’s dig into the steps to get this done!

Preparing the System

Before starting with the installation process, make sure that your system is prepared for it. If you are currently using another operating system, back up any necessary files and ensure that you have the required permissions to install a new operating system.

Installation Process

  1. Start with downloading the Fedora ISO image file. Make sure you download the right version for your system’s architecture, which is usually 64-bit for modern computers.
  2. Create a bootable USB stick using this ISO file.
  3. Boot your Asus ROG Strix from this USB stick. This usually involves pressing a specific key during the system start-up.
  4. Follow the installation prompts provided by the Fedora installer. Make sure you select the right options for your system, such as language, time, keyboard layout, and installation type.

After the installation is complete, restart your computer.

Disabling WiFi Power Saving Mode

Once the system is ready and you are logged into Fedora, it’s time to disable the WiFi power saving mode. This mode can sometimes interfere with your WiFi connection, especially during heavy network usage.

Open the terminal and enter the following command to create a new configuration file:

sudo vi /etc/NetworkManager/conf.d/wifi-powersave-off.conf

Inside the file, write:

[connection]
wifi.powersave = 2

Save and close the file.

Next, restart the NetworkManager service with:

sudo systemctl restart NetworkManager

Setting Up Asus Utilities

In order to make the most out of your Asus ROG Strix hardware, we will install some additional utilities. The first step is to add the Asus-linux repository:

sudo dnf copr enable lukenukem/asus-linux

Now, install the Asus-linux utility and make sure your system is up to date:

sudo dnf install asusctl supergfxctl sudo dnf update --refresh

After the installation, enable the supergfx service:

sudo systemctl enable supergfxd.service

Then, start the service:

sudo systemctl start supergfxd

Install the ROG Control Center (GUI) to have a graphical interface for the Asus ROG utilities:

sudo dnf install asusctl-rog-gui

Install GNOME Extensions

To further enhance your user experience, install some GNOME extensions. One particular extension we recommend is ‘supergfxctl-gex’. You can install it from this link.

That’s it! You have now installed Fedora Linux on your Asus ROG Strix and configured it for optimal use. The system is now ready for you to explore and conquer. Enjoy the power of Linux!

Install V2Ray on Linux

bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)

/etc/systemd/system/v2ray.service

[Unit]
Description=V2Ray Service
Documentation=https://www.v2fly.org/
After=network.target nss-lookup.target

[Service]
User=nobody
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/local/bin/v2ray run -config /usr/local/etc/v2ray/config.json
Restart=on-failure
RestartPreventExitStatus=23

[Install]
WantedBy=user. Target
installed: /usr/local/bin/v2ray
installed: /usr/local/share/v2ray/geoip.dat
installed: /usr/local/share/v2ray/geosite.dat
installed: /usr/local/etc/v2ray/config.json
installed: /var/log/v2ray/
installed: /var/log/v2ray/access.log
installed: /var/log/v2ray/error.log
installed: /etc/systemd/system/v2ray.service
installed: /etc/systemd/system/[email protected]
systemctl enable v2ray; systemctl start v2ray

Remove V2Ray

# bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh) --remove

References
https://github.com/v2fly/fhs-install-v2ray