Friday, October 12, 2018

Install abiword on Amazon Linux 2

In Amazon Linux 2, there is no full version of Abiword. But abiword library and convert tools are available, if you can live with it.
libabw.x86_64 : A library for import of AbiWord files
libabw-tools.x86_64 : Tools to transform AbiWord files into other formats
However my client running a python/django website using webodt package to convert word documents to html and txt.
The [libabw-tools] package has 2 tools for this kind of work.
/usr/bin/abw2html
/usr/bin/abw2text

But I won't rewrite the code. I install abiword 3.0.2 for EL7 from http://repo.iotti.biz/CentOS/.
rpm -Uvh http://repo.iotti.biz/CentOS/7/noarch/lux-release-7-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-LUX
Have to update the repo files before update. /etc/yum.repos.d/lux.repo
[lux]
name=CentOS $releasever - $basearch - Lux
baseurl=http://repo.iotti.biz/CentOS/$releasever
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LUX
Because the $releasever = 2 in Amazon Linux 2, just change it To 7 in the file.
[lux]
name=CentOS $releasever - $basearch - Lux
baseurl=http://repo.iotti.biz/CentOS/7
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LUX
Same /etc/yum.repos.d/frank.repo
[frank]
name=CentOS $releasever - $basearch - Frank
baseurl=http://repo.iotti.biz/Frank/$releasever
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LUX
# Frank should be manually enabled
enabled=0
# Frank packages should be explicitly included with includepkgs
exclude=*
To:
[frank]
name=CentOS $releasever - $basearch - Frank
baseurl=http://repo.iotti.biz/Frank/7
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-LUX
# Frank should be manually enabled
enabled=0
# Frank packages should be explicitly included with includepkgs
exclude=*
Then you can update and install via yum:
yum update
yum install abiword
Dependencies Resolved

=======================================================================================================================================================================
 Package                                         Arch                         Version                                           Repository                        Size
=======================================================================================================================================================================
Installing:
 abiword                                         x86_64                       1:3.0.2-3.el7.lux                                 lux                              1.3 M
