Friday, October 18, 2019

Installing MAILJET to Ubuntu 18.04 using POSTFIX (to send email using smtp mail relay)

MailJet is a Third Party email sending (SMTP mail relay).  Mailjet allow you to send up to 200 emails per day for Free (no strings attached!).

Go to mailjet to sign-up here:   https://www.mailjet.com

This guide will quickly show you all the commands to integrate MailJet to your Ubuntu 18.04 Server using POSTFIX.


INSTALLING POSTFIX MODULES AND SASL PASSWORD

sudo apt install postfix libsasl2-modules


SETUP POSTFIX's MAIN.CF CONFIGURATION FILE

sudo nano /etc/postfix/main.cf


# outbound relay configurationsrelayhost = in-v3.mailjet.com:587smtp_sasl_auth_enable = yessmtp_sasl_password_maps = hash:/etc/postfix/sasl_passwdsmtp_sasl_security_options = noanonymoussmtp_tls_security_level = mayheader_size_limit = 4096000

NOTE: your relayhost value may be different, please double check with your MailJet account.


SETUP POSTFIX's SASL_PASSWD FILE 
(get your api-key and secret-key from your MailJet account)

sudo nano /etc/postfix/sasl_passwd

in-v3.mailjet.com:587  api-key:secret-key

sudo postmap /etc/postfix/sasl_passwd
sudo chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo systemctl restart postfix


CONFIGURE YOUR SENDER ADDRESS -or- DOMAIN AUTHENTICATION
(this is VERY IMPORTANT for your email deliverability)

Go to your MailJet account and find Sender Email Address
Go to your MailJet account and find Domain Authentication


TEST SENDING EMAIL AND CHECK YOUR SCORE!

sudo apt install bsd-mailx


echo "this is a test email." | mailx -r from-address -s "Hello sending from MailJet" to-address


Installing Akaunting (open source accounting / invoicing software) on Ubuntu 18.04 LEMP

Welcome to my quick guide how to install self-hosted Akaunting web application. Akaunting is a very good open source accounting software. It is 100% free to use and customize because it is open source. It is built solidly using PHP and Laravel and stores data using MySQL server.

Here is the link to Akaunting project official website:

https://www.akaunting.com

Before you get started you may want to install LEMP (linux nginx mysql and PHP) first.
I have a quick 10 minute guide here:

https://ubuntu-server-how-to-tips-tricks.blogspot.com/2019/10/installing-lemp-linux-nginx-mysql-php.html

in this example I am going to store my akaunting software in /data_local/app/www/akaunting
yours may be different such as /var/www/akaunting


After you have LEMP installed you can start installing Akaunting:


DOWNLOAD AND COPY AKAUNTING ZIP FILE FROM THIS URL

https://akaunting.com/thank-you


PREPARE THE DESTINATION DIRECTORY

mkdir -p /data_local/app/www/akaunting


UNZIP THE AKAUNTING ZIP FILE  (adjust filename as necessary for different version)

unzip Akaunting_1.3.17-Stable.zip


SET CORRECT PERMISSION ON DESTINATION DIRECTORY

chmod -R 775 /data_local/app/www/akaunting
chown -R www-data:www-data /data_local/app/www/akaunting


SETUP MYSQL DATABASE, USER AND PERMISSIONS

sudo mysql
create database akaunting;
create user accountant@localhost identified by '<your_password_here>';
grant all privileges on akaunting.* to accountant@localhost;
flush privileges;
exit;


INSTALL ADDITIONAL PHP MODULES AS REQUIRED BY AKAUNTING

sudo apt install php-imagick php7.2-gd php7.2-curl php7.2-zip php7.2-xml php7.2-mbstring php7.2-bz2 php7.2-intl


SETUP NGINX CONFIGURATION FILE USING THE FOLLOWING TEXT

nano /etc/nginx/sites-enabled/default


