How to install packages using snap Ubuntu

Snap is Canonical’s attempt to refine the app packaging and delivery mechanism on the Linux platform.  The Snap packages enable developers to bring much newer versions of apps to Ubuntu 16.04 LTS. Currently, the list of available snap packages is short, but soon we’ll be able to install more packages through the new snap package manager.

It is possible to install snap packages alongside traditional deb packages. These two packaging formats live comfortably next to one another. ( Read more about it here)

If you are on Ubuntu 16.04 LTS or later, you would already have snap installed on your machine, if you are on earlier version, install snap using following command.

$sudo apt install snapd

If you want to cross check if snap is installed or not, run following command.

~$ sudo apt list snapd
[sudo] password for conquistador:
Listing... Done
snapd/xenial-updates,now 2.34.2 amd64 [installed,automatic]
N: There is 1 additional version. Please use the '-a' switch to see it

Check the snap version

$ snap version
snap 2.36.1
snapd 2.36.1
series 16
ubuntu 16.04
kernel 4.15.0-39-generic

Now let us see how to find a package and install it.

Search package by name

$ snap find vscode
Name Version Publisher Notes Summary
vscode 1.29.1-1542309157 snapcrafters classic Code editing. Redefined.
ampareinvertcolor 1.0.0 juthawong - Simply Invert CSS Color - Made For Web Designer

You can search for keywords as well. If keyword has multiple words, please enclose it in single or double inverted commas.

$ snap find "image editor"
Name             Version         Publisher          Notes  Summary
pencilsheep      5               pencilsheep        -      Free professional image editor with full GPU acceleration
amparepngtoico   1.0.1           juthawong          -      Convert PNG Image To Windows Icon File in Clicks
nomacs           3.11.7          diemmarkus         -      nomacs is a free, open source image viewer.
imeditor         0.7             huluti             -      Simple & versatile image editor.
anituner         2.0             mmtrt              -      AniTuner lets you create, edit and convert Windows animated cursors ani files.
gimp             2.10.8          snapcrafters       -      GNU Image Manipulation Program
paintsupreme-3d  1.0.41          braindistrict      -      PaintSupreme 3D
goxel            0+git.5cabc00   guillaume          -      Goxel. Free and Open Source 3D Voxel Editor
carnet           0.9.0           alexandre-roux-m   -      Powerful note taking app with sync, online editor and android app
anifx            1.0             mmtrt              -      AniFX is a free cursor editor with many features.
tiled            1.1.6           bjorn              -      Your free, easy to use and flexible tile map editor.
polarr           5.2.1           polarrco*          -      Powerful and easy-to-use photo editor.
skrifa-lite      0.1.0           hyuchia            -      A simple word processor built with web technologies
skrifa           0.2.6           hyuchia            -      A simple word processor built with web technologies
photoscape       latest          merlijn-sebrechts  -      PhotoScape is a fun and easy photo editing software that enables you to fix and enhance photos.
kstars           master+38b187e  kde*               -      KStars is a desktop planetarium for amateur and professional astronomers.
gitkraken        4.1.1           gitkraken*         -      For repo management, in-app code editing & issue tracking.

Installation.

sudo snap install <package>

For some application you might need to use word –classic.  I got an error which installing visual studio code (vscode) using snap e.g.

$ sudo snap install vscode
[sudo] password for conquistador: 
error: This revision of snap "vscode" was published using classic confinement and thus may perform
arbitrary system changes outside of the security sandbox that snaps are usually confined to,
which may put your system at risk.

If you understand and want to proceed repeat the command including --classic.
$ sudo snap install --classic vscode
vscode 1.29.1-1542309157 from Snapcrafters installed

Snap packages are automatically updated, if you want to update any package manually, use following command.

sudo snap refresh <package>

Check list of packages installed on your computer

$ snap list
Name           Version            Rev   Tracking  Publisher     Notes
core           16-2.36.1          5897  stable    canonical*    core
vscode         1.29.1-1542309157  69    stable    snapcrafters  classic
wine-platform  3.0.3-3.21.0       36    stable    mmtrt         -