Installing for dependencies:
 adwaita-cursor-theme                            noarch                       3.26.0-1.amzn2                                    amzn2-core                       641 k
 adwaita-icon-theme                              noarch                       3.26.0-1.amzn2                                    amzn2-core                        12 M
 aiksaurus                                       x86_64                       1:1.2.1-34.el7.lux                                lux                              324 k
 at-spi2-atk                                     x86_64                       2.22.0-2.amzn2.0.2                                amzn2-core                        81 k
 at-spi2-core                                    x86_64                       2.22.0-1.amzn2.0.2                                amzn2-core                       159 k
 atk                                             x86_64                       2.22.0-3.amzn2.0.2                                amzn2-core                       258 k
 avahi-libs                                      x86_64                       0.6.31-19.amzn2                                   amzn2-core                        62 k
 cairo                                           x86_64                       1.14.8-2.amzn2.0.2                                amzn2-core                       718 k
 cairo-gobject                                   x86_64                       1.14.8-2.amzn2.0.2                                amzn2-core                        25 k
 colord-libs                                     x86_64                       1.3.4-1.amzn2.0.2                                 amzn2-core                       186 k
 cups-libs                                       x86_64                       1:1.6.3-35.amzn2                                  amzn2-core                       360 k
 dbus-glib                                       x86_64                       0.100-7.2.amzn2                                   amzn2-core                       103 k
 dconf                                           x86_64                       0.26.0-2.amzn2.0.2                                amzn2-core                       106 k
 desktop-file-utils                              x86_64                       0.23-1.amzn2.0.2                                  amzn2-core                        68 k
 enchant                                         x86_64                       1:1.6.0-8.amzn2.0.2                               amzn2-core                        55 k
 fontconfig                                      x86_64                       2.10.95-11.amzn2.0.2                              amzn2-core                       231 k
 fontpackages-filesystem                         noarch                       1.44-8.amzn2                                      amzn2-core                        10 k
 fribidi                                         x86_64                       0.19.4-6.amzn2.0.2                                amzn2-core                        63 k
 gdk-pixbuf2                                     x86_64                       2.36.5-1.amzn2.0.2                                amzn2-core                       567 k
 glib-networking                                 x86_64                       2.50.0-1.amzn2.0.2                                amzn2-core                       132 k
 gnutls                                          x86_64                       3.3.26-9.amzn2.0.2                                amzn2-core                       670 k
 graphite2                                       x86_64                       1.3.10-1.amzn2.0.2                                amzn2-core                       115 k
 gsettings-desktop-schemas                       x86_64                       3.24.1-2.amzn2                                    amzn2-core                       586 k
 gtk-update-icon-cache                           x86_64                       3.22.26-4.amzn2                                   amzn2-core                        27 k
 gtk2                                            x86_64                       2.24.31-1.amzn2.0.2                               amzn2-core                       3.4 M
 gtk3                                            x86_64                       3.22.26-4.amzn2                                   amzn2-core                       4.4 M
 gtkmathview                                     x86_64                       0.8.0-16.el7.lux                                  lux                              628 k
 harfbuzz                                        x86_64                       1.3.2-1.amzn2.0.2                                 amzn2-core                       181 k
 hicolor-icon-theme                              noarch                       0.12-7.amzn2                                      amzn2-core                        43 k
 jasper-libs                                     x86_64                       1.900.1-31.amzn2.0.2                              amzn2-core                       149 k
 json-glib                                       x86_64                       1.2.6-1.amzn2.0.2                                 amzn2-core                       134 k
 lcms2                                           x86_64                       2.6-3.amzn2.0.2                                   amzn2-core                       152 k
 libX11                                          x86_64                       1.6.5-1.amzn2.0.2                                 amzn2-core                       614 k
 libX11-common                                   noarch                       1.6.5-1.amzn2.0.2                                 amzn2-core                       164 k
 libXau                                          x86_64                       1.0.8-2.1.amzn2.0.2                               amzn2-core                        29 k
 libXcomposite                                   x86_64                       0.4.4-4.1.amzn2.0.2                               amzn2-core                        22 k
 libXcursor                                      x86_64                       1.1.14-8.amzn2.0.2                                amzn2-core                        30 k
 libXdamage                                      x86_64                       1.1.4-4.1.amzn2.0.2                               amzn2-core                        20 k
 libXext                                         x86_64                       1.3.3-3.amzn2.0.2                                 amzn2-core                        39 k
 libXfixes                                       x86_64                       5.0.3-1.amzn2.0.2                                 amzn2-core                        18 k
 libXfont                                        x86_64                       1.5.2-1.amzn2.0.2                                 amzn2-core                       152 k
 libXft                                          x86_64                       2.3.2-2.amzn2.0.2                                 amzn2-core                        60 k
 libXi                                           x86_64                       1.7.9-1.amzn2.0.2                                 amzn2-core                        41 k
 libXinerama                                     x86_64                       1.1.3-2.1.amzn2.0.2                               amzn2-core                        14 k
 libXrandr                                       x86_64                       1.5.1-2.amzn2.0.2                                 amzn2-core                        27 k
 libXrender                                      x86_64                       0.9.10-1.amzn2.0.2                                amzn2-core                        26 k
 libXtst                                         x86_64                       1.2.3-1.amzn2.0.2                                 amzn2-core                        20 k
 libXxf86vm                                      x86_64                       1.1.4-1.amzn2.0.2                                 amzn2-core                        17 k
 libabiword                                      x86_64                       1:3.0.2-3.el7.lux                                 lux                              5.2 M
 libasyncns                                      x86_64                       0.8-7.amzn2.0.2                                   amzn2-core                        26 k
 libepoxy                                        x86_64                       1.3.1-2.amzn2                                     amzn2-core                       198 k
 libfontenc                                      x86_64                       1.1.3-3.amzn2.0.2                                 amzn2-core                        31 k
 libglvnd                                        x86_64                       1:1.0.0-1.amzn2.0.2                               amzn2-core                        89 k
 libglvnd-egl                                    x86_64                       1:1.0.0-1.amzn2.0.2                               amzn2-core                        43 k
 libglvnd-glx                                    x86_64                       1:1.0.0-1.amzn2.0.2                               amzn2-core                       124 k
 libgsf                                          x86_64                       1.14.26-7.amzn2.0.2                               amzn2-core                       165 k
 libgusb                                         x86_64                       0.2.9-1.amzn2.0.2                                 amzn2-core                        40 k
 libical                                         x86_64                       1.0.1-1.amzn2.0.2                                 amzn2-core                       175 k
 libmodman                                       x86_64                       2.0.1-8.amzn2.0.2                                 amzn2-core                        29 k
 libpng                                          x86_64                       2:1.5.13-7.amzn2.0.2                              amzn2-core                       214 k
 libproxy                                        x86_64                       0.4.11-10.amzn2.0.3                               amzn2-core                        61 k
 librsvg2                                        x86_64                       2.40.16-1.amzn2.0.2                               amzn2-core                       129 k
 libsoup                                         x86_64                       2.56.0-6.amzn2                                    amzn2-core                       401 k
 libthai                                         x86_64                       0.1.14-9.amzn2.0.2                                amzn2-core                       187 k
 libusbx                                         x86_64                       1.0.21-1.amzn2                                    amzn2-core                        62 k
 libwayland-client                               x86_64                       1.14.0-2.amzn2.0.1                                amzn2-core                        32 k
 libwayland-cursor                               x86_64                       1.14.0-2.amzn2.0.1                                amzn2-core                        20 k
 libwayland-server                               x86_64                       1.14.0-2.amzn2.0.1                                amzn2-core                        38 k
 libwmf                                          x86_64                       0.2.8.4-41.amzn2.0.2                              amzn2-core                       136 k
 libwmf-lite                                     x86_64                       0.2.8.4-41.amzn2.0.2                              amzn2-core                        68 k
 libxcb                                          x86_64                       1.12-1.amzn2.0.2                                  amzn2-core                       216 k
 libxkbcommon                                    x86_64                       0.7.1-1.amzn2.0.2                                 amzn2-core                       109 k
 libxshmfence                                    x86_64                       1.2-1.amzn2.0.2                                   amzn2-core                       7.2 k
 link-grammar                                    x86_64                       5.3.14-1.el7.lux                                  lux                              2.1 M
 loudmouth                                       x86_64                       1.5.3-1.el7.lux                                   lux                               71 k
 lyx-fonts                                       noarch                       2.2.3-1.el7                                       epel                             159 k
 mesa-libEGL                                     x86_64                       17.2.3-8.20171019.amzn2.0.4                       amzn2-core                       100 k
 mesa-libGL                                      x86_64                       17.2.3-8.20171019.amzn2.0.4                       amzn2-core                       159 k
 mesa-libgbm                                     x86_64                       17.2.3-8.20171019.amzn2.0.4                       amzn2-core                        37 k
 mesa-libglapi                                   x86_64                       17.2.3-8.20171019.amzn2.0.4                       amzn2-core                        43 k
 mesa-libwayland-egl                             x86_64                       17.2.3-8.20171019.amzn2.0.4                       amzn2-core                        18 k
 minisat2-libs                                   x86_64                       2.2.1-1.el7.lux                                   lux                               43 k
 nettle                                          x86_64                       2.7.1-8.amzn2.0.2                                 amzn2-core                       329 k
 ots-libs                                        x86_64                       0.5.0-12.el7.lux                                  lux                               46 k
 pango                                           x86_64                       1.40.4-1.amzn2.0.2                                amzn2-core                       276 k
 pangox-compat                                   x86_64                       0.0.2-2.el7                                       epel                              56 k
 pixman                                          x86_64                       0.34.0-1.amzn2.0.2                                amzn2-core                       254 k
 rest                                            x86_64                       0.8.0-2.amzn2                                     amzn2-core                        63 k
 t1lib                                           x86_64                       5.1.2-14.amzn2.0.2                                amzn2-core                       168 k
 telepathy-glib                                  x86_64                       0.24.0-1.amzn2.0.2                                amzn2-core                       725 k
 trousers                                        x86_64                       0.3.14-2.amzn2.0.2                                amzn2-core                       294 k
 urw-fonts                                       noarch                       2.4-16.amzn2                                      amzn2-core                       3.0 M
 wv                                              x86_64                       1.2.9-10.el7.lux                                  lux                              259 k
 xkeyboard-config                                noarch                       2.20-1.amzn2                                      amzn2-core                       799 k
 xorg-x11-font-utils                             x86_64                       1:7.5-20.amzn2.0.2                                amzn2-core                        87 k

