How to install specific fonts on my AWS EC2 instance?

I have a Python application running on an AWS EC2 instance (Amazon Linux, Elastic Beanstalk) that requires certain specific fonts to output output and wonder how to install them as part of the deployment process or launching the instance.

My code running on my local computer (OS X) uses

'Arial Unicode MS'
'Open Sans'

as fonts. But these fonts are not available by default on EC2 (I only see DejavuSans and DejvuSerif in /usr/share/fonts), and it’s not clear to me which packages may include the fonts I need or how to install them.

How to install these two fonts on EC2, preferably using yumor commandor container_commandas part of the deployment process / instaitation specified in the file .ebextensions/*.config?

+5
source share
3 answers

This is an old question, but since no one answered it, it worked for me.

Create a font / folder in your application and fill it with the fonts you need. Create a .ebextensions / copy_fonts.config file that looks like this:

container_commands:
    copy_fonts:
        command: "cp fonts/*.ttf /usr/share/fonts/"
+10
source

Another option is to install the font through the package (if any). You can declare it in your.ebextensions/install_pacakges.config

Example:

commands:
  gnu-free-serif-fonts:
    command: rpm -ivh --nodeps --replacepkgs http://mirror.centos.org/centos/7/os/x86_64/Packages/gnu-free-serif-fonts-20120503-8.el7.noarch.rpm
0
source

. . , .

  container_commands:
    01_download_nanum_font:
      command: wget http://static.campaign.naver.com/0/hangeul/renew/download/NanumFont_TTF.zip 
    02_unzip_font:
      command: unzip Nanum*.zip
    03_creat_fontdir:
      command: mkdir -p /usr/share/fonts/nanumfont
    04_mv_font:
      command: mv *.ttf /usr/share/fonts/nanumfont
    05_add_font_cache:
      command: fc-cache -r
0

All Articles