Xubuntu installation notes for .NET Core development
Preparation
Why Xubuntu?
Because Manjaro is based on Arch which doesn’t have an official .NET Core distribution, and it seems that there are too many hoops to jump to make it work: https://www.reddit.com/r/archlinux/comments/cx64r5/the_state_of_net_core_on_arch/
Xubuntu contains Xfce user interface which is faster than GNOME used in the default Ubuntu.
Preparing the PC
Turn off Fast Boot in Windows. Go to Power Options / Change what buttons do. Click the link above to enable all options and untick fast boot in the bottom.
Reboot and get into computer’s boot menu. Find an option to disable UEFI secure boot.
This will make the hard drive accessible in Linux.
Installation
Proceed as usual.
General post-install
Update apt
and install, if needed, some generic programs.
sudo apt update
sudo apt install curl
On Snap
There is now a higher-level app distribution system called snap
.
It is universal for all Linuxes, and apps
it installs are self-contained (i.e. they don’t have dependencies
on anything else). Plus, they are automatically updated
in the background. The main issue with this approach
is that the containers are compressed and applications
are decompressed on-the-fly which may cause slowness.
So, if the application is big, needs to be auto-updated
and doesn’t exist in apt
, use snap
.
If the application requires critical start-up time,
and is not updated regularly, use apt
.
For example:
sudo snap install telegram-desktop
Whisker menu shortcut
The Start-like menu available in the top-left corner is not openable by the Start button on the keyboard by default. To make it work:
Open the Whisker menu using mouse.
Search for «Keyboard». Go to the shortcuts tab.
Add a new entry for
xfce4-popup-whiskermenu
and press the Start button when required.
Tearing (v-sync)
There is a visible tearing when scrolling in Firefox. One may reference the issues as v-sync being off. To fix it:
Disable XFCE’s built-in compositor. Open the Whiskers menu, search for «Window Manager Tweaks». Switch to «Compositor» tab and uncheck the topmost «Enable display compositing» checkbox.
Install
compton
:sudo apt install compton
Open its config file:
nano ~/.config/compton.conf
Copy the config file contents from this link: (https://paste.ubuntu.com/24154385/). Paste it to the file (with
Shift+Ins
) and save it (Ctrl+O
,Ctrl+X
).Run
compton
:compton &
Make
compton
autostart. Search for «Session and Startup» in the Whisker menu, go to «Application Autostart» and add a new entry. Use «Compton» for name andcompton
for command.
(Based on this link).
Redshift
This application makes screen warmer at night, just like f.lux or NightShift on other platforms.
Install:
sudo apt install redshift redshift-gtk
Create its configuration file:
Store the following there:mkdir ~/.config/redshift nano ~/.config/redshift/redshift.conf
[redshift] temp-day=5700 temp-night=2700 fade=1 location-provider=geoclue2
Configure
geoclue2
so thatredshift
would be able to use it:And add the following in the bottom:nano /etc/geoclue/geoclue.conf
[redshift] allowed=true system=false users=
Run it:
redshift-gtk &
Add it to autostart. Open the Whisker menu and search for «Session and Startup». Switch to «Application Autostart» tab. You’ll see Redshift there unchecked. Check it so that it starts on next logging in.
(If this doesn’t work, there is also an option to use cron
scheduler.
See this link for details.)
File watchers limit
By default it is 8192, and npm run start
won’t work
in create-react-app
-based projects.
Run the following:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Non-development
Brave Browser
It has a page on installing on Ubuntu. They also have a Snap package, but it’s not as stable.
sudo apt install apt-transport-https curl
sudo curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main"|sudo tee /etc/apt/sources.list.d/brave-browser-release.list
sudo apt update
sudo apt install brave-browser
Dropbox
curl -o ~/Downloads/dropbox.deb -L https://www.dropbox.com/download?dl=packages/ubuntu/dropbox_2020.03.04_amd64.deb
sudo apt --fix-broken install
sudo dpkg -i ~/Downloads/dropbox.deb
Development
.NET Core SDK
Follow the instructions from (https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#2104-).
Detailed:
wget https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update; \
sudo apt-get install -y apt-transport-https && \
sudo apt-get update && \
sudo apt-get install -y dotnet-sdk-5.0
Check that it got installed:
dotnet --version
Install Entity Framework Core tools
dotnet tool install --global dotnet-ef
Disable telemetry
Open the profile file
nano ~/.profile
and add the following line to it:
export DOTNET_CLI_TELEMETRY_OPTOUT=1
Git
As usual,
sudo apt install git
Remember to add your name:
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
GitHub SSH configuration
Follow their guide (https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent).
But in general:
ssh-keygen -t ed25519 -C "your_email@example.com"
more .ssh/id_ed25519.pub
And then add the key in GitHub settings.
Remember to clone using git
protocol, not https
.
Branch name in command prompt
Open
.bashrc
:nano ~/.bashrc
Find this section:
if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt
Comment it out by prepending
#
to each line.Paste the following instead
parse_git_branch() { git symbolic-ref HEAD --short 2> /dev/null | sed -e 's/.\*/(\0)/' } if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w $(parse_git_branch)\$ ' fi
The branch will be visible in new terminal windows.
Visual Studio Code
sudo snap install code --classic
(--classic
means manual approval of the fact that the snap
package will operate outside of sandbox.)
Notes
There is an alternative FOSS build Codium (https://github.com/VSCodium/vscodium/), but the Microsoft C# debugger works only in Code, so it’s not an option for us.
Node.js
Run the predefined script that would install the repository:
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
Install:
sudo apt install -y nodejs
Via Snap
As an alternative, one may install it from Snap. This version has 300ms slower start-up time. This command below installs Node version 12 which is becoming the current LTS version in October 2019.
sudo snap install node --classic --channel=12
PostgreSQL
Add their repository to
apt
. Create the file:sudo nano /etc/apt/sources.list.d/pgdg.list
Add the following line to it:
deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
Import the repository signing key, and update the package lists.
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt update
Install the server, the client and the management tool.
sudo apt install postgresql-11 postgresql-client-11 pgadmin4
The default set up user is called
postgres
. This is an example of how to create a custom userlocal
and set its password tolocalpass
.sudo -i -u postgres createuser --interactive Enter name of role to add: local Shall the new role be a superuser? (y/n) y psql ALTER USER local WITH PASSWORD 'localpass'; exit exit
Powershell
# Install PowerShell
sudo snap install powershell --classic
# Start PowerShell
pwsh
JetBrains Rider
sudo snap install rider --classic
Docker
Follow guide from https://docs.docker.com/install/linux/docker-ce/ubuntu/. The brief version is:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
Then, to make docker
runnable by a local user your-user
:
sudo usermod -aG docker ${USER}
This will take effect after restart.
Azure CLI azure-cli
sudo apt --fix-broken install
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
See also: (https://docs.microsoft.com/ru-ru/cli/azure/install-azure-cli-linux?pivots=apt)
Azure Data Studio
Cross-platform SSMS alternative. Is provided as a .deb package. First install the prerequisites:
sudo apt install libxss1 libgconf-2-4 libunwind8
Then go to the installation page and click the .deb file. Instead of saving, choose to open it with the package manager.
Alternatively:
curl -o ~/Downloads/azuredatastudio.deb -L https://go.microsoft.com/fwlink/?linkid=2165738
sudo dpkg -i ~/Downloads/azuredatastudio.deb
Run:
azuredatastudio
Azure Storage Explorer
sudo snap install storage-explorer
sudo snap connect storage-explorer:password-manager-service :password-manager-service
SQL Server Developer Edition
Requires Docker. Pull the package:
docker pull mcr.microsoft.com/mssql/server:latest
Run:
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=lowerUPPER123' -p 1433:1433 --name mssql -d mcr.microsoft.com/mssql/server:latest
This outputs the container’s hash. If the server closes right after start, check the logs using the hash.
docker logs (container's hash)
Minor
Fonts
Fira Code
sudo apt install fonts-firacode
Then follow the instructions for VS Code: https://github.com/tonsky/FiraCode/wiki/VS-Code-Instructions