Transaction Summary
=======================================================================================================================================================================
Install  1 Package (+95 Dependent packages)

Total download size: 46 M
Installed size: 147 M
Have a nice worm day!

Monday, October 8, 2018

Debian 9.3 Stretch Unattended-upgrades not detecting Linux kernel security update by default

All my Debian 9.3 "Stretch" instance is showing a kernel update as being available: linux-image-amd64/stable 4.9+8 amd64 But Default Unattended-upgrades config fails to install kernel security update. My configure of '/etc/apt/apt.conf.d/50unattended-upgrades'
Unattended-Upgrade::Origins-Pattern {
        "origin=Debian,codename=${distro_codename},label=Debian-Security";
        "origin=nginx,label=nginx";
        "site=packages.sury.org";
};
I have to add one extra line:
        "origin=Debian,codename=${distro_codename},label=Debian";
Then the Kernel upgrade got pickup.
Unattended-Upgrade::Origins-Pattern {
        "origin=Debian,codename=${distro_codename},label=Debian";
        "origin=Debian,codename=${distro_codename},label=Debian-Security";
        "origin=nginx,label=nginx";
        "site=packages.sury.org";
};
Reference of the fix for this bug:
https://unix.stackexchange.com/questions/414991/unattended-upgrades-not-detecting-linux-kernel-security-update-by-default
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=886415

