Tuesday, October 17, 2017

Find missing value from one file to another

To find a missing line (value) from one file compared to the other.

Using grep by combining the -v (show non-matching lines), -x (match whole lines) and -f (read patterns from file) options:
grep -v -x -f B.txt A.txt
This does not depend on the order of the files - it will remove any lines from A that match a line in B.

Friday, October 13, 2017

Ubuntu free up /boot to upgrade

Linux Kernel older images can take up all your /boot partition.  BUT there are times where the /boot is already at 100% hence you cannot perform any autoremove nor upgrade.
sudo apt-get -f autoremove
lsb_release -a;uname -a;dpkg -l|grep linux-image
Note the current used Linux kernel image so avoid it. Don't worry, if your current image has a dependency, it will warn you and will not remove them.
dpkg --purge <linux-image-not-needed> <linux-image-extra-not-needed>
sudo apt-get -f autoremove 


Wednesday, October 4, 2017

Pitfall of Ubuntu 14.04 to 16.04 Upgrade

Here are some notes that really can get you in trouble with the Ubuntu 14.04 to 16.04 upgrade:

In Ubuntu 16.04, important changes since the preceding LTS release include a transition to the systemd init system in place of Upstart, an emphasis on Python 3 support, and PHP 7 in place of PHP 5.

01.  In a VMware 6.0 environment, using the VMXNET3 ethernet adapter; the interface name will change.  To fix this, go find the new interface name with
lshw -C Network
then fix the /etc/network/interfaces with the new interface name then
ifup <interface_name>
02. Django will definitely break.  To satisfy the dependencies, locate the requirements.txt then
sudo apt-get install python-setuptools
sudo easy_install --upgrade django

pip install --upgrade pip
pip install -r <path/to/requirements.txt>

03. Nginx will also break with the new /etc/nginx/nginx.conf so you might have to use the old nginx.conf.dpkg-old backup 

04.  For Wordpress using NGINX, here is an article that covers all the necessary steps: https://thecustomizewindows.com/2016/09/upgrade-ubuntu-server-14-04-16-04-live-wordpress/

Monday, September 25, 2017

Replace HTTP to HTTPS

To quickly replace all of the http to https within a file can be easily done by
sed -i 's|http:|https:|g' *.html
 
or find
find . -name "*.html" -exec sed -i 's|http:|https:|g' {} \; 

Thursday, September 14, 2017

Increase Max Filesize Upload in Wordpress



This address specifically to the Media Library upload limitation within Wordpress

NGINX Configuration

Modified /etc/nginx/nginx.conf within the http section

http {
      # set client body size to 200M #
      client_max_body_size 200M;

PHP Configuration


Modified php.ini with three items within /etc/php/7.0/cli/php.ini and /etc/php/7.0/fpm/php.ini

  • upload_max_filesize = 200MB
  • post_max_size = 200MB
  • memory_limit = 128MB

WP Plugin


Used Increase Upload Max Filesize