server {

    listen 80 default_server;

    # listen 443 ssl http2;



    # ssl_certificate /ssl/crt/file.crt;

    # ssl_certificate_key /ssl/key/file.key;



    server_name _;



    root /data_local/app/www/akaunting/;



    add_header X-Frame-Options "SAMEORIGIN";

    add_header X-XSS-Protection "1; mode=block";

    add_header X-Content-Type-Options "nosniff";



    index index.html index.htm index.php;



    charset utf-8;



    location / {

        try_files $uri $uri/ /index.php?$query_string;

    }



    # Prevent Direct Access To Protected Files

    location ~ \.(env|log) {

        deny all;

    }



    # Prevent Direct Access To Protected Folders

    location ~ ^/(^app$|bootstrap|config|database|resources|routes|storage|tests|artisan) {

        deny all;

    }



    # Prevent Direct Access To modules/vendor Folders Except Assets

    location ~ ^/(modules|vendor)\/(.*)\.((?!ico|gif|jpg|jpeg|png|js|css|less|sass|font|woff|woff2|eot|ttf|svg).)*$ {

        deny all;

    }



    error_page 404 /index.php;



    # Pass PHP Scripts To FastCGI Server

    location ~ \.php$ {

        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; # Depends On The PHP Version

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        include fastcgi_params;

    }



    location ~ /\.(?!well-known).* {

        deny all;

    }

}


sudo systemctl nginx reload


GO TO BROWSER AND FINISH CONFIGURATION



Just follow the rest of the guide / wizard from the Akaunting.

Congratulations! You have just installed a free and powerful accounting software for your business!


REVERSE PROXY SETTING

If you are using Akaunting behind reverse proxy, make sure you add this setting:

fastcgi_param HTTPS 1;

This setting saved my day!


Installing LEMP (linux nginx mysql php) on Ubuntu 18.04 LTS and PHP 7.2+

Here is a quick guide how to install LEMP (linux + nginx + mysql/mariadb + PHP 7.2) on Ubuntu Server 18.04 LTS.

If this is a brand new server, you may want to do the Initial Commands I do for every new Ubuntu server first. It will only take about 3 min and you can find those initial commands here:

https://ubuntu-server-how-to-tips-tricks.blogspot.com/2019/10/initial-setup-commands-for-every-new.html

PREPARE APT

sudo apt update


INSTALL NGINX (web server)

sudo apt install nginx
sudo systemctl enable nginx


INSTALL MYSQL SERVER (or MARIADB)

sudo apt install mariadb-server mariadb-client
sudo systemctl enable mariadb
sudo mysql_secure_installation


INSTALL PHP 7.2+

sudo apt install php7.2 php7.2-fpm php7.2-mysql php-common php7.2-cli php7.2-common php7.2-json php7.2-opcache php7.2-readline


That's it, if all goes well you can do all of the above in less than 10 min!

Congratulations! you now have a fully functional LEMP server!






Initial setup commands for every new ubuntu server I setup

Each time I setup a new Ubuntu Server, I always do the same initial commands.  These commands will set the locale, date & time and base softwares.

SETTING LOCALE

sudo dpkg-reconfigure locales


SETTING TIMEZONE

timedatectl
timedatectl list-timezones
timedatectl set-timezone Region/Location


UPDATING APT

sudo apt update


UPGRADING OPERATING SYSTEM

sudo apt upgrade


INSTALLING BUILD ESSENTIAL

sudo apt install build-essential
sudo apt install software-properties-common



Sunday, September 8, 2019

How to configure / setup Star TSP100LAN (TSP 143) Thermal Receipt Printer on CUPS

I have search every where on google and did not find anybody providing tips on how to setup the settings on CUPS for the STAR TSP III 143 LAN printer

I had a USB version of this printer that died.

After that, I bought another Star TSP 143 printer but I bought the wrong one, I bought a LAN (RJ45 connector version).

So, I had to reconfigure my CUPS connection string from:

usb://Star/TSP143%20(STR_T-001)

to

lpd://10.1.10.202/
 -or-
lpd://10.1.10.202/queue

Since my printer was already configured for USB, all I had to do is change it using 'Modify Printer'
Here are the steps I took:

1. Select which protocol to use (select LPD/LPR - line printer):



2. On the next page, enter this URL on the address:

lpd://10.1.10.202/


3. Send a Test Print Page:

Go back to Printers from top menu, select the right printer, and select 'Print Test Page'


That's all, I hope this guide helps someone.

Thanks for visiting my blog.

Help support my blog...
If you happen to need to buy this Start Receipt Printer, please use my Amazon link below:

LAN / Network version:  https://amzn.to/2HUJ2zU
USB version:  https://amzn.to/317HQAS

--Andrew






Monday, June 3, 2019

How to install Elastic Search into Ubuntu 18.04 LTS server