Thanks for Sharing and Happy Thanks Giving!

Wednesday, October 3, 2018

Debian 9 unattended upgrades Nginx and PHP 7 repo apt

I install Nginx mainline version from Nginx's officel Repo. PHP 7.2 FPM from packages.sury.org. In order to let the unattended upgrades do the work for me.
  1. I add /etc/apt/apt.conf.d/50unattended-upgrades
  2. Unattended-Upgrade::Origins-Pattern {
      ...
            "origin=nginx,label=nginx";
            "site=packages.sury.org";
    };
    
  3. Testing it out
  4. # unattended-upgrade --debug --dry-run
    Initial blacklisted packages: 
    Initial whitelisted packages: 
    Starting unattended upgrades script
    Allowed origins are: ['origin=Debian,codename=stretch,label=Debian-Security', 'origin=nginx,label=nginx', 'site=packages.sury.org']
    pkgs that look like they should be upgraded: 
    Fetched 0 B in 0s (0 B/s)                                                                                                                                             
    fetch.run() result: 0
    blacklist: []
    whitelist: []
    No packages found that can be upgraded unattended and no pending auto-removals
    

Friday, September 28, 2018

Install Postgresql 9.6 on Amazon Linux 2 by Amazon Linux Extras

Yes you can install the latest Postgresql via https://www.postgresql.org/download/linux/redhat/.

But it suppose to work on Cent OS 7 or RHEL 7.
Ammazon Linux 2 have more "Fresher" package, including the Kernel.

From Amazon Linux 2, it added Amazon Linux Extras

Extras is a mechanism in Amazon Linux 2 to enable the consumption of new versions of application software on a stable operating system that is supported until June 30, 2023.
Extras include Ansible 2.4.2, memcached 1.5, nginx 1.12, Postgresql 9.6, MariaDB 10.2, Go 1.9, Redis 4.0, R 3.4, Rust 1.22.1.

