Setting Up a Fedora 31 Workstation for Go Cloud Native Application Development
If you are new to Linux and would like to install the Fedora 31 workstation into an empty hard drive, follow the partitioning page of arch wiki . For a PC with 1Tb hard drive and 16GB ram, we are following bellow partition schema.
▸ 500mb for EFI system partition/ boot loaders: /boot/efi
▸ 50 GB for operating system files: /
▸ 20GB for swap swap
▸ Rest for /home
01. Update your system
~Yeah! First things first 😃
sudo dnf update
02. Installing zsh and powerline
~ Why not?
▸ sudo yum install zsh
▸ sh -c “$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
to install oh-my-zsh.
▸ git clone — depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
to install powerlevel10k theme. And set ZSH_THEME=powerlevel10k/powerlevel10k
in ~/.zshrc
.
▸ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
to install zsh-autosuggestions plugin. And add zsh-autosuggestions
to plugins=()
in ~/.zshrc
.
▸ sudo lchsh $USER
to set zsh as the default shell and restart the terminal.
03. Installing Tilix
~ Tiling terminal matters…
sudo dnf install tilix
04. Installing Golang
~ Let’s Go…
▸ Download the latest go binary via https://golang.org/dl/ .
▸ sudo tar -C /usr/local -xzf ~/Downloads/go1.13.4.linux-amd64.tar.gz
to extract the archive into /usr/local
.
▸ Add following line to ~/.zshrc
file.
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/dev/go
💡
$HOME/dev
is my workspace of saving all codes. You can set this any place you want; The default GOPATH is$HOME/go
.
▸ Run source ~/.zshrc
or restart the terminal.
05. Installing Docker
~ Sorry Podman! 🐳
💡 Fedora 31 has been enabled
cgroupsv2
by default. But, the container ecosystems and cloud native projects are not fully supported for those changes. Even the Docker alternative, Podman is not a fully reliable replacement for Docker. So, we have to disablecgroupsv2
by editing the boot loader.
▸ sudo nano /etc/default/grub
▸ Add systemd.unified_cgroup_hierarchy=0
to GRUB_CMDLINE_LINUX
. ex,
GRUB_CMDLINE_LINUX="resume=UUID=633b0b8a-52ce-4a70-9f1b-397dd10cf148 rhgb quiet systemd.unified_cgroup_hierarchy=0"
▸ ⚠️ sudo grub2-mkconfig > /boot/efi/EFI/fedora/grub.cfg
or only if you not using efi boot sudo grub2-mkconfig > /boot/grub2/grub.cfg
.
Let’s install Docker via .rpm
packages,
▸ Download containerd.io
, docker-ce-cli
and docker-ce
packages from https://download.docker.com/linux/fedora/31/x86_64/stable/Packages/ .
▸ The current version of Docker is 19.03.4, while writing this article. So install them via bellow commands or simply double click on .rpm
files.
sudo dnf install ~/Downloads/containerd.io-1.2.10–3.2.fc31.x86_64.rpm
sudo dnf install ~/Downloads/docker-ce-cli-19.03.4–3.fc31.x86_64.rpm
sudo dnf install ~/Downloads/docker-ce-19.03.4–3.fc31.x86_64.rpm
▸ To install docker-compose, sudo dnf install docker-compose
.
▸ To run Docker without sudo
, sudo gpasswd -a ${USER} docker
.
▸ To start Docker at system boot, sudo systemctl enable docker
.
▸ Reboot the system.
06. Installing kubectl
~Hope you have access for clusters ☸️
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectlchmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
07. Installing Minikube
~ If you want to test cluster deployments locally
Minikube relies on a hypervisor installation like VirtualBox or KVM . Fedora uses the
libvirt
family of tools as its virtualization solution. KVM comes with them. Let’s install them and enable runninglibvirt
tools withoutsudo
,
▸ sudo dnf group install Virtualization
▸ sudo usermod -a -G libvirt $(whoami) && newgrp libvirt
▸ Let’s install Minikube,
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64chmod +x minikube
sudo install minikube /usr/local/bin/
▸ minikube config set vm-driver kvm2
to faster Minikube start up.
08. Installing Goland
~ Can use EAP builds for free
▸ Download Goland or Goland early access program build from jetbrains.com. The current Goland version while writing this is 2019.2.5.
▸ Extract tar.gz
file and move GoLand
directory to /opt/goland
.
sudo mv ~/Downloads/GoLand-2019.2.5/GoLand /opt/goland
sudo chmod -R 775 /opt/goland
▸ Add .desktop
for GoLand to open it via GNOME activities overview via sudo nano /usr/share/applications/jetbrains-goland.desktop
[Desktop Entry]
Categories=Development;IDE;
Comment=A clever IDE to Go
Exec="/opt/goland/bin/goland.sh" %f
Icon=/opt/goland/bin/goland.svg
Name=GoLand
StartupWMClass=jetbrains-goland
Terminal=false
Type=Application
Version=1.0
09. Installing Sublime Text
~A text editor for code, markup and prose
sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpgsudo dnf config-manager --add-repo https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.reposudo dnf install sublime-text
10. Tweaking default UI
~ Because this is Linux
▸ To install GNOME tweak tool, sudo dnf install gnome-tweak-tool
.
▸ Download and install custom icons and themes via gnome-look.org to /usr/share/themes
, if it’s a theme; /usr/share/icons
, if it’s an icon set.
I like the cleaness of macOS UI. So, in here, I am using Enso-gnome GTK3 theme and Mojave-CT-Light icons.
▸ Change the theme and icon set via GNOME tweak tool. 💡 You can see more screenshots in the bottom of the page.
11. Installing Firefox Nightly
~Because I love open source and the freedom it has.
💭 By default Fedora comes with Firefox stable release. But I am using Nightly builds since Firefox 4 and trust me even Nightly builds also so stable these days.
▸ To remove existing Firefox installtion, sudo dnf remove firefox
▸ Download Firefox Nightly build via www.mozilla.org/en-US/firefox/channel/desktop/#nightly and extract it to /opt/firefox
▸ Add .desktop
for Firefox Nightly to open it via GNOME activities overview via sudo nano /usr/share/applications/firefox.desktop
[Desktop Entry]
Version=1.0
Name=Firefox Nightly
GenericName=Web Browser
Comment=Browse the Web
Exec=/opt/firefox/firefox-bin %u
Icon=/opt/firefox/browser/chrome/icons/default/default128.png
Terminal=false
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;
StartupNotify=true
Categories=Network;WebBrowser;
Keywords=web;browser;internet;
Actions=new-window;new-private-window;X-Desktop-File-Install-Version=0.24[Desktop Action new-window]
Name=Open a New Window
Exec=/opt/firefox/firefox --new-window %u[Desktop Action new-private-window]
Name=Open a New Private Window
Exec=/opt/firefox/firefox --private-window %u
For extra UI tweaks, I am using night_owl addon and userChrome.css file attched to it.💡 You can see more screenshots in the bottom of the page.
12. Installing Slack
~ Especially for kubernetes.slack.com
▸ Download the .rpm
file via slack.com/intl/en-sg/downloads/linux
▸ To install, you can either double click on the .rpm
file or run sudo dnf install
command via terminal.
13. Installing Postman
~ Because we build APIs
sudo suflatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepoflatpak install flathub com.getpostman.Postman
14. Installing official CLI applications of cluster providers
~ If you have privileges for production cluster.
▸ For Amazon EKS : https://github.com/weaveworks/eksctl#installation
▸ For Google cloud : https://cloud.google.com/sdk/docs/quickstart-linux
▸ For IBM cloud : https://cloud.ibm.com/docs/cli?topic=cloud-cli-getting-started
15. Adding aliases
~Productivity first!
Creating short aliases for long kubectl
commands can increase the productivity a lot. For example, instead typing kubectl get po -n kube-system
, with the following aliases we need to type kp kube-system
.
To enable these, add follow lines to ~/.zshrc
and run source ~/.zshrc
.
alias kn="kubectl get ns"
alias kp="kubectl get po -n"
alias kd="kubectl describe po -n"
alias kdl="kubectl delete po -n"
alias kdlf="kubectl delete po --grace-period=0 --force -n"alias ke="kubectl exec -it -n"
alias kl="kubectl logs -f -n"alias ks="kubectl get service -n"
alias ksa="kubectl get service --all-namespaces"
alias kep="kubectl get endpoints"alias kca="kubectl config get-contexts"
alias kcu="kubectl config use-context"
alias kcv="kubectl config view"alias kt="kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep eks-admin | awk '{print $1}')"
alias kpx="kubectl proxy"
This is how it looks like at the end…
Last but not least,
If you are new to Go and would like to learn “How to build a Dockerized RESTful API application using Go”, the first post of learning-cloud-native-go publication will be helpful for you. You can read the same content via learning-cloud-native-go.github.io 👈 as well.
If you found any mistake or something I need to be changed, even a spelling or a grammar mistake, feel free to buzz me. See you on the next post. 👋