Basic Fedora configuration to code interfaces

Fedora 25

If you are a front end developer, you should know that exists another great operational systems than Mac OS, Windows, Ubuntu and Mint to help you gain performance into your coding skills.

Fedora is a fully open source community, born from past Red Hat developers encouraged to maintain one of most powerful Linux OS distribution, with default GNOME 3 graphical user interfaces that can be recorded and bootstrapped and completely operable from a tiny 2G pen-drive.

This super small and portable system is also all the source files you will need to install Fedora OS to your notebook’s hard drive. Just reboot from USB and Fedora will guide you through a few steps until setup is finished within no more than 15 minutes. You can download it here.

After installing Fedora portable in a pen-drive or as a hard drive operational system, is time to configure some tools to work with front end code.

This list is my favorite setup to help you install useful packages like Git, Node or IDEs like Sublime Text, VS Code, and learn how to develop interfaces with a lightweight and stable Linux distribution:

Fedy

Tweaks for your Fedora. Install codecs like Oracle Java, Adobe Flash or software like Skype, Spotify, file extractors and all other tools not found at Software Center — Fedora’s applications store.

To install it, open Terminal (press Super key, type ‘Terminal’) and then Enter:

curl https://www.folkswithhats.org/installer | sudo bash

Press Super key and type Fedy to open the program. Now you can choose among options and install IDEs like Sublime Text, Brackets, Atom, Eclipse, VS Code or Android Studio.

Fedy screenshot

Don’t forget to install Archive (a file extractor/compressor), Oracle JRE, and things like Chrome and Virtual Box.

Easy Bash Prompt Generator

Pick elements you want to use in your prompt, select colors and copy the code to your .bashrc file to custom your Terminal. My configure is:

# get current branch in git repo
function parse_git_branch() {
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
if [ ! "${BRANCH}" == "" ]
then
STAT=`parse_git_dirty`
echo "[${BRANCH}${STAT}]"
else
echo ""
fi
}

# get current status of git repo
function parse_git_dirty {
status=`git status 2>&1 | tee`
dirty=`echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?"`
untracked=`echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?"`
ahead=`echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?"`
newfile=`echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?"`
renamed=`echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?"`
deleted=`echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?"`
bits=''
if [ "${renamed}" == "0" ]; then
bits=">${bits}"
fi
if [ "${ahead}" == "0" ]; then
bits="*${bits}"
fi
if [ "${newfile}" == "0" ]; then
bits="+${bits}"
fi
if [ "${untracked}" == "0" ]; then
bits="?${bits}"
fi
if [ "${deleted}" == "0" ]; then
bits="x${bits}"
fi
if [ "${dirty}" == "0" ]; then
bits="!${bits}"
fi
if [ ! "${bits}" == "" ]; then
echo " ${bits}"
else
echo ""
fi
}

export PS1="\[\e[31m\][\[\e[m\]\[\e[33m\]\W\[\e[m\]\[\e[31m\]]\[\e[m\]\[\e[32m\]\\$\[\e[m\]\[\e[31m\]\`parse_git_branch\`\[\e[m\] "

The lines above will show you the current directory and your current Git branch status. Add them at the end of the file ~/.bashrc. It is found at your home directory (~):

sudo vi .bashrc

Restart the terminal. The bash prompt should looks like this:

.bashrc custom PS1

Git

You need for almost everything. So, you should install it using the dnf Package Manager. If you see command lines using the yum Package Manager (that it is deprecated in Fedora), just replace ‘yum’ for ‘dnf’ command like this:

sudo dnf install git-all

Then, access Git configuration file and update your name and email:

git config --global --edit

You can configure aliases shortcuts to your bash terminal commands, like this:

git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.ps push
git config --global alias.pl pull
git config --global alias.last 'log -1 HEAD'

Node.js

Node is a JavaScript run-time that allows you to run JavaScript programs and packages as software from command line. Installing Node, you are also installing NPM, the NodeJS Package Manager with the largest ecosystem of open source libraries in the world.

sudo dnf install nodejs

Check if the installation was succeeded and the version installed by typing:

node -v

npm -v

SSH Keys

To clone a project from GitHub, for example, you need a public/private rsa key pair. To generate these keys, type in your Terminal:

ssh-keygen

Answer the questions and at the end you are going to have a a pair of keys into folder ~/.ssh . The id_rsa file is your private key. The id_rsa.pub file is your public key.

Now, if you need to give someone access, for instance, clone GitHub repositories, you should copy your public key. It starts with ssh-rsa and you can view it typing:

cat ~/.ssh/id_rsa.pub

GitHub

To git clone a repository from your GitHub account into your desktop, access https://github.com/settings/keys, add a Title and your copied public key.

At your terminal, to git clone a GitHub repository, type:

git clone git@github.com:username/repository-name.git

Docker

To install Docker:

sudo dnf install docker

Confirm the answer and you will ready. To start using Docker, type:

sudo systemctl start docker

rbenv

For compile SASS, for example, you will need Ruby installed, and the best way to manager Ruby versions is rbenv. To install it:

$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ cd ~/.rbenv && src/configure && make -C src
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ ~/.rbenv/bin/rbenv init

Open a new tab in your terminal to restart Path. Then check if rbenv was installed:

$ type rbenv
#=> "rbenv is a function"

After all, install ruby-build as a plugin to enable rbenv install command.

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$ ~/.rbenv/plugins/ruby-build
$ echo ‘export PATH=”$HOME/.rbenv/plugins/ruby-build/bin:$PATH”’ >> ~/.bashrc
$ source ~/.bashrc

Now, you can list all Ruby version and install your chosen one:

# list all available versions:
$ rbenv install -l

# install a Ruby version:
$ rbenv install 2.4.1
If you are facing problems whichever task, try to update your system running:
$ sudo dnf install

Choose your global version now:

$ rbenv global 2.3.0

Check it version out:

$ ruby -v

Create your ~/.gemrc:

$ echo "gem: --no-document" > ~/.gemrc

Now you can start installing your gems. To list all your gems:

$ gem list

Bundler

This Ruby gem is very useful. You will need it someday, sometime. Install it by:

$ gem install bundler

SASS

To compile your SASS files into CSS files from command line, install SASS gem and check it version after:

$ gem install sass
$ sass -v
# Sass 3.4.23

Snapcraft

This package manager has some interesting sources for all Linux distros. One I like is Hugo, a static blog manager like Jekyll and Middleman. To install it:

$ sudo dnf install snapd
$ sudo systemctl enable --now snapd.socket

After it, you can install and try Hugo:

$ snap install hugo

Bower

Just:

$ npm install -g bower

Yarn

A newer option to NPM packages suitable for Webpack users:

$ sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
sudo yum install yarn

Or after installing Node with NPM, you can just:

sudo npm install -g yarn