Ubuntu Nice to have's
Introduction
I've posted before on setting up PHP development environments on various Linux, but I've never really gone over the "Nice to haves" i like when working with.
So today were going to go through the steps i take to get my system working how i like it.
Some Prerequisites
So as with every software installation on Linux we want to update our repositories.
sudo apt-get update
sudo apt-get upgrade
with that done, lets get onto git, zsh & OhMyZsh
Git, ZSH, OhMyZsh
Git is installed as simply as:
sudo apt-get install git
You will get the usual:
After this operation, 20.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Just select Y
and the installation will complete.
next we need to install ZSH which again is just another single command:
sudo apt-get install zsh
With that done onto OhMyZsh, This one has a few more commands but again, nothing crazy. To start with were going to make some changes to our terminal, We need to get some fonts so the theme we will install for OhMyZsh will work properly.
Download and install these font:
Once installed you will need to tell the terminal to use the MesloNG, To do this simply click on the burger menu and click Preferences like so.
When the preferences is open click on the "Unnamed" Option in the left panel, Click the Custom Fonts radio button and then select MesloLGS NF like below:
Now onto cloning OhMyZsh and then installing Powerlevel10k to customize the look and feel of our Terminal. First Lets clone OhMyZsh.
sh -c "$(curl -fsSL raw.github.com/ohmyzsh/ohmyzsh/master/tool…)"
If you get a CURL is not installed error simply run.
sudo apt-get install curl
When you first install it will ask you if you want to set the default shell to zsh select Y and press enter. This will set the shell as Default and then add a .zshrc to your ~/ directory. if all goes well you should see the below:
Nice!, now some people like what they see here and don't mind the -> ~ prompt, but i like to tart it up a bit with Powerlevel10k. To install p10k simply run the following from your terminal.
git clone --depth=1 github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
this will clone the theme to our machine and we just need to tell zsh/OhMyZsh to use the powerlevel10k theme. To do this, we need to edit the .zshrc file i mentioned earlier.
sudo nano ~/.zshrc
You should now see the following:
We need to edit the ZSH_THEME bit and change it from:
ZSH_THEME="robbyrussell"
to ZSH_THEME="powerlevel10k/powerlevel10k"
Once done hit the key combination Ctrl + X, type Y and then hit Enter this will save the file and bring you back to the same terminal prompt from earlier. We now need to refresh the config so we can start using powerlevel10k
source ~/.zshrc
Once you source the .zshrc you will immediately be directed to the p10k setup. there is many many different alterations you can choose but I'll show you mine. The first few questions are just ensuring the terminal is using the custom fonts etc. The following few questions for me are all Y.
Does this look like a diamond (rotated square)?
Does this look like a lock?
Does this look like a Debian logo (swirl/spiral)?
Do all these icons fit between the crosses?
Now we get to the actual configuring:
- Prompt Style - (3) Rainbow
- Character Set - (1) Unicode
- Show Current Time - (1) No
- Prompt Separators - (1) Angled
- Prompt Heads - (1) Sharp
- Prompt Tails - (1) Flat
- Prompt Height - (2) Two Lines
- Prompt Connection - (2) Dotted
- Prompt Frame - (2) Left
- Connection and Frame color - (4) Darkest
- Prompt Spacing - (2) Sparse
- Icons - (2) Many Icons
- Prompt Flow - (1) Concise
- Enable Transient Prompt - (n) No
- Instant Prompt Mode - (1) Verbose (Recommended)
- Apply Changes to ~/.zshrc - (y) Yes (Recommended)
That is the final question and if you have done everything correct you should be faced with the following prompt:
All of these changes are subject to your preferences, i work a lot in the Terminal so i like it to get out of the way and look clean.
We can leave the terminal as it is now..... or we can add two plugins to our install to make your life so much easier!
First we need to CD into the OhMyZsh Plugin Directory
cd ~/.oh-my-zsh/plugins/
This path may differ depending on what Distro of Linux you are using, For this tutorial i have been using Ubuntu.
On a side note... how cool does our terminal look when navigating through directories:
Anyway, to our first plugin Auto Suggestions. This can be cloned into our plugins directory by typing the following command into our terminal
git clone github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
This will pull the plugin down but not set it for use. we going to be installing two plugins so I'll go ahead and clone the second one before we edit the .zshrc
The second plugin is Syntax Highlighting and its brilliant, sometimes when working in the terminal you type a command and you get the non helpful "failed - blah blah blah" messages.... well Syntax Highlighting will show up green if the syntax is correct and red if not... neat!
In the plugins directory from terminal type the following:
git clone github.com/zsh-users/zsh-syntax-highlighti… ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
Now that we have both of our plugins downloaded lets set them in our .zshrc and source it.
sudo nano ~/.zshrc
scroll down to the plugins bit:
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
were going to edit this to include two more plugins as well as the git one. It is essential that zsh-syntax-highlighting
is the last plugin to load, if it isn't it wont function as intended. Edit the plugin section like mine:
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)
Once you have edited it like above, Ctrl + X, Y and Enter to save and exit Nano. at the next prompt simply type:
source ~/.zshrc
Once that is done, as your typing the prompt will swap between red and green depending on if its correct or not.
Also notice in the first prompt above its suggesting in white what i can type next, if i was to hit my right arrow key it would complete for me, this saves me a ton of time!
Some people will say i have gone to too great lengths to over complicate this terminal bit, but as i spend a lot of time in my terminal.... its worth it.
Install Chrome
Yes we have Firefox, or we can install Chromium from the Software store.... but the just don't quite do it for me... i like chrome because i can sync all my settings and plugins across systems (i use 3 in total for work and home).
There is a few ways to install it but my preference is through the terminal, its quick and easy.
so if its not open already open your Terminal and type the following:
cd ~/Downloads
and then
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
this will download the .deb to your downloads folder. once the download has completed, still in the Downloads directory type the following in your terminal.
sudo apt install ./google-chrome-stable_current_amd64.deb
And that's it Chrome is installed!
Nice!
IDE's (Programming)
Now out of the box you can go to the Software Center and Download VS Code or DBeaver for your code client and your MySQL client but I'm not a huge fan of them. They work and are great but as i dont need to pay for the software I'm about to install (im a student) i wont be going over them. if you want to you can simply go to the software center, search for them and click install.
I prefer Jet Brains PHPstorm and Datagrip which i get free as a student.
to install PHPstorm and DataGrip we do it through SNAP installations, dead easy and through the command line!
sudo snap install phpstorm --classic
and for DataGrip
sudo snap install datagrip --classic
These take a few mins each to download and install but that's it, no config no dpkg etc it just does it all for you with snap!
Hit me up or Buy me a coffee if you found this post useful please consider following me on twitter @skino2020 and if you found it really helpful consider buying me a coffee here.