LAMP server q.s.a. install manual 2

1.2 Learn shell and documents handling

1.2.1 Shell Basics for Shell script beginners the differences between connector character(; & && ||)

#shell list bulid my own. upload in time. #afterboot    <linked #sshdsafe #basicwebserver #advancewebserver

#shell scripts

bash < na




for f in ./*
    echo $f


$# counts
$0 script name
$1 option…

#return code status

echo $?

#tar command options

f ile name
v erbose
c reate
x extract
t arget
z gz
i bz2
j xz

1.2.2 Editor VIM Vim vi commands(jp) Vim Tutorial and Reference PDF

VIM is a text editor. You have to learn it to manage the server on CLI(command-line interface).


Before you type commands, you should learn VIM usage. The PDF link above will be helpful for your learning.
Try to type “vi”; you can get minimum help.
You should know these commands like ,i,a,,h,j,k,l,x,u,+R,U,ZZ,G,:q,:q!:wq!,yy,dd,p,o,O,w,b,$,,f,t,/,\,n,?

#vi command: enter [i] and move the cursor to target and hit key your number
#[ESC] then type <:wq> if you make miss, you can recover hit [ESC][u]
#learn how to use vim at vim tutor.

###option config###
vi .vimrc
set nocompatible
set fileformats=unix,dos
syntax on
set autoindent
set history=50
set number
set list
set showmatch
highlight Comment ctermfg=LightCyan
set wrap
set shiftwidth=4

1.2.3 Sed how to use ‘sed’


Stream editor is Sed.


sed -i -e 's/<..full text ..(.*)>/<..replace text..>/g' <..distination file..>
-i inplace
-e expression script
s reguler expression
g copy hold to pattern

#add line top of file

sed -e '1i \

#add lines in the middle of lines

sed -e '/<..line top..>/,/<..line bottom..>/c \
<..insert lines..> \

#add line end of file

sed -e '$a \

BusyBox v1.31.1 () multi-call binary.
Usage: sed [-i[SFX]] [-nrE] [-f FILE]… [-e CMD]… [FILE]…
or: sed [-i[SFX]] [-nrE] CMD [FILE]…

-e CMD Add CMD to sed commands to be executed
-f FILE Add FILE contents to sed commands to be executed
-i[SFX] Edit files in-place (otherwise sends to stdout)
Optionally back files up, appending SFX
-n Suppress automatic printing of pattern space
-r,-E Use extended regex syntax

If no -e or -f, the first non-option argument is the sed command string.
The remaining arguments are input files (stdin if none).

1.2.4 Regular expressions

It must be so helpful for you.

Learn hard!

need escape\

  • *? [ ‘ ” ` \ $ ; & ( ) | ~ < > # % = [space][tab][cr]

1.3 Disk handling

#device detection


#well known point



fdisk just for MBR(old type
gdisk GPT


mkfs -t xfs /dev/vdb


LAMP server q.s.a. install manual 1

1 OS install (CentOS ver8.1) CentOS download latest current 8.1 RHEL8 note Great instruction in japanese JPCERTCC(jp) Japan Vulnerability Notes(jp) v2.0.0.html Semantic Versioning GNU GRUB Manual 2.00 CPG(jp) IT Pro Linux commands INDEX(jp) RPM and YUM DNF

Download the latest ISO image from the official site.
The full contents version(everything ISO) is oversizing against DVD content.

I will go with the “Docker,” so I have to decide where the goal should be as a localhost machine.
Considering a moment, then I choose the endpoint at the minimum connection from outside, and has security at least.
Before the chapter of “7 Docker basic” is designed for a primary host machine based on the PLAN A.

1.1 Virtual Private Server, ONAMAE VPS link(userID and password is required) (jp)

Upload the iso image to VPS provider’s storage, follow the instruction

Control Panel >
Server List >kvm******** [click]
Power Off (Confirm stop power)
OS re-install tab
OS:[custom OS] > pull down the list, and the last one is the latest you uploaded.
Semi-virtual driver (virtio) [on]
VNC console keymap [ja]
video [cirrus] (default)
Disks [Custom][120GB]+[80GB] < expand, partitioning is auto set
Note: Actually, even if you choose separation, the installer makes a pool and adds both devices on default.

>[confirm] > [execute] [return to server list] > [power on]
>Power on ready? [yes]

Server list >kvm******** [click]
See console view
click and start [click]
Next view get from the icon right above
[Enter] to start to install

Installer view>
keyboard [Japanese] <select or [+]

language support [English(US)] < + English(UK) + Japanese <and so on something you need.
Selected install device Basic expanded to 120GB
It’s ok with the default settings.
If you know about Linux filesystem, I recommend to create customized partitions like this;

pool name = <..$pool_name..>e.g. poolpoo
filesystem = xfs
partations = / , /var , /tmp, /home (each size would be your choice within your VPS limitation)
/boot and /swap should be remained default.

Select the software base environment as Server, and choose something properly.
Enabling network connection
Security policy on, without profile
Time & Data, select Asia Tokyo.

> [Begin Installation]
root pass <..$root_password..> <..$your_password..>
create user <..$your_id..> to be administrator pass <..$your_password..> check ‘make this user administrator’
===wait for a while (about 15min)===
On my selection, it takes 1149 packages.

# if you see the ‘Reboot’ button at the right bottom of the window, it’s done!

# don’t forget to do this before pushing the reboot button; if you don’t, you may turn to pale.

reject customOS disk [click] then reboot [click]

When the progress bar appears and shows the login: prompt, the installation process is done.

# >Web console
# Caution: When you install the custom OS, you can’t use default ssh connect(via…)
# The console connects shows just tty instead of remote IP on direct view.

login: <..$your_username..>
su Password:<..$root_pass..>
# prompt changed


LAMP server quick, secure and abbreviated install manual 0

0 Introduction

Caution: I didn’t consider strict security in this document. You should know much more about the OS on your server to maintain proper securities for publications to the worldwide web. So I will firmly recommend this server to be constructed here shall be used for your study on how to make LAMP(Linux-Apache-MySQL-Perl, PHP, Python) webserver. If you want to get further knowledge, visit related links suggested below. That would be a good help for you. Oh, for my financial reasons, I use just OSSs all the time.
In past days, I made an instruction to build up a LAMP server in a legacy way. Now, The Docker application becomes very popular. It is advantageous and powerful. So at this time, I have decided to use Docker.
However, one thing, Docker manipulation needs basic knowledge for each application(OS, Shell, Firewall, Security, Webserver, Script languages, Antivirus, and so on). To learn this knowledge, you would understand the legacy way of install. So in this textbook, I mentioned the legacy ways first. Then go to Docker way.

Note: Placeholders are shown as < >. you must replace it with your data. […] means key input.

#You need these;

VPS(Virtual Private Server) under such a provider as ‘’ and others.) or Virtual Machine such as Hyper-V on Windows10
SSH Client Software TeraTermPro(jp)-ssh client for Windows WinSCP & PuTTY -SCP client and ssh client
Web Browser
Note: Mouse does not possibly work on Google Chrome. You need a Firefox browser. e.g., a path at Windows
shell “C:\Program Files (x86)\Mozilla Firefox\firefox.exe”

You have several ways to prepare your host machine and OS.

<PLAN A VPS> VPS(KVM) minimum plan
Virtual 3 core cpu and 2GB memory vda120GBHDD+vdb80GBHDD(default)

Caution: It’s better KVM than LXC, OpenVZ.

<PLAN B Virtual Machine>
ex. Lenovo Yoga 920 with Windows10 Pro Memory 16GB+SSD 500GB
Virtual Machine(Hyper-V)
BIOS set to Inter virtualization technology ON.
Virtual max 8core, memory 1GB, virtual Storage 127GB(Custom)

<PLAN C Docker Machine>
<PLAN D AWS, the other cloud services>

This manual takes the plan A, then C. Let’s go!


At Last…

My script ‘TickConverter’ has been published here.

The proof reader of ‘’ site was very kind, and supportive.

Thanks for your help.

I wish to make much more programs asking for better benefit.

from author.


MT4 70 TickChart Script Version


70tickchart with BollingerBand and Volume

I made a 70 tick chart of the script version. (see. our Indicator version 70tick20ema.mqh)
Since the original include file is partially modified, it is necessary to replace these files; “Files/FileBin.mqh, Files/File.mqh”.
‘BV’s 1pip unit display’ is made possible. Spread cancellation is also implemented.
In this script, Struct MqlRate including ‘spread’ is filled with 0, and ‘real_volume’ is used for recording ‘tick interval(seconds).
I recommend a 5-minute chart to attach as a source of this script. Since data interpolation is performed, the deviation from the actual chart becomes large when the time frame is longer than that.

1 Attach this script to an M5 or M1 online chart.
2 Open offline history file from the menu(file-offline chart- see ‘T’suffix file).
3 If the offline chart was not changed automatically, attach this script to the previous online chart again.
4 Attach any indicator you like to offline chart.

::: Recommended Indicators to be used with the offline chart:::
“Volume” indicator will be recommended so that helps you see the tick completion displayed in red turn to green at a glance.
To display 20 EMA, the indicator “Moving Average” or “Bollinger Bands” should be used.

:::In development:::
It seems that it is possible to substitute existing on the range indication etc. which had been created with the indicator version. An Independent indicator for supporting BobVolman’s method is under development.

ver1.02 Tick and Bars Speed displayable.
DOWNLOAD LINK Here TickConverter1.02

70tickchart 1pip (round up price)


A message to politicians who bring out nasty words in japan.

You cannot say the words which are not inside your brain.

That is not ‘mistake’ but ‘messy talk’.


How to use Metatrader4 on affordable VPS

For example, VPS(KVM) by


0  VPS contract and login
I made an MetaTrader4 platform on the virtual private server(VPS-KVM) provided by “”.
This server has such specs below;
-CPU: shared virtual Core2DuoT7700 2.4Ghz
-RENDERER: Gallium 0.4 on llvmpipe (LLVM 3.8, 128 bits)

You can jump to the “” web site, and make a contract of smallest size VPS(KVM) that has memory size 1GB.  Don’t select any bigger one.  You don’t need higher spec over 2GB memory for this aim, in this case, to install and run the MetaTrader4 and some related programs.
Then you can get “Login ID” and “Password” of your VPS, go to the login page “”, and start your control panel.
Click the VPS name field (for example “kvm00XXXXXX”).


1  Installation of Operating System and some others
Next, you have to install the Operating System, desktop manager, and WINE Windows(R) compatibility layer program.
I would recommend “lubuntu” the lighter version of “Ubuntu”.
The reasons are ;
– Lightweight action and less memory use
– Support the Ubuntu kernel and WINE package.
Well, Let’s start the installation processes.

1) First, you have to visit the “lubuntu” web site and download the latest “-.iso” image file. Do not download the Japanese localized version, since saving memory. In this case, you cannot use Japanese IME at your VPS.
2) Then, enter userID and password to open the control panel of your VPS,

2016-05-13 (7)
STEP1 Make SSH connect

3) The “-.iso” file previously downloaded must be inserted to the special “image” folder of the common server at ONAMAE.COM. You can use “WinSCP(SFTP software for Windows)“. If you are using the other Operating System, you can use your SFTP client suited your OS).
4) At your WinSCP, Select “New Site” > SFTP , and fill Hostname > User name > Password.

WinSCP login

And you have to hit the “Settings” button. You can find SSH > “Permission” at menu tree on the left, Select “Secret Key” from the file already downloaded. You will find a notification saying some cautions. You have to create and save a “private key” as .ppk format. After you saved that key, you should select again the saved key(-.ppk not -.key) and press the login button on the WinSCP.

key to PPK

5) After copying the iso image into the server, You have to go back to the server control panel. Click the server listing area “KVM/////”, press the “please select image” drop-box, scroll down , choose “[kvm///]lubuntu///]”, hit “insert” button, then click “restart” button.

Control panel load the iso data and prepare the install menu. Follow the instructions of the installer. Nothing will be bothering you during the installing process.
The installer shows a restart order on-screen. You have to remove force the iso image. After that, hit the “restart” button again.
If you complete the process, the lubuntu desktop will appear on-screen.  Resolution can be changed from menu > Preferences > Monitor Settings.
Are you ready?
So, Let’s go the next step.

2  OS initialization
Next, You would install WINE.
The site “” will help you well.
1) Login Control panel, and start server.
2) Start 32bit architecture
sudo dpkg –add-architecture i386
3) Add repository for wine
sudo add-apt-repository ppa:wine/wine-builds
4) Update for packages
sudo apt-get update
5) Install WINE developer version (latest 1.9)
sudo apt-get install –install-recommends winehq-devel

*Notice: Stable version 1.8 have some trouble with winhttp, so MetaTrader4 installer will lost network connectivity, and may cause of install failure(so-called “proxy problem”).
WINE installer help you when you need to install other necessary program. Please obey their suggestions.

6) Visit the MetaTrader4 download page (anywhere you like), download, and save the .exe file.
7) Start Filer, and open the metatrader.exe by Wine program loader. Install process will begin.

That’s all for installation. Try metatrader4 on your VPS.
If you have an original Expert Adviser or Indicator etc. already, it would be better to install SSH and FTP server on your VPS. Let’s try the final step.

3 Server settings for management
If you need to handle your VPS with remote, these applications below must be helpful to save your time.
1) OpenSSH
Sudo apt-get install openssh-serve
*It’s easy! However, it may cause a security problem, so you must install a firewall.
I recommend “WinSCP” as a client for Windows.

There is one difference between .iso loading process and after OS installed.
If you installed OS from your uploaded .iso file, you don’t have to hit the “Settings” button. You could find SSH > “Permission” at the menu tree on the left. However, You can connect by password, so you don’t need to download the “Secret Key”.

One caution is that password authentication includes security risks. So you must install Firewall on your server and close port, while you don’t handle remote file handling.

2) Vsftp
Sudo apt-get install vsftpd
*It also has a security risk, so you must install a firewall.
I recommend “TeraTerm” as a client for Windows.

3) Firewall GUI (*VERY IMPORTANT!)
sudo apt-get install gufw
* When you don’t need a remote filehandle, It would be better to set the firewall “on”.

That’s all from me.
If you need more information, please search for internet resources.


70tick20EMA indicator for MetaTrader4

70tick20ema & MyCPanel

The original program was developed by Mr.Rondo(

Remodeling contents by me are below:
Rounding price for the candle bar to be displayed in the 1pip unit
Adding horizontal lines to be displayed change at the time of the appearance of the DD sign
Adding horizontal lines to support range imaging
We are adding a control panel to change or reset the number of DD and Range settings.

1. Download 70tick20ema.mq4 and myCPanel.mqh.
2. Put the *.mq4 file to ‘Indicator’ directory, and Put the *.mqh file to ‘Include’ directory.
3. Compile mq4 file in MetaEditor.
4. Let’s try on your chart.

Please try in various usage.
When the display becomes strange, turn off the chart, and try to re-display.

Option notice:
‘Ignore spread true’ means to absorb the spreads variable. When it is false, the bar price is displayed as supplied price by your fx broker.

Please download here(ZIP file) >>

Thank you.

New Script version is here > TickConverter v1.02


MQL4 & Visual C++2013 DLL with string

I’ll show you here a useful ‘dll’ for MQL4 of MetaTrader4 for Windows.
You may need ‘VisualStudio2013 & C++’. Of course, also MT4.
At first, I introduce you to some helpful web sites below; Many thanks to these genius authors!!.

Basic References MSDN References for VisualC++ Mr. roberr C++ entrance

Modern Coding C++ Modern C++ Mr.Yamamoto(Cyboze co Ltd) ModernC++11,14 std namespace? what is that

Stream Stream general help Stream basic filestream basic file coding

Unicode specific Code general Unicode problem TCHAR coding TCHAR Coding for filehandle character code of filename references on windows file system version(Unicode,sjis Japanese)

MT4’mql+dll’ Mr.amenbo Helpful document with 4step development method Document about MQL4 and DLL export table

Test fo file handling and string transition

I chose the 4 step method suggested by Mr.amenbo(see link), and add a bit shortcut.
Step 1 is the same as the original idea, so let’s begin.
I wrote ‘test.cpp’ as my solution name, but you can change as you like, within coding regulations.
‘%…%’ means replace proper string.
Many impressive sites exist, but difficult for beginners. My comments in the .cpp code below might be helpful for your .dll coding for MQL4. Because I spend considerable hours to understand how to call dll from MQL4, if you like this message, please give me your expected expenses.
You may try this code at a debug mode. Push ‘local debugger,’ and you can see a console window and prompt on the window.
Here, step 1 must be complete, easy? Or difficult?
If you have a question, please comment on this message. I don’t receive any e-mail from an unknown person.
Finally some important notices, I cannot speak English, as you know?… and I’m a native Japanese living in Japan.

Step 1-1 Create full code on C++

// test.cpp : Test for Console application for MT4
#include "stdafx.h"	// you must add these header below in this headerfile
// #include "targetver.h"
// #include &amp;amp;lt;tchar.h&amp;amp;gt;
// #include &amp;amp;lt;locale&amp;amp;gt;
// #include &amp;amp;lt;string&amp;amp;gt;
// #include &amp;amp;lt;fstream&amp;amp;gt;
// #include &amp;amp;lt;iostream&amp;amp;gt;
// #include &amp;amp;lt;stdexcept&amp;amp;gt;
// #include &amp;amp;lt;limits&amp;amp;gt;
#if defined(_UNICODE) || defined(UNICODE)
#  define tcout std::wcout
#  define tcin std::wcin
#  define tcout std::cout
#  define tcin std::cin
typedef std::basic_string&amp;amp;lt;_TCHAR&amp;amp;gt; tstring;
typedef std::basic_ifstream&amp;amp;lt;_TCHAR&amp;amp;gt; tifstream; // file in stream
typedef std::basic_stringstream&amp;amp;lt;_TCHAR&amp;amp;gt; tstringstream; // string in stream
_TINT no;	//Just for debugging
_TCHAR* hello(_TCHAR *file_name);	//prototype statement
_TINT _tmain(_TINT argc, _TCHAR* argv[]){
    _tsetlocale(LC_ALL, _T("ja-JP"));	//locale is important, don't forget
    _TCHAR file_name[] = _T("% fullpath and filename here %");
    tcout &amp;amp;lt;&amp;amp;lt; hello(file_name);
    tcin &amp;amp;gt;&amp;amp;gt; no;	// test use only, just for prevent close console window
    return 0;
//+---------- function-------------------------------------------+
_TCHAR* hello(_TCHAR *file_name){
    // return and pass is both 'char pointer', it's important
    tstring s;	// string
    tstring ss;	// if you need formatted string, you can use 'tstringstream'
    FILE *fs;
    errno_t err;
    err= _tfopen_s(&amp;amp;amp;fs, file_name, _T("rt, ccs=UNICODE"));
        // open err
        if (err != 0){
	    return _T("fail not open that file");	//takecare, file exist?
	    // success open file
	    tifstream ifs(fs);	// make a filestream
	    while (ifs &amp;amp;gt;&amp;amp;gt; s){	// you don't need use 'getline' method
	 	ss += s;	// just for string case. if you want to use stream...
 		// ss &amp;amp;lt;&amp;amp;lt; s;	// like this.
	    tcout &amp;amp;lt;&amp;amp;lt; ss;	//just for this test, strip this line when you copy code.
	_TCHAR out[1000]; //no intention this number, not too short and not too much
		err = _tcscpy_s(out, 1000, ss.c_str());		//also above
		if (err == 0){
			static _TCHAR *outp = out;	//keep address for MQL4
			return outp;
		else return _T("copy fail");

Step1-2 Create MQL side code

This method is an alternate method for Mr.amenbo’s.
The interface of mql and dll is quite easy. If you put ‘string’ to dll, the mql send that as a pointer to that string to dll. Dll receives as it and then return pointer, and the mql takes that as a string with an arrow. So you don’t need to create a ‘call program’ as step3 in Mr.amenbo’s method.
And there is one tip, ‘Alert’ method in mql does not work well, that title is ok, but contents may fail to draw the proper character.
If you can correct that problem, please tell me how to do that.
Partially, I choose the ‘MessageBoxW’ with windows API, imported by WinUser32.mqh.

//|                                                         test.mq4 |
//|                               Copyright 2015, UHL Software Corp. |
//|                   |
#property copyright "Copyright 2015, UHL Software Corp."
#property link      ""
#property version   "1.00"
#property strict
#include &amp;amp;lt;stdlib.mqh&amp;amp;gt;
#include &amp;amp;lt;WinUser32.mqh&amp;amp;gt;
#import "test.dll"
	string hello(string);	//put filename type 'string' and get data as 'string' in facto pointer
#property script_show_inputs
//| Script program start function                                    |
input string InpFilter="*";
void OnStart(){
    string file_name;	//NTFS=unicode、FAT=sjis
    int    i=1;
    long search_handle=FileFindFirst(InpFilter,file_name);
		//PrintFormat("%d : %s name = %s",i,GetLastError()==5018 ? "Directory" : "File",file_name);	//just for debug
	//--- executional code ---
	string terminal_data_path=TerminalInfoString(TERMINAL_DATA_PATH);	//search install path
	file_name=terminal_data_path+"\\MQL4\\Files\\"+file_name;	//test pattern
	//--- close search handle
	//PrintFormat("fullpath in MQL4: %s",file_name);	//just for debug
	string ret=hello2(file_name);
	MessageBoxW(0,ret,ret,flg);		//I cannot get over the 'alert' problem, so I use a windowsAPI on user32.dll, see header file
	//Alert(ret);		//You may see a error with charcter code probrem
    else Print("Files not found");

Step2 Create dll code

Important note is just below;
1) #define MT4_EXPFUNC __declspec(dllexport)
2) __stdcall
That is it.

1) Copy the header and target function code from the full system create above.
//+———- function——————————————-+
_TCHAR* hello(_TCHAR *file_name){……

2) Change that title of the target function below.
MT4_EXPFUNC _TCHAR* __stdcall hello(_TCHAR *file_name){……

3 Set build mode to ‘Release’, and select menu project>property>, and set ‘Structure Property>c++>code create-runtime library’ to ‘multiple sleds(/MT)’.

4 Build it.

You don’t need to create a module definition (.def) file. (at least on VC++2013? I’m not sure in facto… Please tell me, genius wizard)

Step3 Test!!

Did you make it?
If you missed it, let’s work harder. Please leave a message to this article.