Removing the application

sudo snap remove <package>

One the application is installed, it can be run as any other application.

If you want to go into details, please refer to official tutorial and documentation

How to install Visual Studio Code on Ubuntu

Visual studio has been one of the leading code editor. I mostly use sublime text for its simplicity but many a times, Visual studio code feel more comfortable considering many add on features like git integration, debugging tools, autocomplete and not to forget inbuilt terminal.

Method#1 Install Visual Studio Code using .deb package

Step#1 Download Visual Studio code .deb/ *.rem package from https://code.visualstudio.com

Step#2 Install downloaded package using following command

sudo dpkg -i DEB_PACKAGE

Alternatively, you can simply double click on *.deb package. It will open software center page as below. Simply click on install. One you click on install, it will prompt you for password. Install the password and hit enter / click Authenticate.

Method#2 Install Visual Studio code from Ubuntu Software

Got to Ubuntu Software. ( by searching Ubuntu software in search box). Type Visual Studio in the Ubuntu Software sear box and you will see the Visual Studio Code, click on “install” button and you are good to go.

One you click on install, it will prompt you for password. Install the password and hit enter / click Authenticate.

Method#3 Install Visual Studio Code using snap

This is easiest method. Simple run following command and visual studio code will be installed immediately.

$ sudo snap install --classic vscode
vscode 1.29.1-1542309157 from Snapcrafters installed

If you want to know more about what is snap and how to use it ? please read this article

How to remove Visual Studio from Ubuntu

Method#1  Using Ubuntu Software

Got to Ubuntu Software. ( by searching Ubuntu software in search box). Type Visual Studio in the Ubuntu Software sear box and you will see the Visual Studio Code, click on “remove” button and you are good to go.

One you click on remove, it will prompt you for password. Install the password and hit enter / click Authenticate.

Method#2  Using Command Prompt

Just to check if Visual Studio Code is installed, run following command.

$ sudo apt list code
Listing... Done
code/stable,now 1.29.1-1542309157 amd64 [installed]

As you can see, name of the package is code. Now run following command

$ sudo apt-get remove code
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
code
0 upgraded, 0 newly installed, 1 to remove and 197 not upgraded.
After this operation, 193 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 323562 files and directories currently installed.)
Removing code (1.29.1-1542309157) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20180209-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...

Method#3  Using snap

Use this only if you have installed If you have installed Visual Studio code using snap then use following command

$ sudo snap remove  vscode
vscode removed

Note: You can use snap command to uninstall if you have installed using snap or installed from Ubuntu software center, however, if you have installed using .deb file, snap will not be able to remove the package

Upgrading Visual Studio code
Following command will upgrade all packages install on Ubuntu to their latest version

sudo apt update && sudo apt upgrade

How to Install Notepad++ on Ubuntu

Notepad++ is one the best tool for developers. Notepad++ is a free and powerful source code editor and Notepad replacement that supports several languages. There are 3rd party plugins available to extend the functionality of the Notepad++.

If you are using windows, you can simply go to this link and download exe file to install it.

If you want to use it on Ubuntu, you would need to make some changes. Good news is that Notepad++ is now (unofficially) available as a Snap package for Linux user.

Step#1 install snapd

check if you have snapd install on your machin by using following command

$ sudo apt list --installed | grep -i snapd

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libsnapd-glib1/now 1.13-0ubuntu0.16.04.1 amd64 [installed,upgradable to: 1.33-0ubuntu0.16.04.1]
snapd/xenial-updates,now 2.34.2 amd64 [installed,automatic]
snapd-login-service/now 1.13-0ubuntu0.16.04.1 amd64 [installed,upgradable to: 1.33-0ubuntu0.16.04.1]
snapd-xdg-open/xenial-updates,now 2.34.2 amd64 [installed]

If you don’t see last line “snapd-xdg-open”, please run following command

sudo apt-get install snapd snapd-xdg-open

Step#2 Install Notepad++

After snap installation is completed, you can install notepad++ using following command

sudo snap install notepad-plus-plus