This is an easy to follow how-to and list of commands to install ElasticSearch into Ubuntu 18.04 LTS (bionic beaver) server

Pre-requisites:

apt-get update


Install Java JRE:

apt-get install default-jre


Add APT repository:

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list


Update APT system again:

apt-get update




---------------------------------------
THE REST OF THE COMMANDS BELOW ARE FOR STARTING, STOPING AND MAINTAINING ELASTICSEARCH (NOT PART OF INSTALLATION)

Enable Elasticsearch Service (to be able to autostart)

systemctl enable elasticsearch.service



DONE - How to use your new ElasticSearch server

Edit configuration file:

nano /etc/elasticsearch/elasticsearch.yml

Default LOG file location:

/var/log/elasticsearch

Default DATA location:

/var/lib/elasticsearch


To Start ElasticSearch:

systemctl start elasticsearch

To Stop ElasticSearch:

systemctl stop elasticsearch



To Check Status of ElasticSearch:

systemctl status elasticsearch

Saturday, May 11, 2019

Get stronger security and higher SSL score by installing TLS 1.3, HTTP/2 and Diffie-Hellman

Having stronger security is always better than not.  Definitely nothing to lose.  I believe Google may even rank your website higher for having stronger encryption security.

This article provide instruction how to install TLS version 1.3, HTTP/2 and Diffie-Hellman key exchange.

Also as a bonus, we will specify a specific list of ciphers that we prefer to use.

This article will assume you are using Ubuntu 18.04 or above and NGINX 1.15 or above.

STEP 1 - CONFIGURING NGINX TO USE TLS 1.3

ssl_protocols TLSv1.3 TLSv1.2;

STEP 2 - Specify cipher suites using ECDHE (Ephemeral) Elliptic-Curve and Diffie-Hellman key exchange

ssl_ciphers "TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-256-GCM-SHA384:TLS13-AES-128-GCM-SHA256:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";

STEP 3 - CONFIGURING NGINX TO USE HTTP/2

Enable HTTP v2 by adding 'http2' at the end of the listen directive inside your nginx server block.
server {
listen 80; listen 443 ssl http2;
}

STEP 4 - GENERATE DIFFIE-HELLMAN CERTIFICATE

cd /etc/ssl
openssl dhparam -out dhparams.pem 4096
chown root:nginx dhparams.pem

STEP 5 - CONFIGURE NGINX TO USE DIFFIE-HELLMAN

# Use Diffie-Hellman and DHE cipher suites
ssl_dhparam /etc/ssl/dhparams.pem;



Once all of the above steps have been performed, restart your NGINX server using
systemctl restart nginx
or check the syntax first using command
nginx -t


Your server should now be using TLS 1.3, HTTP v2 and Diffie-Hellman which are the strongest SSL settings as of 5/11/19.

Wednesday, May 8, 2019

Install Imagemagick image convert on Ubuntu server 18.04 and 16.04

Imagemagick is command line image manipulation software. Imagemagick creates, edits, composes, and converts bitmap images. Resize an image, crop it, change its shades and colors, add captions, and more.

One of imagemagick's utility is 'convert'

This article will show you how to install Imagemagick which will include convert utility

Step 1: Update APT

sudo apt-get update


Step 2: Install ImageMagick

sudo apt-get install imagemagick

Step 3: Test convert

convert

Sample Output from convert


Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP

Usage: convert.im6 [options ...] file [ [options ...] file ...] [options ...] file

