Wednesday, November 23, 2016

Upgrade Ubuntu 14.05 to Ubuntu 16.04

Here is the step: (but may be there is some lack here and there in the step)

At the first step I try to upgrade using this step: 
Ref:  https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-ubuntu-16-04-lts

Then everything turn problem.. All services cannot started :( 

Here we go.. lets find out the solution :)
1. I notice that the version of php5 is already replace with php7. Which maybe the culprit of this problem. 
2. Mysql also cannot restart. 
3. Nginx problem because of the php5-fpm already deinstall and cannot be install again. 

Ok.. Lets start to patch;
1. uninstall all the package including all the dependancy of the package mysql.
#dpkg -P --force depends mysql-server mysql-server-5.7 mysql-common mysql-server-core-5.7 php5-mysql mysql-client-5.7 mysql-client-core-5.7 libdbd-mysql-perl libmysqlclient18:amd64 libmysqlclient20:amd64

2. uninstall all the package including all the dependancy of php
#apt-get purge php5-common php5-curl php5-json php5-mysql

3. unistall nginx 
#apt autoremove nginx

Then reinstall back
1. apt-get install mysql-server mysql-client mysql-common dbconfig-mysql
2. apt-get install php-fpm php-mysql



Changes in Mysql

#systemctl stop mysql

#nano /etc/mysql/mysql.conf.d/mysqld.cnf
datadir=/mnt/data/mysql

#nano /etc/apparmor.d/tunables/alias
alias /var/lib/mysql/ -> /mnt/data/mysql/,

#systemctl restart apparmor
#systemctl start mysql

Ref: https://www.digitalocean.com/community/tutorials/how-to-move-a-mysql-data-directory-to-a-new-location-on-ubuntu-16-04

Changes in php
Do some changes at 
#nano /etc/php/7.0/fpm/php.ini
;cgi.fix_pathinfo=1
cgi.fix_pathinfo=0


#systemctl status php7.0-fpm
#systemctl start php7.0-fpm

Changes in Nginx
#nano /etc/nginx/sites-available/default 
fastcgi_pass unix:/run/php/php7.0-fpm.sock;

Ref: https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-ubuntu-14-04
Ref: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04

Others command;
apt-cache show mysql-server | grep Version    ; check version mysql 
dpkg --get-selections | grep php      ; check list package with php
lsb_release -a          ;check version ubuntu
nginx -t      ;test nginx config




Tuesday, November 1, 2016

File Transfer With On-the-fly Compression

I want to copy a folder from 1 server to another server with smart way.
1. Because not enough space to extract in current server. 
2. To transfer big files with minimal time.

Here is the command; 
Run this at "server source" 
tar czf - /path/to/copy/folder | ssh shariha@serverdestination tar xzf - -C /path/to/place

eg:  
server source: 10.10.10.10 : want to copy folder /data/folder1
server destination: 10.10.10.11 : want to place it at  /data/migrate/

run at 10.10.10.10
tar czf - /data/folder1 | ssh shariha@10.10.10.11 tar xzf - -C /data/migrate/

ps: this will tar the folder and untar directly to the path that we want to place it. :) 

Nice :)