it will take some time based on your network speed. in my case, it was stuck at following for lot longer

Automatically connect eligible plugs and slots of snap "notepad-plus-plus"

Once installation is complete, you can start using notepad++

How to Install Google Fonts on Ubuntu

Google Fonts large collection and different types of fonts. These can be used not just for your websites but also on your desktop/Laptop as well.

And yes, google officially allows downloading and install google fonts on your computer. Please follow along.

Step#1 Download required google fonts

Go to Google fonts home page and click on + sign of the font that you would like to download.

 

Once you select require font, it will get added to selected font window(just like shopping cart). Click on the window header to open it fully. In this article we will try to install font called as “Lora”. Selection window will open something like below.

Click on download sign on right hand upper corner to download the files. It will download a zip file “Lora.zip”

Step#2 :Unzip and Install the Google Font

Now extract the zip file. Once you double click on the TTF (TrueType Fonts) or OTF (Open Type Fonts) file, it will open with Font Viewer. Click on install at right hand upper corner.

Note: Downloaded and unzipped folder will contain Lora-Bold.ttf, Lora-BoldItalic.ttf, Lora-Italic.ttf and Lora-Regular.ttf. You need to install all files individually.

You installation is complete, “install” buttom at top right will get changed to “Installed”

Now open and application like Libre Office or GIMP and you will be able to access the installed fonts

Another way to install the fonts ?

The fonts that you have installed are kept at following location

~/.local/share/fonts

If you want to install a font using command prompt or want to install multiple fonts, simple move fonts files to this folder (either manually from GUI or from terminal) and it will be accessible in your application.

How to resolve error “The requested nginx plugin does not appear to be installed”

I had installed letsencrypt ssl as per this tutorial and these were working fine, however when I tried to install new certificate I got following error

$ sudo certbot --nginx -d vatadya.com -d www.vatadya.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
The requested nginx plugin does not appear to be installed

I reinstall PPA from repository ppa:certbot/certbot and reinstalled “python-certbot-nginx”, still it did not resolved the problem. Finally, following installation resolved the error.

$ sudo python3.6 -m pip install certbot-nginx

Once this was installed, following command worked fine

$ sudo certbot --nginx -d example.com -d www.example.com

How to resolve error “Authentication is needed to run /bin/cp’ as the super user” error

While editing code in sublime text, I got error. I got away from this error by savin my file by providng the password but it became irritating when I need to provide password everytime saving the file.

Here is the snapshot of the error:

 

This error is coming because the directory is not owned by the logged in user. to avoid this error simply you need to transfer ownership. Run following command on terminal

sudo chown $USER -R /foldername

 

How to list All Installed packages – Ubuntu – sudo apt list

Many a times, we need to know list of installed packages on Ubuntu. We will achieve required task by using apt command. apt is a command-line interface which allows actions such as installing new software packages, removing unnecessary software packages, it can be used for updating the existing software packages as well as  searching for specific software packages etc.

sudo apt list --installed

This output might overwhelm you, if you want to check if specific package is installed, you can check this by following command

sudo apt list --installed | grep -i google

If you want to remove any application, use following commaand

sudo apt-get remove <application_name>

Sometimes applications is split up into multiple packages. In such cases, to uninstall all related packages and configurations, use following command

sudo apt-get purge <application_name> 

How to Install Google Chrome on Ubuntu

Gone are the days where you had to find a hack to install chrome on ubuntu. Google now officially provide *.deb package for installation on Ubuntu ( and *.rpm for fedora).

Step#1 Download the google package

Go to this link https://www.google.com/intl/en_in/chrome/ and click on download

 

Once you click on “Accept and Install”, following pop up will come.

Step#2 Install the package

If you have chosen to open with software package, once download is completed, it will open with software installer, as shown below

If you want to install it later, simply double click on google-chrome-stable_current_amd64.deb file and it will open with software installer, just like windows.

If you want to install using terminal use following commands. Run second command only if there are errors with unresolved dependencies.

sudo dpkg -i google-chrome-stable_current_amd64
sudo apt-get install -f