I think it is better using Extras from Amazon Linux Team. Here is how:
  1. Check the AMI version:
  2. # uname -a
    Linux ip-10-10-10-10.tal-ent.local 4.14.70-72.55.amzn2.x86_64 #1 SMP Wed Sep 19 19:09:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    # cat /etc/system-release
    Amazon Linux 2
    # cat /etc/image-id
    image_name="amzn2-ami-hvm"
    image_version="2"
    image_arch="x86_64"
    image_file="amzn2-ami-hvm-2.0.20180810-x86_64.xfs.gpt"
    image_stamp="8008-2abd"
    image_date="20180811020321"
    recipe_name="amzn2 ami"
    recipe_id="c652686a-2415-9819-65fb-4dee-9792-289d-1e2846bd"
    
  3. Check available package in Extras:
  4. # amazon-linux-extras
      0  ansible2                 available    [ =2.4.2  =2.4.6 ]
      1  emacs                    available    [ =25.3 ]
      2  httpd_modules            available    [ =1.0 ]
      3  memcached1.5             available    [ =1.5.1 ]
      4  nginx1.12                available    [ =1.12.2 ]
      5  postgresql9.6            available    [ =9.6.6  =9.6.8 ]
      6  postgresql10             available    [ =10 ]
      8  redis4.0                 available    [ =4.0.5  =4.0.10 ]
      9  R3.4                     available    [ =3.4.3 ]
     10  rust1                    available    [ =1.22.1  =1.26.0  =1.26.1  =1.27.2 ]
     11  vim                      available    [ =8.0 ]
     12  golang1.9                available    [ =1.9.2 ]
     13  ruby2.4                  available    [ =2.4.2  =2.4.4 ]
     14  nano                     available    [ =2.9.1 ]
     15  php7.2                   available    [ =7.2.0  =7.2.4  =7.2.5  =7.2.8 ]
     16  lamp-mariadb10.2-php7.2  available    [ =10.2.10_7.2.0  =10.2.10_7.2.4  =10.2.10_7.2.5  =10.2.10_7.2.8 ]
     17  libreoffice              available    [ =5.0.6.2_15  =5.3.6.1 ]
     18  gimp                     available    [ =2.8.22 ]
     19  docker=latest            enabled      [ =17.12.1  =18.03.1  =18.06.1 ]
     20  mate-desktop1.x          available    [ =1.19.0  =1.20.0 ]
     21  GraphicsMagick1.3        available    [ =1.3.29 ]
     22  tomcat8.5                available    [ =8.5.31  =8.5.32 ]
     23  epel                     available    [ =7.11 ]
    
  5. Install postgresql 9.6
  6. # amazon-linux-extras install postgresql9.6
    Installing postgresql
    Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
    amzn2-core                                                                                                                                      | 2.4 kB  00:00:00     
    amzn2extra-docker                                                                                                                               | 1.3 kB  00:00:00     
    amzn2extra-epel                                                                                                                                 | 1.3 kB  00:00:00     
    amzn2extra-postgresql9.6                                                                                                                        | 1.3 kB  00:00:00     
    amzn2extra-postgresql9.6/2/x86_64/primary_db                                                                                                    |  23 kB  00:00:00     
    152 packages excluded due to repository priority protections
    Resolving Dependencies
    --> Running transaction check
    ---> Package postgresql.x86_64 0:9.6.8-1.amzn2.0.1 will be installed
    --> Processing Dependency: postgresql-libs(x86-64) = 9.6.8-1.amzn2.0.1 for package: postgresql-9.6.8-1.amzn2.0.1.x86_64
    --> Processing Dependency: libpq.so.5()(64bit) for package: postgresql-9.6.8-1.amzn2.0.1.x86_64
    --> Running transaction check
    ---> Package postgresql-libs.x86_64 0:9.6.8-1.amzn2.0.1 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    =======================================================================================================================================================================
     Package                                Arch                          Version                                    Repository                                       Size
    =======================================================================================================================================================================
    Installing:
     postgresql                             x86_64                        9.6.8-1.amzn2.0.1                          amzn2extra-postgresql9.6                        1.3 M
    Installing for dependencies:
     postgresql-libs                        x86_64                        9.6.8-1.amzn2.0.1                          amzn2extra-postgresql9.6                        253 k
    
    Transaction Summary
    =======================================================================================================================================================================
    Install  1 Package (+1 Dependent package)
    
    Total download size: 1.6 M
    Installed size: 5.3 M
    Is this ok [y/d/N]: y
    Downloading packages:
    (1/2): postgresql-libs-9.6.8-1.amzn2.0.1.x86_64.rpm                                                                                             | 253 kB  00:00:00     
    (2/2): postgresql-9.6.8-1.amzn2.0.1.x86_64.rpm                                                                                                  | 1.3 MB  00:00:00     
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                                  7.2 MB/s | 1.6 MB  00:00:00     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : postgresql-libs-9.6.8-1.amzn2.0.1.x86_64                                                                                                            1/2 
      Installing : postgresql-9.6.8-1.amzn2.0.1.x86_64                                                                                                                 2/2 
      Verifying  : postgresql-libs-9.6.8-1.amzn2.0.1.x86_64                                                                                                            1/2 
      Verifying  : postgresql-9.6.8-1.amzn2.0.1.x86_64                                                                                                                 2/2 
    
    Installed:
      postgresql.x86_64 0:9.6.8-1.amzn2.0.1                                                                                                                                
    
    Dependency Installed:
      postgresql-libs.x86_64 0:9.6.8-1.amzn2.0.1                                                                                                                           
    
    Complete!
    
  7. It will output the summary after installation:
  8.   0  ansible2                 available    [ =2.4.2  =2.4.6 ]
      1  emacs                    available    [ =25.3 ]
      2  httpd_modules            available    [ =1.0 ]
      3  memcached1.5             available    [ =1.5.1 ]
      4  nginx1.12                available    [ =1.12.2 ]
      5  postgresql9.6=latest     enabled      [ =9.6.6  =9.6.8 ]
      6  postgresql10             available    [ =10 ]
      8  redis4.0                 available    [ =4.0.5  =4.0.10 ]
      9  R3.4                     available    [ =3.4.3 ]
     10  rust1                    available    [ =1.22.1  =1.26.0  =1.26.1  =1.27.2 ]
     11  vim                      available    [ =8.0 ]
     12  golang1.9                available    [ =1.9.2 ]
     13  ruby2.4                  available    [ =2.4.2  =2.4.4 ]
     14  nano                     available    [ =2.9.1 ]
     15  php7.2                   available    [ =7.2.0  =7.2.4  =7.2.5  =7.2.8 ]
     16  lamp-mariadb10.2-php7.2  available    [ =10.2.10_7.2.0  =10.2.10_7.2.4  =10.2.10_7.2.5  =10.2.10_7.2.8 ]
     17  libreoffice              available    [ =5.0.6.2_15  =5.3.6.1 ]
     18  gimp                     available    [ =2.8.22 ]
     19  docker=latest            enabled      [ =17.12.1  =18.03.1  =18.06.1 ]
     20  mate-desktop1.x          available    [ =1.19.0  =1.20.0 ]
     21  GraphicsMagick1.3        available    [ =1.3.29 ]
     22  tomcat8.5                available    [ =8.5.31  =8.5.32 ]
     23  epel=latest              enabled      [ =7.11 ]
    
  9. Install the postgresql service package
  10. # sudo yum update
    # sudo yum install postgresql-server.x86_64
    
    # sudo systemctl list-unit-files | grep postgresql
    postgresql.service                            disabled
    postgresql@.service                           disabled
    
    # sudo systemctl enable postgresql.service
    
  11. Inital postgresql database, Create postgres data dir.
  12. # sudo /usr/bin/postgresql-setup --initdb
    # sudo systemctl start postgresql
    
  13. Now you can login and check the Databases.
  14. # sudo -u postgres -- psql
    postgres=> \l
                                      List of databases
       Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
    -----------+----------+----------+-------------+-------------+-----------------------
     postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
     template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
               |          |          |             |             | postgres=CTc/postgres
     template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
               |          |          |             |             | postgres=CTc/postgres
    (3 rows)
    
  15. My connection config file: /var/lib/pgsql/data/pg_hba.conf
  16. # PostgreSQL Client Authentication Configuration File
    # ===================================================
    #
    # TYPE  DATABASE        USER            ADDRESS                 METHOD
    
    # "local" is for Unix domain socket connections only
    local   all             all                                     md5
    # IPv4 local connections:
    host    all             all             127.0.0.1/32            md5
    # IPv6 local connections:
    host    all             all             ::1/128                 md5
    
