Wednesday, May 8, 2019

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.


Monday, October 1, 2018

Stopping ALL your proxmox services in Proxmox PVE 5.x

Sometime you just need to STOP promox pve services in your hardware nodes because they froze or not functioning properly. These commands below will help you stop all your proxmox services:

killall -9 corosync
systemctl stop pve-cluster
systemctl stop pvedaemon
systemctl stop pveproxy
systemctl stop pvestatd


Restart all Proxmox services in PVE 5.x

Sometime you just need to restart promox pve services in your hardware nodes because they froze or not functioning properly. These commands below will help you restart all your proxmox services:

killall -9 corosync
systemctl restart pve-cluster
systemctl restart pvedaemon
systemctl restart pveproxy
systemctl restart pvestatd



Tuesday, September 11, 2018

Setup outgoing email using Rackspace SMTP for your ubuntu server using Postfix

Follow this very easy steps to send outgoing emails from your ubuntu server using Rackspace Email server SMTP.


Step 1 - Prepare required software

aptitude update apt-get install postfix libsasl2-modules

Step 2 - Configure Postfix's main.cf

Add the following to /etc/postfix/main.cf:
 relayhost = secure.emailsrvr.com
 smtp_sasl_auth_enable=yes
 smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
 smtp_sasl_mechanism_filter = AUTH LOGIN
 smtp_sasl_security_options =

Step 3 - Set your username and password into sasl_password

Add the Rackspace Email username and password to /etc/postfix/sasl_passwd by running these commands:
echo 'secure.emailsrvr.com username@domain.com:secretpassword' > /etc/postfix/sasl_passwd
chmod 600 /etc/postfix/sasl_passwd
postmap /etc/postfix/sasl_passwd

Step 4 - Restart Postfix

service postfix restart

Step 5 - Send test email

echo "My message body" | mail -s "Test Email Subject" somebody@gmail.com
That is all... 5 easy steps will get your server sending email reliably using Rackspace Email account!

Sunday, May 27, 2018

Preparation commands I do for every new Ubuntu Server


For every Ubuntu server I build, I always take time to configure it should have a good base.  A good base for any type of server is having its Time Zone, Locales, and Character sets set correctly.  Another software which is usually required is the Ubuntu PPA software repository system.

Here are the commands I usually execute for every Ubuntu server I create:

UPDATE AND UPGRADE

apt-get update
apt-get -y dist-upgrade


SETTING TIME ZONE

dpkg-reconfigure tzdata


SETTING LOCALES

locale-gen en_US en_US.UTF-8

INSTALL PPA REPOSITORY SUPPORT

apt-get install software-properties-common python-software-properties


UNINSTALL POSTFIX (if you don't need to send email)

service stop postfix
apt-get remove postfix
apt-get purge
apt-get autoclean