Thursday, June 29, 2017

How to turn off ubuntu unattended updates and upgrades in Ubutntu



 Since Ubuntu 16.x unattended updates and uprades are enabled by default. These run on a schedule periodically to keep your system up to date. SOmetimes you do not want to let Ubuntu automatically do this. THe below commands can be used to shutdown and disable the unttended updates and upgrades service

In a root shell (sudo -i) typing the three commands below will disable unatended updates and upgrades

systemctl mask apt-daily.service
systemctl disable apt-daily.timer
systemctl disable unattended-upgrades

You can reverse this action by using the following three commands as root:


systemctl unmask apt-daily.service
systemctl enable apt-daily.timer
systemctl enable unattended-upgrades

Note: If you have a doubt as to the difference between masking and disabling. Masking prevents a service from ever running/being started. Disable only prevents a service from being started automatically.

 If you do not want to prevent the service from running but want more fine grained control over unattended upgrades.  You can edit the file located at "/etc/apt/apt.conf.d/20auto-upgrades" on your Ubuntu system.

 APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

By changing the "1" to "0" you can disable a specific feature example you want only unattended updates but no upgrades.




Tuesday, June 6, 2017

Installing fonts on a linux distribution

Have you ever wondered how to install fonts on a Linux distribution.  In this blog post I'll be talking about the general process of installing fonts on Linux and more specifically on Ubuntu.

The process of installing fonts and using them broadly comprises of 2 steps:
1) Placing the font file in the appropriate directory.
2) Rebuilding the font cache so that the system can use the new fonts you installed. This is typically done with the "fc-cache" command.

Fonts can be installed at two different levels:
1) System wide: This makes the font available to all users on your Linux System. This requires root privileges but has the advantage of system wide font availability.
2) Per user: This is by far the easiest safest method. It does not require root privileges but makes the newly installed fonts available only to that specific logged in user.

As an example I will demonstrate installing of fonts on Ubuntu 16.04 (this should work on older ubuntu systems too it was tested on Ubuntu 14).
 
1) Installing fonts on Ubuntu system wide:
 -> Login to a root shell

 -> Create a sub folder in directory '/usr/share/<font-type>/'.

     Ubuntu splits different font types into their own individual directories (so for instance if a font is a truetype font it would go into '/usr/share/truetype/'.

    Assuming our font is a truetype font we create a sub folder called 'customFonts' inside '/usr/share/truetype/' and save your font there.

 -> Update the font cache. Run 'fc-cache'.

 -> your done

2) Installing fonts on an Ubuntu system per user:
 -> Open a regular shell as a logged in user.

 -> check if a folder "~/.fonts" exists otherwise make it. Note: here "~" is a shortcut for you homedirectory. If you username is 'foo' then "~" typically expands to '/home/foo'.

 -> install your font there (you can create a sub folder and organize your fonts however you like)

 -> Update the font cache. Run 'fc-cache'.

 -> your done

Now just reopen any program where you wish to use the font and try looking for your font. You should see the font in the list of available fonts.