I need to create a Microsoft Word Mail Merge document in my Java Spring MVC application. But running it in Ubuntu server resulting in a document that missing the default font use in the document, which is the Calibri font. So I need to install the font in Ubuntu to make the document looks as expected.
Here what I need to do to install the font in my Ubuntu box. Starts by updating the repository package list to get latest packages information for upgrades or new package installation.
sudo apt-get update
Then install FontForge in our system. FontForge is a free and open source font editor, but in this case it will help doing the font conversion in the installation script on the upcoming step.
sudo apt-get install fontforge
Install the Microsoft Cabinet file unpacker. This is required for the next script to successfully install the fonts.
You have type a long line of command in terminal. But now you want to clear or delete the entire line. Deleting each character in the command will take sometime and bored you. So are there any keyboard shortcuts that allow you to do this? Yes there are some hotkeys to the rescue.
CTRL + u
Delete the current command. The deleted command will be stored into a buffer.
CTRL + w
Delete a word.
CTRL + c
Abort what you are typing.
CTRL + d
Delete current character.
Other hotkeys that might help you work faster in the terminal.
If you want to run a sudo command without being prompted to input the password you can do the following command.
echo password | sudo -S rm -rf /opt/jetty/
In the command above we are trying to remove the /opt/jetty directory using the rm -rf command. The -S (stdin) option allow the sudo command to read password from a standard input instead of a terminal device.
If you want to store the password in a file you can use the cat command instead of echo like the following example.
The easiest way to install Oracle Java (JDK) in Ubuntu is to use the WebUpd8 PPA. A PPA (Personal Package Archive) is a special software repository for uploading source packages to be build and published as an APT repository by Launchpad. This PPA will download the required files from Oracle and install JDK7 / JDK8 / JDK9.
Login to Ubuntu server.
sudo apt-add-repository ppa:webupd8team/java
The apt-add-repository command add the ppa to the current repository. You will be prompted with information message about installation instructions with the detail url. You need to press ENTER key to continue the process to add the repository.
sudo apt-get update
This will update the package list from the repositories and update them to get the latest versions of the packages and their dependencies. It will update all repositories and PPAs.
sudo apt-get install oracle-java8-installer
This command will start the installation process, you will be prompted to accept the license agreement. Run sudo apt-get install oracle-java7-installer if you want to install JDK7 instead. This process will take sometime to finish depending on your connection speed. And if everything runs well you’ll get Java installed at the end of this process.
apt-get install oracle-java8-installer
This command return the version of the installed JDK. In this case it should return something like:
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
The JDK8 will be installed in the /usr/lib/jvm/java-8-oracle directory. If you need to define the JAVA_HOME environment variable then it should directed to this directory.