It's easy, clean and safer for me.

How to Upgrade check-mk to latest version on Debian 8 jessie

You don't need shutdown before the dpkg package upgrade.
  1. Download and upgrade to the latest check-mk package:
  2. # dpkg -l|grep check-mk
    ii  check-mk-agent                 1.2.8p15-1                         all          Check_MK Agent for Linux
    ii  check-mk-raw-1.4.0p8           0.jessie                           amd64        Check_MK is a full featured system monitoring
    
    # wget https://mathias-kettner.de/support/1.4.0p36/check-mk-raw-1.4.0p36_0.jessie_amd64.deb
    
    # sudo dpkg -i check-mk-raw-1.4.0p36_0.jessie_amd64.deb 
    Selecting previously unselected package check-mk-raw-1.4.0p36.
    (Reading database ... 54001 files and directories currently installed.)
    Preparing to unpack check-mk-raw-1.4.0p36_0.jessie_amd64.deb ...
    Unpacking check-mk-raw-1.4.0p36 (0.jessie) ...
    Setting up check-mk-raw-1.4.0p36 (0.jessie) ...
    New default version is 1.4.0p36.cre.
    update-alternatives: using /omd/versions/1.4.0p36.cre to provide /omd/versions/default (omd) in manual mode
    Installing systemd service: omd.init
    Disabling startup through SysV (/etc/init.d/*) scripts
    Activating startup during system boot
    Processing triggers for systemd (215-17+deb8u7) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    
  3. After package upgrade su to omd site user to perform site update:

  4. # su - milllion-doller-server
    OMD[milllion-doller-server]:~$ omd status
    mkeventd:       running
    rrdcached:      running
    npcd:           running
    nagios:         running
    apache:         running
    crontab:        running
    -----------------------
    Overall state:  running
    
    OMD[milllion-doller-server]:~$ omd update
    Please completely stop 'milllion-doller-server' before updating it.
    
    OMD[milllion-doller-server]:~$ omd stop
    Removing Crontab...OK
    Stopping dedicated Apache for site milllion-doller-server....OK
    Stopping nagios......OK
    Stopping npcd...OK
    Stopping rrdcached...waiting for termination...OK
    Stopping mkeventd...killing 21922....OK
    OMD[milllion-doller-server]:~$ omd update
    Unmounting temporary filesystem...OK
    Cleaning up temp filesystem...OK
    
    +-------------------------------------------------------------+
    | You are going to update the site milllion-doller-server     |
    | from version 1.4.0p8.cre to version                         |
    | 1.4.0p36.cre. This will include updating all of             |
    | you configuration files and merging changes in              |
    | the default files with changes made by you. In              |
    | case of conflicts your help will be needed.                 |
    +-------------------------------------------------------------+
    |                 < Abort >                          |
    +-------------------------------------------------------------+
    
    
    2018-09-28 13:32:09 - Updating site 'milllion-doller-server' from version 1.4.0p8.cre to 1.4.0p36.cre...
    
     * Updated        etc/nagvis/nagvis.ini.php
     * Updated        etc/nagvis/conf.d/demo.ini.php
    Finished update.
    
  5. Start the omd site after upgrade and check the status:

  6. OMD[milllion-doller-server]:~$ omd start
    Creating temporary filesystem /omd/sites/milllion-doller-server/tmp...OK
    Starting mkeventd...OK
    Starting rrdcached...OK
    Starting npcd...OK
    Starting nagios...2018-09-28 13:32:15 [6] updating log file index
    2018-09-28 13:32:15 [6] updating log file index
    OK
    Starting dedicated Apache for site milllion-doller-server...OK
    Initializing Crontab...OK
    
    OMD[milllion-doller-server]:~$ omd status
    mkeventd:       running
    rrdcached:      running
    npcd:           running
    nagios:         running
    apache:         running
    crontab:        running
    -----------------------
    Overall state:  running
    

Monday, September 17, 2018

Amazon Linux 2 add EPEL repository and install SSMTP

Latest updated Amazon Linux 2.
# uname -a
Linux ip-10-10-10-10.maillion-doller-server.local 4.14.67-71.56.amzn2.x86_64 #1 SMP Tue Sep 4 21:37:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Try to install SSMTP for sending Email:
[ec2-user@ip-10-10-10-10 ~]$ yum search ssmtp
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Warning: No matches found for: ssmtp
No matches found
Not in the base repo, try install epel:
[ec2-user@ip-10-10-10-10 ~]$ sudo yum install epel-release -y
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2-core                                                                                                                                      | 2.4 kB  00:00:00     
No package epel-release available.
Error: Nothing to do


epel-release is available in Amazon Linux Extra topic "epel"

To use, run
# sudo amazon-linux-extras install epel

Learn more at
https://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras
Just do it Amazon way:
[ec2-user@ip-10-10-10-10 ~]$ sudo amazon-linux-extras install epel
Installing epel-release
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
amzn2extra-docker                                                                                                                               | 1.3 kB  00:00:00     
amzn2extra-epel                                                                                                                                 | 1.3 kB  00:00:00     
amzn2extra-epel/2/x86_64/primary_db                                                                                                             | 1.8 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================================================================================
 Package                                   Arch                                Version                              Repository                                    Size
=======================================================================================================================================================================
Installing:
 epel-release                              noarch                              7-11                                 amzn2extra-epel                               15 k

Transaction Summary
=======================================================================================================================================================================
Install  1 Package

Total download size: 15 k
Installed size: 24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-11.noarch.rpm                                                                                                                    |  15 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : epel-release-7-11.noarch                                                                                                                            1/1 
  Verifying  : epel-release-7-11.noarch                                                                                                                            1/1 

Installed:
  epel-release.noarch 0:7-11                                                                                                                                           

Complete!
  0  ansible2                 available  [ =2.4.2  =2.4.6 ]
  1  emacs                    available  [ =25.3 ]
  2  httpd_modules            available  [ =1.0 ]
  3  memcached1.5             available  [ =1.5.1 ]
  4  nginx1.12                available  [ =1.12.2 ]
  5  postgresql9.6            available  [ =9.6.6  =9.6.8 ]
  6  postgresql10             available  [ =10 ]
  7  python3                  available  [ =3.6.2 ]
  8  redis4.0                 available  [ =4.0.5  =4.0.10 ]
  9  R3.4                     available  [ =3.4.3 ]
 10  rust1                    available  \
        [ =1.22.1  =1.26.0  =1.26.1  =1.27.2 ]
 11  vim                      available  [ =8.0 ]
 12  golang1.9                available  [ =1.9.2 ]
 13  ruby2.4                  available  [ =2.4.2  =2.4.4 ]
 14  nano                     available  [ =2.9.1 ]
 15  php7.2                   available  \
        [ =7.2.0  =7.2.4  =7.2.5  =7.2.8 ]
 16  lamp-mariadb10.2-php7.2  available  \
        [ =10.2.10_7.2.0  =10.2.10_7.2.4  =10.2.10_7.2.5
          =10.2.10_7.2.8 ]
 17  libreoffice              available  [ =5.0.6.2_15 ]
 18  gimp                     available  [ =2.8.22 ]
 19  docker=latest            enabled    \
        [ =17.12.1  =18.03.1  =18.06.1 ]
 20  mate-desktop1.x          available  [ =1.19.0  =1.20.0 ]
 21  GraphicsMagick1.3        available  [ =1.3.29 ]
 22  tomcat8.5                available  [ =8.5.31  =8.5.32 ]
 23  epel=latest              enabled    [ =7.11 ]
[ec2-user@ip-10-10-10-10 ~]$ yum update
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
You need to be root to perform this command.
Then Install it.
sudo yum install ssmtp -y

Wednesday, September 5, 2018

Quiter Apache Log for internal access

In the Apache2 server access log, I have lots of these:
10.10.10.12 - - [05/Sep/2018:13:42:38 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.11 - - [05/Sep/2018:13:42:39 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.12 - - [05/Sep/2018:13:42:40 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.11 - - [05/Sep/2018:13:42:41 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.12 - - [05/Sep/2018:13:42:42 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.11 - - [05/Sep/2018:13:42:43 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.12 - - [05/Sep/2018:13:42:44 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.11 - - [05/Sep/2018:13:42:45 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.12 - - [05/Sep/2018:13:42:46 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.11 - - [05/Sep/2018:13:42:47 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.12 - - [05/Sep/2018:13:42:48 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.11 - - [05/Sep/2018:13:42:49 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.12 - - [05/Sep/2018:13:42:50 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
10.10.10.11 - - [05/Sep/2018:13:42:51 -0400] "OPTIONS / HTTP/1.0" 200 192 "-" "-"
This is Apache internal child proc activity.
::1 - - [05/Sep/2018:13:48:35 -0400] "GET /server-status?auto HTTP/1.1" 400 0 "-" "Python-urllib/2.7"
::1 - - [05/Sep/2018:13:49:35 -0400] "GET /server-status?auto HTTP/1.1" 400 0 "-" "Python-urllib/2.7"
::1 - - [05/Sep/2018:13:50:35 -0400] "GET /server-status?auto HTTP/1.1" 400 0 "-" "Python-urllib/2.7"
::1 - - [05/Sep/2018:13:51:35 -0400] "GET /server-status?auto HTTP/1.1" 400 0 "-" "Python-urllib/2.7"
::1 - - [05/Sep/2018:13:52:35 -0400] "GET /server-status?auto HTTP/1.1" 400 0 "-" "Python-urllib/2.7"
::1 - - [05/Sep/2018:13:53:35 -0400] "GET /server-status?auto HTTP/1.1" 400 0 "-" "Python-urllib/2.7"
::1 - - [05/Sep/2018:13:54:35 -0400] "GET /server-status?auto HTTP/1.1" 400 0 "-" "Python-urllib/2.7"
::1 - - [05/Sep/2018:13:55:35 -0400] "GET /server-status?auto HTTP/1.1" 400 0 "-" "Python-urllib/2.7"
This is the check_mk logcal check plugin. On Debian Modify /etc/apache2/sites-enable/milliondollarserver.com/.conf
        SetEnvIf Request_URI "^/server-status" dontlog
        SetEnvIf Request_Method "^OPTIONS$" dontlog
        CustomLog ${APACHE_LOG_DIR}/milliondollarserver.com_ssl_access.log combined env=!dontlog
Restart the Apache2 service.
# service apache2 stop && rm -rf /var/log/apache2/* && service apache2 start && tailf /var/log/apache2/*