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!