March 28
Certbot SSL Certification Auto Renew Cron Job
Let's encrypt SSL certificates will get expired after 90 Days of installation and you must renew it before it get expired.
Certbot Renew Command
$ sudo certbot renew --dry-run
Certbot Auto Renew Cron Job
$ cat /etc/cron.d/certbot
Content:
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc....
February 26
Upgrade Ubuntu 16.04 to Ubuntu 18.04 LTS
Note: you should stop apache before upgrade. You should back up your conf files, such as apache2.conf, php.ini, my.ini, and all VirtualHost settings.
Run simple command to upgrade.
sudo do-release-upgrade
After server restarted, login and STOP apache2 to prevent PHP short end breaks php rendering.
Enable new php short hand tag in php.ini if it is needed for your code.
sudo apt-get remove php7.2-common
sudo apt...
February 26
How to Upgrade Ubuntu 14 to 16
check current version:
lsb_release -a
Install Available Updates
apt-get update
apt-get upgrade
apt-get dist-upgrade
Stop Services
service apache2 stop
START UPGRADE
1. Install the update-manager-core package:
apt-get install update-manager-core
2. Open /etc/update-manager/release-upgrades and verify that the Prompt value is set to lts:
Prompt=lts
3. You’re now ready to begin the upgrade to Ubuntu 16.04 LTS:
do-release-upgrade
Follow the on-screen instructions to complete the installation process.
Install and Update php7.0 properly after upgrade.
note: you might want...
May 13
Use /etc/hosts to direct wildcard domain name
You need to set up a DNS server. (install dnsmasq (is light) or bind (is rather heavy)). To install...
Ubuntu OS:
sudo apt-get install dnsmasq
In /etc/NetworkManager/dnsmasq.d/dnsmasq-localhost.conf
and
address=/localhost.com/127.0.0.1
restart
sudo /etc/init.d/dnsmasq restart
with Mac OS:
Install dnsmasq
brew update # Always update Homebrew and the formulae first
brew install dnsmasq
sudo brew services start dnsmasq
sudo brew services start dnsmasq
Configure dnsmasq
Its default configuration file is located at /usr/local/etc/dnsmasq.conf and contains examples of...
October 24
How to Manage File and Folder Permissions in Linux
Command line: File permissions
The commands for modifying file permissions and ownership are:
chmod – change permissions
chown – change ownership.
chmod – the command to modify permissions
R – this modifies the permission of the parent folder and the child objects within
ugo+rw – this gives User, Group, and Other read and write access.
The breakdown of permissions looks like this:
u – user
g – group
o –...
October 24
Linux user and group management commands
How to See Which Groups Your Linux User Account Belongs To?
groups
How to add a new group?
sudo groupadd
How to add user to a group?
usermod -a -G
Change a User’s Primary Group
While a user account can be part of multiple groups, one of the groups is always the “primary group” and the others are “secondary groups”. The user’s login...