Image Settings:
  -adjoin              join images into a single multi-image file
  -affine matrix       affine transform matrix
  -alpha option        activate, deactivate, reset, or set the alpha channel
  -antialias           remove pixel-aliasing
  -authenticate password
                       decipher image with this password
  -attenuate value     lessen (or intensify) when adding noise to an image
  -background color    background color
  -bias value          add bias when convolving an image
  -black-point-compensation
                       use black point compensation
  -blue-primary point  chromaticity blue primary point
  -bordercolor color   border color
  -caption string      assign a caption to an image
  -channel type        apply option to select image channels
  -colors value        preferred number of colors in the image
  -colorspace type     alternate image colorspace
  -comment string      annotate image with comment
  -compose operator    set image composite operator
  -compress type       type of pixel compression when writing the image
  -define format:option
                       define one or more image format options
  -delay value         display the next image after pausing
  -density geometry    horizontal and vertical density of the image
  -depth value         image depth
  -direction type      render text right-to-left or left-to-right
  -display server      get image or font from this X server
  -dispose method      layer disposal method
  -dither method       apply error diffusion to image
  -encoding type       text encoding type
  -endian type         endianness (MSB or LSB) of the image
  -family name         render text with this font family
  -fill color          color to use when filling a graphic primitive
  -filter type         use this filter when resizing an image
  -font name           render text with this font
  -format "string"     output formatted image characteristics
  -fuzz distance       colors within this distance are considered equal
  -gravity type        horizontal and vertical text placement
  -green-primary point chromaticity green primary point
  -intent type         type of rendering intent when managing the image color
  -interlace type      type of image interlacing scheme
  -interline-spacing value
                       set the space between two text lines
  -interpolate method  pixel color interpolation method
  -interword-spacing value
                       set the space between two words
  -kerning value       set the space between two letters
  -label string        assign a label to an image
  -limit type value    pixel cache resource limit
  -loop iterations     add Netscape loop extension to your GIF animation
  -mask filename       associate a mask with the image
  -mattecolor color    frame color
  -monitor             monitor progress
  -orient type         image orientation
  -page geometry       size and location of an image canvas (setting)
  -ping                efficiently determine image attributes
  -pointsize value     font point size
  -precision value     maximum number of significant digits to print
  -preview type        image preview type
  -quality value       JPEG/MIFF/PNG compression level
  -quiet               suppress all warning messages
  -red-primary point   chromaticity red primary point
  -regard-warnings     pay attention to warning messages
  -remap filename      transform image colors to match this set of colors
  -respect-parentheses settings remain in effect until parenthesis boundary
  -sampling-factor geometry
                       horizontal and vertical sampling factor
  -scene value         image scene number
  -seed value          seed a new sequence of pseudo-random numbers
  -size geometry       width and height of image
  -stretch type        render text with this font stretch
  -stroke color        graphic primitive stroke color
  -strokewidth value   graphic primitive stroke width
  -style type          render text with this font style
  -synchronize         synchronize image to storage device
  -taint               declare the image as modified
  -texture filename    name of texture to tile onto the image background
  -tile-offset geometry
                       tile offset
  -treedepth value     color tree depth
  -transparent-color color
                       transparent color
  -undercolor color    annotation bounding box color
  -units type          the units of image resolution
  -verbose             print detailed information about the image
  -view                FlashPix viewing transforms
  -virtual-pixel method
                       virtual pixel access method
  -weight type         render text with this font weight
  -white-point point   chromaticity white point

