Categories
LINUX

LAMP server q.s.a. install manual 2

1.2 Learn shell and documents handling

1.2.1 Shell


https://qiita.com/zayarwinttun/items/0dae4cb66d8f4bd2a337 Basics for Shell script beginners
https://jehupc.exblog.jp/15729095/ the differences between connector character(; & && ||)

#shell list bulid my own. upload in time.

ab.sh #afterboot    <linked
ss.sh #sshdsafe
bw.sh #basicwebserver
aw.sh #advancewebserver

#shell scripts

bash < +.sh na

#shebang

!/bin/bash

#loop

for f in ./*
    do
    echo $f
done

#citation

$# 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


http://www.vim.org/ Vim
http://hp.vector.co.jp/authors/VA016670/unix/vi_reference.html vi commands(jp)
http://sci.notbc.org/~weiss/resources/vim/Vim-course/others/vim-1.0.pdf Vim Tutorial and Reference PDF

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

#note

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,?

e.g.
#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###
cd
vi .vimrc
#---.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
#----------------end

1.2.3 Sed


https://www.gnu.org/software/sed/manual/sed.html
https://sed.open-code.club/
https://qiita.com/hirohiro77/items/7fe2f68781c41777e507 how to use ‘sed’

#tips

Stream editor is Sed.

#e.g.

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 \
<..str..>\
'

#add lines in the middle of lines

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

#add line end of file

sed -e '$a \
<..str..>\
'

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


https://murashun.jp/blog/20190215-01.html

It must be so helpful for you.

Learn hard!

need escape\

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

1.3 Disk handling

#mount-unmount
#device detection

dmesg

#well known point

/mnt
/media

#partationing

fdisk just for MBR(old type
gdisk GPT
parted

#format

mkfs -t xfs /dev/vdb

Categories
LINUX

LAMP server q.s.a. install manual 1

1 OS install (CentOS ver8.1)


https://www.centos.org/download/ CentOS download latest current 8.1
https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/8/ RHEL8 note
https://www.rem-system.com/centos-linux8-install/ Great instruction in japanese
http://www.jpcert.or.jp/index.html JPCERTCC(jp)
http://jvn.jp/ Japan Vulnerability Notes(jp)
http://semver.org v2.0.0.html Semantic Versioning
https://www.gnu.org/software/grub/manual/html_node/index.html#SEC_Contents GNU GRUB Manual 2.00
https://thinkit.co.jp/story/2014/11/28/5408 CPG(jp)
http://itpro.nikkeibp.co.jp/article/COLUMN/20060224/230573/ IT Pro Linux commands INDEX(jp)
https://eng-entrance.com/linux-package-rpm-yum-def RPM and YUM
https://www.atmarkit.co.jp/ait/articles/2001/31/news006.html 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


https://cp.myvps.jp/ VPS link(userID and password is required) (jp)

Upload the iso image to VPS provider’s storage, follow the instruction http://guide.onamae-server.com/vpskvm/3_14_15_74_2/

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.
KDUMP on
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 console1001.myvps.jp…)
# The console connects shows just tty instead of remote IP on direct view.

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

Categories
LINUX

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 < ..data.. >. you must replace it with your data. […] means key input.

#You need these;

VPS(Virtual Private Server) under such a provider as ‘Onamae.com’ and others.) or Virtual Machine such as Hyper-V on Windows10
SSH Client Software
https://ja.osdn.net/projects/ttssh2/ TeraTermPro(jp)-ssh client for Windows
https://winscp.net/ 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” https://cp.myvps.jp/Home.aspx

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

<PLAN A VPS>
Onamae.com 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!