Why ubuntu installation is so slow


While installing ubuntu ,it’s very slow ,usally it took long like 3-4 even 5+ hours to finish the installation.The progress was showing “Retrieving file” with several hours remaining


The reason is the installation was updating ubuntu to the latest for you , and because you are located where the network latency is high while connecting to the main ubuntu repository. Or normally after you finished the installation you usally changed sources.list to use local ubuntu repository mirror which is faster


The workaround is to disconnect your laptop or desktop pc or vmware from network , then install ubuntu ,after the installation is been done, change your repository to one mirror which is faster

If you are installing ubuntu via vmware player , you can disconnect the network before installation refering below screenshot , untick the Connect at power on option


If you are suffering slow ubuntu installation , you can try to disconnect the network of the installing ubuntu , then the installation will not update ubuntu during the installation for you and you can do it post-installation.

Install and setup nfs server for Ubuntu 20.04

This small guide will show you how to install and configure nfs server in Ubuntu 20.04.Since nfs v4 depends on KDC ,we use nfs v3 here.

1.Install nfs server package

sudo apt update
sudo apt install nfs-kernel-server

2.Create a directory which we will export

sudo mkdir -p /share/dir01

3.Edit /etc/exports ,add below line

 /share/dir01       *(rw,sync,no_subtree_check)

4.Restart nfs server or run command “exportfs -ra”

sudo systemctl restart nfs-server


sudo exportfs -ra

run command exportfs to verify

j@ubuntu:~$ sudo exportfs
/share/dir01  	<world>

5.Test nfs server from client

sudo mkdir /mountp1
sudo mount nfs-servernameorip:/share/dir01 /mountp1

For more inforation regarding /etc/exports , just “man exports”

3 ways to list installed packages in ubuntu 20.04

Method 1 : list installed packages using command apt

apt list --installed
root@ubuntu:/home/j# apt list --installed | wc -l
 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

We can see this host has 1615 packages installed

   list        list is somewhat similar to dpkg-query --list in that it can display a list of packages        satisfying certain criteria. It supports glob(7) patterns for matching package names as well as        options to list installed (--installed), upgradeable (--upgradeable) or all available        (--all-versions) versions.

Method 2: list installed packages using dpkg command

dpkg --get-selections


dpkg -l


dpkg-query  --list

Note: For dpkg-query –list and dpkg -l there are 5 lines additional information.

Method 3: list manually installed packages using command apt-mark

root@ubuntu:/home/j# apt-mark 
apt 2.0.2ubuntu0.2 (amd64)
Usage: apt-mark [options] {auto|manual} pkg1 [pkg2 ...]

apt-mark is a simple command line interface for marking packages
as manually or automatically installed. It can also be used to
manipulate the dpkg(1) selection states of packages, and to list
all packages with or without a certain marking.

Most used commands:
  auto - Mark the given packages as automatically installed
  manual - Mark the given packages as manually installed
  minimize-manual - Mark all dependencies of meta packages as automatically installed.
  hold - Mark a package as held back
  unhold - Unset a package set as held back
  showauto - Print the list of automatically installed packages
  showmanual - Print the list of manually installed packages
  showhold - Print the list of packages on hold
root@ubuntu:/home/j# apt-mark showmanual | wc -l
root@ubuntu:/home/j# apt-mark showauto | wc -l

Fix wordpress SyntaxHighlighter ampersand to “&” issue

The workaround is to add below code into syntaxhighlighter.php

 * Filter to fix issue with & in SyntaxHighlighter Evolved plugin.
 * @param string $code Code to format.
 * @param array $atts Attributes.
 * @param string $tag Tag.
 * @return string
function kagg_syntaxhighlighter_precode( $code, $atts, $tag ) {
    if ( 'code' === $tag ) {
        $code = wp_specialchars_decode( $code );
    return $code;
add_filter( 'syntaxhighlighter_precode', 'kagg_syntaxhighlighter_precode', 10, 3 );

1.Go to your wp-admin page

2.On left pane click “Plugins” then “Plugin Editor”

3.select plugin edit to “SyntaxHighlighter Evolved” then click “Select”

4.Add above code to the end of syntaxhighlighter.php

Install php moduel imagick in ubuntu

I just did a health check for my wordpress site , I was told to enable optional php module imagick , below is the steps

1.Install php 7 imagick module using below command

sudo apt-get update;sudo apt-get install php-imagick

2.Enable the installed module using phpenmod command

sudo  phpenmod imagick

3.Reload your http service to get it took affect to your wordpress site,I’m using apache2

sudo systemctl reload apache2.service

4.(optional) Redo healthcheck for your wordpress site , this time should be no such performance recommendation anymore

Move Show application to top of Dock/Launch bar in Ubuntu

In Ubuntu 18.04 , the Show Application icon is at the bottom of the Dock.If you have Windows experience you may feel better if it locates on the top but not bottom to make Ubuntu much like Windows

To move the Show Application icon to top , the simplest way is to use gsettings command . Maybe you hate command line ,but that what Ubuntu is , you need to install another tool or application without using command line.

Right-click your Ubuntu desktop then click Open Terminal (Or by pressing Ctl+Alt+t) , then input below command and press Enter , it’s done ,so simple.

gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top true

If you want to revert it back ,just issue below command

gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top false

Change Username in Ubuntu

1.(Optional) If it’s the only user account whose name you want to change , you need to enable root account in case something wrong and cause both new and old account can not login. To enable root account ,just open an terminal by pressing Ctl+Alt+t,then
issue below to commands to set a password for root

sudo -s

2.Logout the user account whose name you need to change

3.Press Ctl+Alt+F3(or F4 F5 F6) to switch to virtual console and login with root (Of course if you have another user account with admin access ,you can login gui with that account )

4.use below commands to change the username

usermod -c displayname -d /home/newname -l newname oldname

Eg: Here we assume account user01 ,whose home directory locates /home/ubuntu01 ,and the display name also is ubuntu01,below command with change all these field to ubuntu02

usermod -c ubuntu02 -d /home/ubuntu02 -l ubuntu02 ubuntu01
mv /home/ubuntu01 /home/ubuntu02

5.(Optional)Assume user01’s default unix group is also user01, we can use below command to rename group user01 to user02

groupmod -n user02 user01

6.Use command “exit” to exit current konsole and press Ctl+Alt+F2 to switch back to the GUI konsole ,now username ubuntu01 has been changed to ubuntu02

7.(Optional) You can use below command to disable root password

sudo -s
passwd -dl root

Remote desktop to ubuntu from Windows 10

  1. On your Ubuntu machine side , open a terminal(Ctrl+Alt+t) and run below command to install xrdp
sudo apt-get -y install xrdp

2, On your Windows machine side , open your Remote Desktop Connection Manger

3.Input your Ubuntu machine’s Ip Address or Hostname in the Computer field,then click Connect

4.Click Yes if a warning window prompts

5.Input the username and password of your ubuntu machine

6.Click OK then you should be able to connect to your ubuntu

Note:If you get a blank screen or the RDP window exits automatically , maybe because you or someone already logged into the console ,you need to get the console logged out.