Image Operators:
  -adaptive-blur geometry
                       adaptively blur pixels; decrease effect near edges
  -adaptive-resize geometry
                       adaptively resize image using 'mesh' interpolation
  -adaptive-sharpen geometry
                       adaptively sharpen pixels; increase effect near edges
  -alpha option        on, activate, off, deactivate, set, opaque, copy
                       transparent, extract, background, or shape
  -annotate geometry text
                       annotate the image with text
  -auto-gamma          automagically adjust gamma level of image
  -auto-level          automagically adjust color levels of image
  -auto-orient         automagically orient (rotate) image
  -bench iterations    measure performance
  -black-threshold value
                       force all pixels below the threshold into black
  -blue-shift factor   simulate a scene at nighttime in the moonlight
  -blur geometry       reduce image noise and reduce detail levels
  -border geometry     surround image with a border of color
  -bordercolor color   border color
  -brightness-contrast geometry
                       improve brightness / contrast of the image
  -cdl filename        color correct with a color decision list
  -charcoal radius     simulate a charcoal drawing
  -chop geometry       remove pixels from the image interior
  -clamp               restrict pixel range from 0 to the quantum depth
  -clip                clip along the first path from the 8BIM profile
  -clip-mask filename  associate a clip mask with the image
  -clip-path id        clip along a named path from the 8BIM profile
  -colorize value      colorize the image with the fill color
  -color-matrix matrix apply color correction to the image
  -contrast            enhance or reduce the image contrast
  -contrast-stretch geometry
                       improve contrast by `stretching' the intensity range
  -convolve coefficients
                       apply a convolution kernel to the image
  -cycle amount        cycle the image colormap
  -decipher filename   convert cipher pixels to plain pixels
  -deskew threshold    straighten an image
  -despeckle           reduce the speckles within an image
  -distort method args
                       distort images according to given method ad args
  -draw string         annotate the image with a graphic primitive
  -edge radius         apply a filter to detect edges in the image
  -encipher filename   convert plain pixels to cipher pixels
  -emboss radius       emboss an image
  -enhance             apply a digital filter to enhance a noisy image
  -equalize            perform histogram equalization to an image
  -evaluate operator value
                       evaluate an arithmetic, relational, or logical expression
  -extent geometry     set the image size
  -extract geometry    extract area from image
  -features distance   analyze image features (e.g. contrast, correlation)
  -fft                 implements the discrete Fourier transform (DFT)
  -flip                flip image vertically
  -floodfill geometry color
                       floodfill the image with color
  -flop                flop image horizontally
  -frame geometry      surround image with an ornamental border
  -function name parameters
                       apply function over image values
  -gamma value         level of gamma correction
  -gaussian-blur geometry
                       reduce image noise and reduce detail levels
  -geometry geometry   preferred size or location of the image
  -identify            identify the format and characteristics of the image
  -ift                 implements the inverse discrete Fourier transform (DFT)
  -implode amount      implode image pixels about the center
  -interpolative-resize geometry
                       resize image using 'point sampled' interpolation
  -lat geometry        local adaptive thresholding
  -layers method       optimize, merge,  or compare image layers
  -level value         adjust the level of image contrast
  -level-colors color,color
                       level image with the given colors
  -linear-stretch geometry
                       improve contrast by `stretching with saturation'
  -liquid-rescale geometry
                       rescale image with seam-carving
  -median geometry     apply a median filter to the image
  -mode geometry       make each pixel the 'predominant color' of the neighborhood
  -modulate value      vary the brightness, saturation, and hue
  -monochrome          transform image to black and white
  -morphology method kernel
                       apply a morphology method to the image
  -motion-blur geometry
                       simulate motion blur
  -negate              replace every pixel with its complementary color
  -noise geometry      add or reduce noise in an image
  -normalize           transform image to span the full range of colors
  -opaque color        change this color to the fill color
  -ordered-dither NxN
                       add a noise pattern to the image with specific
                       amplitudes
  -paint radius        simulate an oil painting
  -polaroid angle      simulate a Polaroid picture
  -posterize levels    reduce the image to a limited number of color levels
  -profile filename    add, delete, or apply an image profile
  -quantize colorspace reduce colors in this colorspace
  -radial-blur angle   radial blur the image
  -raise value         lighten/darken image edges to create a 3-D effect
  -random-threshold low,high
                       random threshold the image
  -region geometry     apply options to a portion of the image
  -render              render vector graphics
  -repage geometry     size and location of an image canvas
  -resample geometry   change the resolution of an image
  -resize geometry     resize the image
  -roll geometry       roll an image vertically or horizontally
  -rotate degrees      apply Paeth rotation to the image
  -sample geometry     scale image with pixel sampling
  -scale geometry      scale the image
  -segment values      segment an image
  -selective-blur geometry
                       selectively blur pixels within a contrast threshold
  -sepia-tone threshold
                       simulate a sepia-toned photo
  -set property value  set an image property
  -shade degrees       shade the image using a distant light source
  -shadow geometry     simulate an image shadow
  -sharpen geometry    sharpen the image
  -shave geometry      shave pixels from the image edges
  -shear geometry      slide one edge of the image along the X or Y axis
  -sigmoidal-contrast geometry
                       increase the contrast without saturating highlights or shadows
  -sketch geometry     simulate a pencil sketch
  -solarize threshold  negate all pixels above the threshold level
  -sparse-color method args
                       fill in a image based on a few color points
  -splice geometry     splice the background color into the image
  -spread radius       displace image pixels by a random amount
  -statistic type geometry
                       replace each pixel with corresponding statistic from the neighborhood
  -strip               strip image of all profiles and comments
  -swirl degrees       swirl image pixels about the center
  -threshold value     threshold the image
  -thumbnail geometry  create a thumbnail of the image
  -tile filename       tile image when filling a graphic primitive
  -tint value          tint the image with the fill color
  -transform           affine transform image
  -transparent color   make this color transparent within the image
  -transpose           flip image vertically and rotate 90 degrees
  -transverse          flop image horizontally and rotate 270 degrees
  -trim                trim image edges
  -type type           image type
  -unique-colors       discard all but one of any pixel color
  -unsharp geometry    sharpen the image
  -vignette geometry   soften the edges of the image in vignette style
  -wave geometry       alter an image along a sine wave
  -white-threshold value
                       force all pixels above the threshold into white

