Setup Fedora machine
Introduction
Section titled “Introduction”Here is a comprehensive list of pieces of software and tools you need to getting started with a Fedora-based Linux machine.
Fedora uses dnf
as package manager.
If you came from Ubuntu, take a look at APT vs. DNF commands.
Add user to sudo
Section titled “Add user to sudo”It could happen that the current user has no root privileges.
Every Linux machine has at least root
user.
# login current terminal as root user ('sudo su' command could not work)su - root
# add given user to sudo groupusermod -aG sudo <non-sudo-user>
# check which users have sudo permissionsgetent group sudo
Run a Service at boot with systemctl
Section titled “Run a Service at boot with systemctl”Running services at boot a common use of systemctl
, especially in servers.
You can tell a service to run at startup by typing:
sudo systemctl enable yourservice
If you need to disable a service:
sudo systemctl disable yourservice
If the service isn’t found, you may need to point to its direct file path with:
sudo systemctl enable /path/to/yourservice.service
However, this won’t work if the file isn’t on the root file system.
Balena Etcher
Section titled “Balena Etcher”This tool allows you to write bootable SD card or USB drives starting from an .ISO
file.
It comes in help when working with Raspberry Pi or any Linux distributions.
# update the systemsudo dnf upgrade --refresh
# (optional) install curl utilitysudo dnf install -y curl
# import the repositorycurl -1sLf 'https://dl.cloudsmith.io/public/balena/etcher/setup.rpm.sh' | sudo -E bash
# install balenaEtchersudo dnf install balena-etcher
Docker Engine
Section titled “Docker Engine”Follow the official documentation: install engine on Fedora
# 1) Uninstall old versionssudo dnf remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-selinux docker-engine-selinux docker-engine
# 2) Install using the repository# 2.1) set up the repositorysudo dnf -y install dnf-plugins-coresudo dnf config-manager \ --add-repo \ https://download.docker.com/linux/fedora/docker-ce.repo
# 3) Install Docker Enginesudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
If prompted to accept the GPG key, verify that the fingerprint matches:
060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35
Let’s start and test Docker:
sudo systemctl start docker
Take care to follow Docker Engine post-installation steps to manage Docker as non-root user.
Start Docker on boot
Section titled “Start Docker on boot”Many modern Linux distributions use systemd
to manage which services start when the system boots.
To automatically start docker
and containerd
on boot, run the following commands:
sudo systemctl enable docker.servicesudo systemctl enable containerd.service
# disable the "start on boot" behavioursudo systemctl disable docker.servicesudo systemctl disable containerd.service
Manage Docker as a non-root user
Section titled “Manage Docker as a non-root user”Create the docker
group and add your user:
sudo groupadd dockersudo usermod -aG docker $USER
Log out and log back in so that your group membership is re-evaluated. You can also run the following command to activate the changes to groups:
newgrp docker
git
is a VCS (Version Control System) created by Linus Torvalds.
Version control systems is used to track changes in a directory over the time. Nowadays, they’re used to maintaining the history of all the software products’ codes. To allow several developer to work on the same code, a VCS must rely on platform like GitHub or GitLab where the code is uploaded and versioned.
The key features that a VCS must provide are:
- Maintain independent branches of code for team members
- Ease of comparison of code across different branches
- Merging of code from several branches of multiple team members
- Annotate changes with the name of author and message in a version of the code
- Simple comparison across versions
- Revert changes made to the code to any state from its history
To install git
and its extension git-flow
, you need to type:
# https://git-scm.com/download/linuxsudo dnf install -y git# should be already installed
# https://copr.fedorainfracloud.org/coprs/elegos/gitflow/# enable the copr repositorysudo dnf copr enable elegos/gitflow
# install gitflowsudo dnf install -y gitflow
# Large File Support extension: https://git-lfs.github.com/sudo dnf install -y git-lfs
Configure global settings like email, name and commands colorization:
# set the email that will be attached to your commitsgit config --global user.email "you@example.com"
# set the username that will be attached to your commitsgit config --global user.name "Your Name"
# enable helpful colorization for command line outputgit config --global color.ui auto
# set merge as git pull default policgit config --global pull.rebase false
# show the customized valuesgit config --global --list
Configure SSH client
Section titled “Configure SSH client”It’s better to have a different pair of SSH keys foreach server (i.e. GitHub, GitLab, BitBucket, self-hosted, …) you connect to.
Let’s start:
cd ~/.ssh/
# generate a new keyssh-keygen -t ed25519 -C "I am the key label"
It will output:
# Generating public/private ed25519 key pair.# Enter file in which to save the key (/home/$USER/.ssh/id_ed25519):
If you accept the default files location, their names will contain the encryption algorithm name. If you need to use multiple SSH key, it’s better to have the provider’s name inside file names.
Specify the new name after :
sign of the line above.
# /home/$USER/.ssh/id_[PROVIDER]
# Example: add GitLab.com SSH key/home/$USER/.ssh/id_gitlab
You can also rename the files later on. Remind to rename both the private and public keys:
# mv id_[ALGORITHM] id_[PROVIDER]# mv id_[ALGORITHM].pub id_[PROVIDER].pub
Once you have both private and public keys, you’re read to start ssh-agent
in background:
eval "$(ssh-agent -s)"
# add your SSH private key to the ssh-agentssh-add id_gitlab# ssh-add id_[PROVIDER]
# show the content to copycat id_gitlab.pub# cat id_[PROVIDER].pub
Copy the public key and add in the right place inside the website of the server provider.
Here are the most used git
providers’ guides:
Create a configuration file foreach server provider you need, even the self-hosted ones.
nano config
My config
file looks like
Host github.com HostName github.com User git IdentityFile ~/.ssh/id_github IdentitiesOnly yes
Host gitlab.com HostName gitlab.com User git IdentityFile ~/.ssh/id_gitlab IdentitiesOnly yes
Host bitbucket.org HostName bitbucket.org User git IdentityFile ~/.ssh/id_bitbucket IdentitiesOnly yes
Configure SSH remote access
Section titled “Configure SSH remote access”By default, remote access via SSH is not allowed.
# it should already be installedsudo dnf install -y openssh-server
# check the versionrpm -qa | grep openssh-server
# allow SSH daemon to start at bootsudo systemctl enable sshd
# manually start SSH daemon to avoid rebooting the computersudo systemctl start sshd
# check the status of SSHsudo systemctl status sshd
# should see the port 22 open for a new incoming connectionssudo ss -lt
# connect to a SSH server# ssh <username>@<ip_address>
You can now move files or directories with rsync
utility.
# rsync <file/directory> <username>@<ip_address>:<destination># for examplersync my-file.log remote-pit@192.168.0.100:/home/remote-pit/Downloads
GCC stands for as GNU Compiler Collection. It includes front ends for C, C++, Objective-C, Fortran, Ada, Go, and D, as well as libraries for these languages.
GCC helps you write and execute programs in Linux.
sudo dnf install -y gcc
Node Package Manager
Section titled “Node Package Manager”NPM is a must-have tool when developing Web applications.
Starting from Fedora 24, npm
is a part of Node.js package and does not need to be installed separately.
Therefore, to install both the utilities, run:
sudo dnf install -y nodejs
By default, it will install Node’s LTS:
npm --version# 9.5.0
node --version# v18.15.0
You can manage multiple Node.js versions with nvm
.
Node Version Manager is a bash script you can install using yarn
.
Please refer Installing and Updating guide.
Useful programming language to build cross-platform desktop application. Java is already installed in Fedora:
java --versionopenjdk 17.0.6 2023-01-17OpenJDK Runtime Environment (Red_Hat-17.0.6.0.10-1.fc38) (build 17.0.6+10)OpenJDK 64-Bit Server VM (Red_Hat-17.0.6.0.10-1.fc38) (build 17.0.6+10, mixed mode, sharing)
Postman
Section titled “Postman”Postman is an API platform for building and using APIs. It simplifies each step of the API lifecycle and streamlines collaboration, so you can create better APIs faster.
# should already be installedsudo dnf install -y wget tar
# download the archivewget https://dl.pstmn.io/download/latest/linux_64
# I don't like the way it has installed the archive (need to investigate)tar -xvzf linux_64 # will create a Postman directory
# move to the appropriate directorysudo mv Postman /opt/cd /opt/Postman/./Postman
It could be useful to craete an alias inside the Shell configuration file (like .bashrc
).
ZSH Shell & Oh-My-ZSH
Section titled “ZSH Shell & Oh-My-ZSH”Replace Bourne Shell with a more advanced shell, like ZSH:
sudo dnf install -y zsh fzf
zsh --version # check versionzsh 5.8.1 # (...)echo $SHELL# /bin/bash
chsh -s $(which zsh)
Logout and login to let the change take effect.
echo $SHELL
Install Oh-My-ZSH extension to have better code completions:
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Many themes require Powerline Font or Nerd Font. Take a closer look when choosing the shell theme.
Moreover, I suggest you to add the following plugins to .zshrc
file:
plugins=( git emotty emoji zsh-interactive-cd zsh-autosuggestions zsh-syntax-highlighting)
To enable the changes, run:
source ~/.zshrc
Please Note: If you get this error:
[oh-my-zsh] plugin 'zsh-autosuggestions' not found[oh-my-zsh] plugin 'zsh-syntax-highlighting' not found
Run those commands:
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestionsgit clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlightingsource ~/.zshrc
It’s also suggested to set a default bahaviour for oh-my-zsh update policy. I choose to update automatically without asking:
# Uncomment one of the following lines to change the auto-update behavior# zstyle ':omz:update' mode disabled # disable automatic updateszstyle ':omz:update' mode auto # update automatically without asking# zstyle ':omz:update' mode reminder # just remind me to update when it's time
IDE stands for Integrated Development Environment. They’re tools that helps you while programming and allow you to be more productive, efficient and effective.
Android Studio
Section titled “Android Studio”Android Studio is the official IDE for Android application development.
The easiest way is by using JetBrains’ ToolBox or from snap
store.
On most Linux machine, you can also configure hardware acceleration for the Android Emulator. Moreover, if you have enough RAM, I strongly suggest to increase heap size to allow a better coding experience.
Arduino IDE 1.x
Section titled “Arduino IDE 1.x”Go to software section of official Arduino website. Download the version labelled Linux 32 bits (or 64 bits, if your machine supports it).
Open a terminal window:
# navigate to Downloads directorycd ~/Downloads
# extract the archive contentstar -xvf arduino*.tar.xz
# remove the archiverm -rf arduino*.tar.xz
# move the extracted folder from $HOME/Downloads to /opt/sudo mv arduino* /opt/arduino
# complete the installationsudo /opt/arduino/install.sh
Moreover, you need to allow your current user to use the serial communication to communicate with the Arduino boards.
Add yourself to the dialout
group:
sudo usermod -a -G dialout $USER
Please Note:
- Logout and then log back in for the group changes to take effect (or just
sudo restart
the machine). - If you accidentally stop the sketch from uploading, you just need to double-click the reset button (reference).
Arduino IDE 2.x
Section titled “Arduino IDE 2.x”Download the Arduino IDE 2.0 from the official software page.
Then, follow the steps below:
cd ~/Downloads
# extract the archive contents to the right sub-directory in /opt/sudo unzip arduino-ide_2*.zip -d /opt/arduino2
# remove the archiverm -rf arduino*.zip
# run the IDE (mandatory without sudo)/opt/arduino2/arduino-ide
# Hit Ctrl + C to stop the execution of the IDE
Depending on your shell type, open the configuration file (.bashrc
, .zshrc
, …) and add the following alias:
alias arduino2="/opt/arduino2/arduino-ide"
You can now run Arduino IDE 2.x by using the command:
arduino2
Fritzing
Section titled “Fritzing”Fritzing is an easy-to-use electronic design software.
Luckily, there’s an apt
package for it:
sudo dnf install -y fritzing
JetBrains IDEs
Section titled “JetBrains IDEs”JetBrains is a software house which develop several IDEs. Unfortunately, they’re closed source pieces of software. They’re very similar to one another and are nearly one for each programming language (or framework). The most famous are:
- IntelliJ IDEA for Java
- PhpStorm for PHP and its frameworks
- PyCharm for Python
- WebStorm for JavaScript, TypeScript, HTML, CSS and the web in general
There are some “Community” versions which are available for free. You can use them with a Student Licensee or buy the standard license.
JetBrains also developed Toolbox App. It helps you to easily install, update automatically, update the plugins together with IDE, roll back and downgrade.
Dowload the latest .tar.gz
archive from download link and run those commands:
cd ~/Downloads
# use wget utility only for downloading a package at a specific version# wget https://download-cdn.jetbrains.com/toolbox/jetbrains-toolbox-1.28.1.15219.tar.gz
# estract the archivetar -zxvf jetbrains-toolbox*.tar.gz
# delete the archiverm jetbrains-toolbox*.tar.gz
# move to /opt/ directorysudo mv jetbrains-toolbox* /opt/jetbrains-toolbox
# run the installer/opt/jetbrains-toolbox/./jetbrains-toolbox
# the command above perform the two below at the same timecd /opt/jetbrains-toolbox./jetbrains-toolbox
MATLAB & Simulink
Section titled “MATLAB & Simulink”MATLAB (abbreviation of “MATrix LABoratory”) is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data. It allows algorithms’ implementation, creation of UIs and interfacing with programs written in other languages.
Simulink is a MATLAB-based graphical programming environment for modeling, simulating and analyzing multi-domain dynamical systems.
You need to have a MathWorks account to install MathWorks’ products.
Go to Download page and download the .zip
Linux installer.
sudo dnf install -y unzip
cd ~/Downloads
# create a folder to extract filesmkdir matlab
# unzip the MATLAB fileunzip -qq matlab*.zip -d matlabcd matlab
# launch installer with sudo permissionssudo ./install
# if the graphical installer does not startsxhost +SI:localuser:root && sudo ./install
Once the graphical installer starts, follow the steps below:
- Login with MathWorks Account
- Select the available License
- Select Matlab Products or Toolbox to install
- Select the Destination address
The default is:
/usr/local/MATLAB/R2023a/bin
Where R2023a
refers to the release year and version (usually a
and b
).
Please Note: Set as username the actual name of the user logged-in in the computer. You can find you name by launching this command in a Terminal window:
echo $USER
Create MATLAB Symbolic link with:
sudo ln -s /usr/local/MATLAB/R2023a/bin/matlab /usr/local/bin/matlab
Create Matlab Desktop Shortcut Linux with:
nano ~/Desktop/Matlab.desktop
Edit the file as follows:
[Desktop Entry]Version=1.0Type=ApplicationName=MATLABExec=/usr/local/MATLAB/R2023a/bin/matlabIcon=/usr/local/MATLAB/R2023a/resources/coreui/matlab/splash.pngTerminal=false
Save the Desktop Shortcut file by pressing Ctr + X
and the type Y
followed by the Enter Key.
Go to the Desktop, right-click on the created file and select the “Allow Launching” option for the desktop entity.
You can now launch MATLAB by double-clicking the desktop icon.
Once the installation is complete, remind to clear the Downloads directory:
cd ~/Downloads
rm -rf matlab*.zip matlab
Install new toolboxes after installation
Section titled “Install new toolboxes after installation”If you try to install new toolboxes using Add-Ons manager, it will throw errors since you have not write access to /usr/local/MATLAB/
.
If you launch MATLAB as root
user, it will throw a License Manager Error -9 Your username does not match the username in the license file.
The correct solution is to set the permission for the current user:
sudo chown -R $USER /usr/local/MATLAB/
Now the user has write access: use the Add-Ons manager carefully! After installing the desired toolboxes, revert the permission change for security reason:
sudo chown -R root /usr/local/MATLAB/
Mbed Studio
Section titled “Mbed Studio”Mbed OS is an operative system tailored for IoT devices provides. It provides APIs to develop C++ application, tools, code examples, libraries and drivers for common components.
Mbed Studio is the official IDE for Mbed OS.
cd ~/Downloadswget https://studio.mbed.com/installers/latest/linux/MbedStudio.shchmod +x MbedStudio.sh./MbedStudio.sh -y -f # -y option accepts all license agreements, -f generates a log of the installation
OpenMV
Section titled “OpenMV”OpenMV project is about creating low-cost, extensible, Python powered, machine vision modules. It aims to become the Arduino of Machine Vision.
Go to Download page and select the installer based on your operating system and architecture version.
It will download a .run
file. Open a Terminal and prompt the following commands:
cd ~/Downloads
# rename since long file names are bad to visualizemv openmv-ide-*.run openmv-ide.run
# give the file execute permissionchmod +x openmv-ide.run
# launch, follow the installer instructions./openmv-ide.run
# remove the installerrm openmv-ide.run
Telegram
Section titled “Telegram”Telegram is a well-known GPL v3-licensed messagging app.
# navigate to Downloads directorycd ~/Downloads
# download the archivewget https://updates.tdesktop.com/tlinux/tsetup.4.8.4.tar.xz
# extract the archive contentstar -xvf tsetup.4.8.4.tar.xz
# delete the archive and move the extracted directory to /opt/sudo rm tsetup.4.8.4.tar.xzsudo mv Telegram /opt
# run Telegram app/opt/Telegram/./Telegram
I suggest you to create an alias with the last command or add it to startup scripts. You can also run it in the background silenced using:
/opt/Telegram/./Telegram </dev/null &>/dev/null &
Typora
Section titled “Typora”Typora is one of the most powerful Markdown and LaTeX editor I’ve ever seen.
wget https://download.typora.io/linux/Typora-linux-x64.tar.gz
# estract the archivetar -zxvf Typora-linux-x64.tar.gz
# it will estract everything in a directory called bin/# move its content in /opt/sudo mv bin/Typora-linux-x64 /opt/typora
# remove unnecessary filesrm -rf Typora-linux-x64.tar.gz ./bin
# run Typora/opt/typora/./Typora
Take a look at Theme Gallery and don’t forget to activate inline math support to start write LaTeX inside .md
files!
You can also ad an alias to your configuration file. The alias below launches typora in the background and silenced. The terminal is detached, and you don’t have to open another one to work:
alias typora="/opt/typora/./Typora </dev/null &>/dev/null &"
You can also add the application entry for the App Menu:
# create the entrycd ~/.local/share/applications/touch Typora.desktop
# change permission to filechmod 744 Typora.desktop
Fill Typora.desktop
file with:
[Desktop Entry]Name=TyporaComment=Official Typora applicationTryExec=/opt/typora/TyporaExec=/opt/typora/Typora -- %uIcon=/opt/typora/resources/assets/icon/icon_256x256.pngTerminal=falseStartupWMClass=TyporaType=ApplicationCategories=Text;Qt;MimeType=x-scheme-handler/tg;Keywords=tdesktop;Actions=quit;SingleMainWindow=trueX-GNOME-UsesNotifications=trueX-GNOME-SingleWindow=true
Visual Studio Code
Section titled “Visual Studio Code”Download RMP package of VS Code at download page.
cd ~/Downloads
# use wget utility only for downloading a package at a specific version# wget https://az764295.vo.msecnd.net/stable/6a995c4f4cc2ced6e3237749973982e751cb0bf9/code-1.78.1-1683194632.el7.x86_64.rpm
# install the packagesudo dnf install -y code*.rpm
# remove unnecessary filerm code*.rpm
Conclusion
Section titled “Conclusion”Documentation
Section titled “Documentation”Here is the list of guides and tutorials I used to write this article: