Thursday, September 10, 2020

tmux multiplexer

 Used for enhancing your work area in linux command line.

Useful Links:


yum install tmux

Tmux has sessions, windows and panes hierarchy.

tmux -V #Version
    new #new session
    new -s [name of session]
    ls #list sessions
    attach-session -t 3
    a # #attach last session with #
    a -t [name of session] #reattaches to the session.
    rename-session -t 0 database
    kill-server

    
    
Ctrl + b

  •     ? - help
Sessions
  •     d - detach ; D - which session to detach; 
  •     s sessions; ) , (  , switch sessions;  
  •     new #new session
  •     new -s [name of session]
  •     ls #list sessions
  •     attach-session -t 3
  •     a # #attach last session with #
  •     a -t [name of session] #reattaches to the session.
  •     rename-session -t 0 database
  •     kill-server

Windows
    •     c - create window;  
    •     switch windows; by n,p  <number>;     n(next), p(previous), number
    •     , - rename window
Panes
    •     " - split horizontally; display split into 2 different panes.
    •     % - vertical split
    •     [arrow key] to move between panes
    •     [HOLD arrow key] to resize  panes
    •     x kill current pane
    •     exit or ctrl_d exit a pane
    •    z - full screen pane and back;
    •     :resize-pane -D 2 #-U for up, -D for down -L for left and -R for right. The last part is the number of lines to move it over by.

  •     x - kill
  •     :list-keys

    
    ~/.tmux.conf
    
Copy paste; hold Shift key then select from mouse

If you press shift while doing things with the mouse, that overrides the mouse protocol and lets you select/paste. It's documented in the xterm manual for instance, and most terminal emulators copy that behavior.


https://gist.github.com/spicycode/1229612

oracle@localhost $ cat .tmux.conf
# Uncomment the lines with the options you want to activate (by deleting the preceding "#")

# Allow mouse interaction
#setw -g mode-mouse on
set -g mode-mouse on

# Allow mouse to select which pane to use
set -g mouse-select-pane on

# Allow mouse dragging to resize panes
set -g mouse-resize-pane on

# Reload tmux config
bind r source-file ~/.tmux.conf

#set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'

On unix you can also use alternatives like screen or  gcm.

Tuesday, June 30, 2020

Migrate Mediawiki to new version on westhost platform

Westhost ( https://www.westhost.com/ ) is my long time website hosting platform, recently upgraded their platform to utilize cpanel. They moved the mysql databases and site to new platform, but the wiki's i've been running earlier stopped working. I haven't been actively managing those wiki's so the software was quite old version 1.14 of Mediawiki than current 1.34.2
The platform also changed in many ways. Newer php 7.2.x, mariadb, cpanel.
So the old wiki's refused to work with newer php, and the sites went down!
I was left with many questions , in order to get sites working.
Primarily, How to make Mediawiki work with new php, and get the db also updated.?
So, this is what i tried:
Download new software-
https://www.mediawiki.org/wiki/Download
Read through its upgrading doc at  https://www.mediawiki.org/wiki/Manual:Upgrading
It looked like many LocalSettings.php(LS) parameters also changed, and i had no idea what would work. So, first thing, instead of upgrading existing wiki's. I installed a new wiki altogether, utilizing the install guide at https://www.mediawiki.org/wiki/Manual:Installation_guide#Main-installation-guide

The westhost's cpanel has ui for Mysql DB's - so created new Test db there and associated a new user to it. Cpanel's Metrics->Errors was useful to veiw errors as they happened. For some reason , apache's direct access to its log is not there in new platform?

So, after installing a new wiki, it had generated its new LS , which was now useful to compare to the very old wiki's parameters.

In order to upgrade, encountered quite a few issues, i'm documenting steps below to help anyone doing similar excercise:

Do a  http://www.yourdomain.com/phpinfo.php -> To see if php runs and what version.
extract mediawiki s/w
 wget https://releases.wikimedia.org/mediawiki/1.34/mediawiki-1.34.2.tar.gz
rename old wiki to wiki_old.. rename mediawiki to wiki
chmod -R g-w wiki
 cd wiki
 chmod -R 644 *.php */*.php

change LocalSettings parameters carefully
 add .htaccess with just -> DirectoryIndex index.php
copy old images, skins/common files from old wiki to new. 
Go to wiki/maintenance and run "php update.php" command. This fixes the DB to work with new version of mediawiki. ##IF this does not work try the web update..http://www.yourdomain.com/mw-config  ..that shows errors happening.. For me few extensions were outdated ,so without any error message , i couldn't figure out what's wrong. So used the web update, which showed those errors.


Do enable display errors feature from cpanel ->  Multiphp ini editor section -> display_errors; prior

Once update is done, the wiki should work normally. Thanks to Mediawiki folks for documenting so well, and making the s/w update smooth. I didn't think it would be possible to upgrade from such a old version.

LS parameters updated:
wgServer
Database settings
$wgDBTableOptions   = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
#$wgDBmysql5  commented this
$wgMemCachedServers = [];
wfLoadSkin( 'MonoBook' );
wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );
Extensions to:
wfLoadExtension( 'Cite' );
Comment/remove the $wgUpgradeKey  once the update is done.