Image Sequence Operators:
  -append              append an image sequence
  -clut                apply a color lookup table to the image
  -coalesce            merge a sequence of images
  -combine             combine a sequence of images
  -composite           composite image
  -crop geometry       cut out a rectangular region of the image
  -deconstruct         break down an image sequence into constituent parts
  -evaluate-sequence operator
                       evaluate an arithmetic, relational, or logical expression
  -flatten             flatten a sequence of images
  -fx expression       apply mathematical expression to an image channel(s)
  -hald-clut           apply a Hald color lookup table to the image
  -morph value         morph an image sequence
  -mosaic              create a mosaic from an image sequence
  -print string        interpret string and print to console
  -process arguments   process the image with a custom image filter
  -separate            separate an image channel into a grayscale image
  -smush geometry      smush an image sequence together
  -write filename      write images to this file

Image Stack Operators:
  -clone indexes       clone an image
  -delete indexes      delete the image from the image sequence
  -duplicate count,indexes
                       duplicate an image one or more times
  -insert index        insert last image into the image sequence
  -reverse             reverse image sequence
  -swap indexes        swap two images in the image sequence

Miscellaneous Options:
  -debug events        display copious debugging information
  -help                print program options
  -list type           print a list of supported option arguments
  -log format          format of debugging information
  -version             print version information

