Ubuntu Developer Desktop — 2022 Edition [Updated]
NOTE BEFORE YOU CONTINUE READING The intent of this article is to document the setup of my development Ubuntu 22.04 LTS virtual desktop. If you follow any of the instructions provided or advice, you do so at your own risk. All opinions expressed are my own and not the views of my employer.
On April 21, 2022, Canonical the makers of Ubuntu released version 22.04 LTS (long term support) which features, according to their blog post, “…significant leaps forward in cloud confidential computing, real-time kernel for industrial applications, and enterprise Active Directory, PCI-DSS, HIPAA, FIPS and FedRAMP compliance — raising the bar for open source from cloud to edge, IoT and workstations”.
I’ve been given an old Intel-based laptop that the user wanted to trash. Perfect to be resurrected with Linux! It has an Intel Core (TM) i5–5200U CPU @ 2.20 GHz, 4 GB DDR3 RAM and a 512 GB mechanical hard drive. I have an old Kingston 256GB SSD drive that I replaced the mechanical drive with and I’m checking the local electronics store for 4GB more of RAM. Still researching, but this PC could be set up with 16GB RAM. More memory is ALWAYS better for development, but not necessary at this point.
Ordered the following from Amazon, we’ll see what happens when it gets here:
We don’t have to wait for the memory to arrive, the laptop should adequately function using just the 4 GB RAM.
[Update]
The RAM arrive (thanks Amazon) and popped it into the laptop — removed the single 4 GB RAM module and installed to two sticks 8 GB modules for a total of 16 GB RAM! Now we’re getting somewhere! With the additional RAM, we can and should install a few more (memory-intensive) apps!
As always, after a fresh installation of Ubuntu, the first command you should run to update the included software! Launch a new Terminal window then enter the following to check for any updates:
sudo apt update -y && sudo apt upgrade -y
Perquisites
Sometimes you will find the apt
(or apt-get
) package manager may lag a little behind in the latest version. One way to overcome this obstacle is to compile the application from source (and because it’s fun). Let’s install some development utilities, tools, and languages to assist:
$ sudo apt-get install -y build-essential checkinstall
$ sudo apt-get install -y libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
$ sudo apt install libz-dev -y libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext cmake gcc
Upgrade Linux Kernel
Ubuntu 22.04 comes with kernel v5.15 which is awesome, but I always like to have the latest so let’s download the kernel v6.0 which was released on October 2, 2022, with the following noteworthy features: chip hardware support, timer registers, and the XFS file systems.
Open a new Terminal window and move to the tmp
folder. You will need to download the files to this folder to upgrade to the latest kernel:
$ cd /tmp
Next, we need to download the required installation files. Type the following commands in the Terminal window.
NOTE: It is recommended not upgrading to the latest kernel if you are a production machine. Do so at your own risk!
$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.0/amd64/linux-image-unsigned-6.0.0-060000-generic_6.0.0-060000.202210022231_amd64.deb
$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.0/amd64/linux-modules-6.0.0-060000-generic_6.0.0-060000.202210022231_amd64.deb
$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.0/amd64/linux-headers-6.0.0-060000-generic_6.0.0-060000.202210022231_amd64.deb
$ wget https://kernel.ubuntu.com/~kernel-ppa/mainline/v6.0/amd64/linux-headers-6.0.0-060000_6.0.0-060000.202210022231_all.deb
Now, let’s upgrade using the following command:
$ sudo dpkg -i *.deb
After the upgrade has been completed, I recommend rebooting. Log back in, start a new Terminal window, then enter the following command to check the installed version:
$ uname -r
Source Control
Git is immensely popular around the world for several reasons that are not really in the scope of this article. apt
provides an older version of git which is why we are going to install from source. We will switch to the temporary folder, install curl
for downloading files from the Internet using the command-line. We will download the latest version of git
at the time of writing which is v2.38.1.
$ cd /tmp
$ sudo apt-get install curl
$ curl -o git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.38.1.tar.gz
Let’s unpack the downloaded compressed file by executing the following command:
$ tar -zxf git.tar.gz
Switch to the unpacked directory using the following command:
$ cd git-2.38.1/
Compile then install git (the first line of the output should show the version being compiled):
$ sudo make prefix=/usr/local all
$ sudo make prefix=/usr/local install
Once the install has completed, you can use the following command to confirm the version of Git that is installed:
$ git --version
Enter the following commands to globally configure your new git install:
$ git config --global user.name "Full Name"
$ git config --global user.email "email@domain.com"
$ git config --global init.defaultBranch main
You can check your configuration by typing:git config --list
Rust
The Rust language is becoming exceedingly popular for building all sorts of stuff usually built using C and C++. I am learning a little bit at a time (bought a few books on Amazon). It is easy to install (you can grab the script from the website). At the time of authoring this article, I used the following to install:
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Python
One of the world’s most popular programming languages. You will need to build from source because the packaged version lags the latest release. At the time of writing, the current version is 3.11.0.
$ cd /usr/src
$ sudo wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz
Unpack the download using the following command:
$ sudo tar xzf Python-3.11.0.tgz
Move to the newly unpacked directory by entering the following command:
$ cd Python-3.11.0
The new flag --enable-optimizations
sets the default make targets up to enable Profile Guided Optimization (PGO) and may be used to auto-enable Link Time Optimization (LTO) on some platforms:
$ sudo ./configure --enable-optimizations
I tend to overwrite and use only the latest version of Python:
$ sudo make install
You can verify the installation by checking the version with the following command:
$ python3 --version
Less typing is always better, so I tend to use alias
to help me type lesspy
instead of python3
. Luckily, the following command makes it a reality:
$ alias py=python3
Terminal Bling!
We should install Oh My Posh, which provides a genuinely nice makeover for the Terminal:
$ sudo wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O /usr/local/bin/oh-my-posh
$ sudo chmod +x /usr/local/bin/oh-my-posh
Download the themes:
$ mkdir ~/.poshthemes
$ wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/.poshthemes/themes.zip
$ unzip ~/.poshthemes/themes.zip -d ~/.poshthemes
$ chmod u+rw ~/.poshthemes/*.omp.*
$ rm ~/.poshthemes/themes.zip
Ready To Configure
$ oh-my-posh get shell
Download Nerd Font!
According to the Oh My Posh site, it “was designed to use Nerd Fonts. Nerd Fonts are popular fonts that are patched to include icons. We recommend Meslo LGM NF”.
Oh My Posh has a CLI to help users easily install a Nerd Font (WARNING: this feature is in beta):
$ oh-my-posh font install
Reboot.
Select the hamburger menu then Preferences:
Then select the “Unnamed” option under Profiles:
Select the Melso font then click the Select button.
Bash
Add the following to ~/.bashrc
(could be ~/.profile
or ~/.bash_profile
depending on your environment):
eval "$(oh-my-posh init bash)"
You will be prompted to save any changes to the configuration file:
Press <Enter>
to confirm overwriting the file.
Once added, reload your profile for the changes to take effect:
$ exec bash
You should see something similar less the username (:)
NodeJS
Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. At the time of drafting this article, the latest version was 15.10.0. Node is an extremely popular framework, and you can install using the following commands in a Terminal window:
$ sudo apt install curl -y
$ curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
$ sudo apt-get install -y nodejs
Install the .NET SDK
I’m a .NET developer. I really like the Microsoft .NET framework and related technologies. I always install the latest version even on my Linux instances. In this case, the latest version is 7, but I am leaning towards the previous version .NET 6 which is marked LTS, so has updates for the next 3 years! Luckily, to install on your Ubuntu instance, is as simple as the following command:
$ sudo apt-get install -y dotnet6
Go
Use the following command to install the Go programming language:
$ sudo apt install golang-go -y
GNOME Tweaks
Visual Studio Code
Now let’s install an IDE that works with all the languages above! My suggestion is to use the built-in software installer to get Visual Studio Code working in your instance!
Postman
If you work with APIs, one of the best tools to use is Postman! I recommend installing the same way as the previous Microsoft Visual Studio Code app.
Gimp
Gimp allows users to modify images Type the following command to install:
$ sudo apt install gimp -y
Media Player
I sometimes need a good media player that can be used to open a play a variety of formats like mp4, mpeg, etc. Enter VLC:
$ sudo apt install vlc -y
Screen Recording
OBS (Open Broadcaster Software) is used for screen recording and live streaming on different social media platforms. Click here for perquisites, here is the command to install:
$ sudo apt install obs-studio -y
Video Editing
You should check out OpenShot which is another popular video editing app compatible on all operating systems including Linux. Use the following command to install:
$ sudo apt install openshot-qt -y
Gaming
Take a break — occasionally! Steam has a massive collection of games online as well as downloaded from their application after buying the subscription of the game. To install it on your Linux instance, execute the command:
$ sudo apt install steam -y
Music
I listen to music to help me stay in the zone. Spotify is an exceptionally large and popular music streaming platform which has a client for Linux:
$ sudo snap install spotify
System Monitor
htop
is an updated version of top
in Linux system. It is run from the command line allowing users to interactively monitor their system’s vital resources in real time.
$ sudo apt install htop -y
Screenshots
Flameshot is described as “a free and open-source, cross-platform tool to take screenshots with many built-in features to save you time”, using the link to install: Flameshot | Open Source Screenshot Software:
$ sudo snap install flameshot
JetBrains
JetBrains produces great development software and I have been a long-time fan and customer! This is paid software and well-worth the cost of a license.
Antivirus
ClamAV is a capable antivirus application for Linux that can detect many types of malwares but can only be used from the command line. Even with Linux, you should consider some sort of virus protection, and this might be the most minimum recommendation. Type the following command to install:
$ sudo apt install clamav clamav-daemon -y
Run this command to check if installed correctly:
$ clamscan --version
Document Viewer
Evince is a simple multi-page document viewer you can use to view PDFs, PS, EPS, XPS, etc.
$ sudo apt -y install evince
Database
I’ve been using SQL Server as a developer for many years. Most recently, I have been leaning towards PostgreSQL as the open-source database of choice (previously using MySQL for a few years).
Install SQL Server
You can install SQL Server on Linux! To configure SQL Server on Ubuntu, run the following commands in a Terminal. Import the public repository GPG keys:
$ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Register the SQL Server Ubuntu repository:
$ sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2022.list)"
Learn more about configuration and setup here: Ubuntu: Install SQL Server on Linux — SQL Server | Microsoft Learn
Install PostgreSQL
Refresh your server’s local package index:
$ sudo apt update -y
Install Postgres package along with a -contrib
package which adds some additional utilities and functionality:
$ sudo apt install postgresql postgresql-contrib -y
Ensure that the server is running using the systemctl start
command:
$ sudo systemctl start postgresql.service
Switch over to the postgres
account on your server by typing:
$ sudo -i -u postgres
Access the PostgreSQL prompt by typing:
postgres=# SELECT version();
[Update]
Nginx
I really like Nginx on Ubuntu — if you don’t know — it is a highly-popular performance web server (Apache is OK, but Nginx offers fantastic performance) and includes a reverse proxy perfect for hosting high-traffic websites!
$ sudo apt install nginx
Use the following command to verify the service is running correctly:
$ sudo systemctl status nginx
PHP
Ubuntu 22.04 LTS ships with PHP version 8.1 available in its repositories.
$ sudo apt install php8.1 php8.1-fpm php8.1-mysql php-common php8.1-cli php8.1-common php8.1-opcache php8.1-readline php8.1-mbstring php8.1-xml php8.1-gd php8.1-curl
After all components are installed, run the following command to start and configure PHP-FPM (FastCGI Process Manager), a hugely popular alternative PHP (Hypertext Processor) FastCGI implementation:
$ sudo systemctl start php8.1-fpm
$ sudo systemctl enable php8.1-fpm
Runt he fllowing command to check that it is running:
$ sudo systemctl status php8.1-fpm
You will need to the default Nginx virtual-host file to configure Nginx to start using PHP.
$ sudo nano /etc/nginx/sites-enabled/default
You config may differ, but should be similar to the following:
server {
listen 80 default_server;
listen [::]:80 default_server;
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
}
Verify the Nginx settings are okay using the command:
$ nginx -t
My output produced warnings of access, I like to keep the access like it is so I ignored the waning, but feel free to change your permissions to match your preference.
Restart the service:
$ sudo systemctl restart nginx php8.1-fpm
Let’s create a test PHP file to ensure we have configured everything correctly:
$ cd /var/www/html
$ sudo nano info.php
Enter the following PHP markup and save the file:
<?php phpinfo(); ?>
Open your favorite web browser then enter the following:
http://server-ip/info.php
You should see something similar:
Enjoy!