By default, the image format of `file' is determined by its magic
number.  To specify a particular image format, precede the filename
with an image format name and a colon (i.e. ps:image) or specify the
image type as the filename suffix (i.e. image.ps).  Specify 'file' as
'-' for standard input or output.

FIX: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32 [SOLVED]

[SOLVED] NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32


During updating my ubuntu packages from command line using

apt-get update

or

apt update

I got the following errors

W: GPG error: http://security.ubuntu.com trusty-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http://archive.ubuntu.com trusty-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http://archive.ubuntu.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32
W: GPG error: http://archive.canonical.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5 NO_PUBKEY 3B4FE6ACC0B21F32



SOLVE THIS ISSUE BY TYPING THE FOLLOWING COMMANDS:

apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 40976EAF437D05B5

apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32


Output from executing: apt install php5.6 php5.6-fpm (on Ubuntu Server 18.04 bionic beaver)

Output from executing

apt install php5.6 php5.6-fpm

To install PHP 5.6 with FPM on to Ubuntu 18.04 (bionic beaver)



Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  libpcre3 php-common php5.6-cli php5.6-common php5.6-json php5.6-opcache php5.6-readline
Suggested packages:
  php-pear
The following NEW packages will be installed:
  php-common php5.6 php5.6-cli php5.6-common php5.6-fpm php5.6-json php5.6-opcache php5.6-readline
The following packages will be upgraded:
  libpcre3
1 upgraded, 8 newly installed, 0 to remove and 2 not upgraded.
Need to get 5,990 kB of archives.
After this operation, 16.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 libpcre3 amd64 2:8.42-1+ubuntu18.04.1+deb.sury.org+1 [237 kB]
Get:2 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php-common all 2:69+ubuntu18.04.1+deb.sury.org+2+php7.3 [15.1 kB]
Get:3 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php5.6-common amd64 5.6.40-7+ubuntu18.04.1+deb.sury.org+1 [2,764 kB]
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php5.6-json amd64 5.6.40-7+ubuntu18.04.1+deb.sury.org+1 [17.9 kB]
Get:5 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php5.6-opcache amd64 5.6.40-7+ubuntu18.04.1+deb.sury.org+1 [62.6 kB]
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php5.6-readline amd64 5.6.40-7+ubuntu18.04.1+deb.sury.org+1 [12.9 kB]
Get:7 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php5.6-cli amd64 5.6.40-7+ubuntu18.04.1+deb.sury.org+1 [1,301 kB]
Get:8 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php5.6-fpm amd64 5.6.40-7+ubuntu18.04.1+deb.sury.org+1 [1,316 kB]
Get:9 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 php5.6 all 5.6.40-7+ubuntu18.04.1+deb.sury.org+1 [263 kB]
Fetched 5,990 kB in 6s (941 kB/s)
(Reading database ... 24637 files and directories currently installed.)
Preparing to unpack .../libpcre3_2%3a8.42-1+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking libpcre3:amd64 (2:8.42-1+ubuntu18.04.1+deb.sury.org+1) over (2:8.39-9) ...
Setting up libpcre3:amd64 (2:8.42-1+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php-common.
(Reading database ... 24637 files and directories currently installed.)
Preparing to unpack .../0-php-common_2%3a69+ubuntu18.04.1+deb.sury.org+2+php7.3_all.deb ...
Unpacking php-common (2:69+ubuntu18.04.1+deb.sury.org+2+php7.3) ...
Selecting previously unselected package php5.6-common.
Preparing to unpack .../1-php5.6-common_5.6.40-7+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php5.6-common (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php5.6-json.
Preparing to unpack .../2-php5.6-json_5.6.40-7+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php5.6-json (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php5.6-opcache.
Preparing to unpack .../3-php5.6-opcache_5.6.40-7+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php5.6-opcache (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php5.6-readline.
Preparing to unpack .../4-php5.6-readline_5.6.40-7+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php5.6-readline (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php5.6-cli.
Preparing to unpack .../5-php5.6-cli_5.6.40-7+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php5.6-cli (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php5.6-fpm.
Preparing to unpack .../6-php5.6-fpm_5.6.40-7+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php5.6-fpm (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...
Selecting previously unselected package php5.6.
Preparing to unpack .../7-php5.6_5.6.40-7+ubuntu18.04.1+deb.sury.org+1_all.deb ...
Unpacking php5.6 (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up php-common (2:69+ubuntu18.04.1+deb.sury.org+2+php7.3) ...
Created symlink /etc/systemd/system/timers.target.wants/phpsessionclean.timer → /lib/systemd/system/phpsessionclean.timer.
Processing triggers for systemd (237-3ubuntu10.21) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up php5.6-common (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...

Creating config file /etc/php/5.6/mods-available/calendar.ini with new version

Creating config file /etc/php/5.6/mods-available/ctype.ini with new version

Creating config file /etc/php/5.6/mods-available/exif.ini with new version

Creating config file /etc/php/5.6/mods-available/fileinfo.ini with new version

Creating config file /etc/php/5.6/mods-available/ftp.ini with new version

Creating config file /etc/php/5.6/mods-available/gettext.ini with new version

Creating config file /etc/php/5.6/mods-available/iconv.ini with new version

Creating config file /etc/php/5.6/mods-available/pdo.ini with new version

Creating config file /etc/php/5.6/mods-available/phar.ini with new version

Creating config file /etc/php/5.6/mods-available/posix.ini with new version

Creating config file /etc/php/5.6/mods-available/shmop.ini with new version

Creating config file /etc/php/5.6/mods-available/sockets.ini with new version

Creating config file /etc/php/5.6/mods-available/sysvmsg.ini with new version

Creating config file /etc/php/5.6/mods-available/sysvsem.ini with new version

Creating config file /etc/php/5.6/mods-available/sysvshm.ini with new version

Creating config file /etc/php/5.6/mods-available/tokenizer.ini with new version
Setting up php5.6-readline (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...

Creating config file /etc/php/5.6/mods-available/readline.ini with new version
Setting up php5.6-opcache (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...

Creating config file /etc/php/5.6/mods-available/opcache.ini with new version
Setting up php5.6-json (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...

Creating config file /etc/php/5.6/mods-available/json.ini with new version
Setting up php5.6-cli (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...
update-alternatives: using /usr/bin/php5.6 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar5.6 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar5.6 to provide /usr/bin/phar.phar (phar.phar) in auto mode

Creating config file /etc/php/5.6/cli/php.ini with new version
Setting up php5.6-fpm (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...

Creating config file /etc/php/5.6/fpm/php.ini with new version
Created symlink /etc/systemd/system/multi-user.target.wants/php5.6-fpm.service → /lib/systemd/system/php5.6-fpm.service.
Setting up php5.6 (5.6.40-7+ubuntu18.04.1+deb.sury.org+1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for systemd (237-3ubuntu10.21) ...

Installing ppa:ondrej/nginx-mainline on Ubuntu Server 18.04 LTS (bionic beaver)

Output from executing:

ppa:ondrej/nginx-mainline

executed on Ubuntu Server 18.04 LTS (bionic beaver)

----------------------------

This branch follows latest NGINX Mainline packages compiled against latest OpenSSL for HTTP/2 and TLS 1.3 support.

BUGS&FEATURES: This PPA now has a issue tracker: https://deb.sury.org/#bug-reporting

PLEASE READ: If you like my work and want to give me a little motivation, please consider donating: https://donate.sury.org
 More info: https://launchpad.net/~ondrej/+archive/ubuntu/nginx-mainline
Press [ENTER] to continue or Ctrl-c to cancel adding it.


Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:4 http://ppa.launchpad.net/ondrej/nginx-mainline/ubuntu bionic InRelease [20.8 kB]
Hit:5 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Get:6 http://ppa.launchpad.net/ondrej/nginx-mainline/ubuntu bionic/main amd64 Packages [6,520 B]
Get:7 http://ppa.launchpad.net/ondrej/nginx-mainline/ubuntu bionic/main Translation-en [6,920 B]
Fetched 123 kB in 1s (125 kB/s)
Reading package lists... Done

Installing ondrej/php PPA on Ubuntu 18.04 LTS (bionic beaver)

Output from executing - executed on Ubuntu Server 18.04 LTS (bionic beaver)

add-apt-repository ppa:ondrej/php


Co-installable PHP versions: PHP 5.6, PHP 7.x and most requested extensions are included. Only Supported Versions of PHP (http://php.net/supported-versions.php) for Supported Ubuntu Releases (https://wiki.ubuntu.com/Releases) are provided. Don't ask for end-of-life PHP versions or Ubuntu release, they won't be provided.

Debian oldstable and stable packages are provided as well: https://deb.sury.org/#debian-dpa

You can get more information about the packages at https://deb.sury.org

BUGS&FEATURES: This PPA now has a issue tracker:
https://deb.sury.org/#bug-reporting

CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advise to add ppa:ondrej/nginx-mainline
   or ppa:ondrej/nginx

PLEASE READ: If you like my work and want to give me a little motivation, please consider donating regularly: https://donate.sury.org/

WARNING: add-apt-repository is broken with non-UTF-8 locales, see
https://github.com/oerdnj/deb.sury.org/issues/56 for workaround:

# LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
 More info: https://launchpad.net/~ondrej/+archive/ubuntu/php
Press [ENTER] to continue or Ctrl-c to cancel adding it.



Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:4 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease [20.8 kB]
Get:5 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main amd64 Packages [45.1 kB]
Get:6 http://ppa.launchpad.net/ondrej/php/ubuntu bionic/main Translation-en [22.1 kB]
Fetched 177 kB in 1s (131 kB/s)
Reading package lists... Done

Manually do security and critical updates on ubuntu servers

For most ubuntu servers I manage, I turn off automatic updates and upgrades. I don't like surprises and sometime automatic update / upgrades creates compatibility issues. 

(see my article of how to disable or turn off automatic updates / upgrades on ubuntu servers here)

Even though I decide to turn off automatic updates, I still have to keep watch for crucial and security updates manually (I recommend at least once every quarter).

This article will provide instruction how to do manually SECURITY and CRUCIAL updates on your ubuntu server:

Display Available Security Updates

unattended-upgrade --dry-run -d

Install Security Updates Only

apt-get -s dist-upgrade | grep "^Inst" | grep -i securi | awk -F " " {'print $2'} | xargs apt-get install

Disable / Turn Off Automatic Update in Ubuntu 16.04 18.04 20.04 Servers

For servers, especially production servers, I prefer automatic updates and upgrades to be turned off. Even security and crucial updates will be turned off.

I prefer turning off automatic update to avoid surprises. There were times newer version of packages cause incompatible issues and breaks web sites and applications.

If you decide to turn off automatic update, make sure to schedule quarterly server maintenance to update SECURITY and CRUCIAL updates. Please see this article about how to manually do security and crucial updates on ubuntu servers.

Here is how you can quickly turn off / disable automatic update for ubuntu servers.

Edit this apt configuration file:

/etc/apt/apt.conf.d/20auto-upgrades


Type this command to open nano editor and edit the file 20auto-upgrades:

nano /etc/apt/apt.conf.d/20auto-upgrades


Edit the content of 20auto-upgrades so that the following two lines contains the value of "0"

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


You don't need to restart server. This new apt configuration setting will be used the next time apt try to do routine update or upgrade.