SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
1
【Linux】#1
アジェンダ
0900~0915 PCのセットアップと物理結線
0915~0930 vmwareでの設定
0930~0945 CentOSインストール準備
0945~1000 SElinux
1000~1015 Firewall
1015~1030 sshポート変更
仮想マシンの名前
connpassIDの先頭4文字+【study】+linux1 として下さい。
鈴木の場合、Fors【study】linux1になります。
ゴール
vmwareに仮想マシンを作成する
CentOSのインストールする
PC1
192.168.210.11
PC2
192.168.210.12
PC3
192.168.210.13
vmware
192.168.210.100
PC4
192.168.210.14
Port#1
Server1
192.168.210.111
Server1
192.168.210.112
Server1
192.168.210.113
Server1
192.168.210.114
PCのIPアドレスを変更して、物理サーバに接続して下さい。
2
手順1
「Windowsキー」+r
手順2
「powershell」と入力して、
「Shift」+「Ctrl」+「Enter」
「Alt」+「Y」→ はい
手順3 変更前IPアドレス確認
Get-NetIPAddress | where InterfaceAlias -eq "Ethernet" | select -ExpandProperty IPAddress
手順4 IPアドレス変更
Get-NetAdapter -Name "イーサネット" | New-NetIPAddress -AddressFamily IPv4 -IPAddress 192.168.210.11 -PrefixLength 24
#間違えたら
Remove-NetIPAddress -InterfaceAlias "イーサネット" -IPAddress 192.168.210.12
手順5 変更された事を確認
ブラウザからvmwareにアクセスします
3
手順6
「Windowsキー」+r → 「https://192.168.210.100」
手順7
詳細表示 → 192.168.210.100にアクセス
ユーザ名:
パスワード:
→ログイン
手順8
仮想マシンの作成/登録
4
仮想マシンを作成します
手順9 作成タイプの選択
新規仮想マシンの作成(デフォルト)
→ 次へ
手順10 名前とゲストOSの選択
名前:
connpassIDの先頭4文字+【study】+linux1
互換性:ESXi仮想マシン(デフォルト)
ゲストOSファミリ:Linux
ゲストOSのバージョン:CentOS 8(64ビット)
→次へ
手順11 ストレージの選択
datastore1
→次へ
5
仮想マシンを作成します(その2)
手順12 設定のカスタマイズ
CPU︓「1」→「4」
ハードディスク︓「シック」→「シン」
CDドライブ1︓
「ホストデバイス」→「データストアISO
ファイル」
データストアブラウザ
「SSD_03」→「.ios」→「Cent8-
2004」
設定の確認
「完了」
画⾯下部の「最近のタスク」で完了を確認
6
仮想マシンに電源を入れます
手順13
左ペインのナビゲータから「仮想マシン」
→作成した仮想マシンを選択
→「パワーオン」
→画⾯下部のディスプレイを部分をク
リック
インストールメディアを挿入
し、仮想マシンを起動すると
次の画面が表示されます。
「Install CentOS Linux 8」を
選択し、Enterキーを押してく
ださい。
7
最初に言語を選択します。
日本語を選択し、「続行(C)」
を押してください。
ここに入力して検索します
→「ja」と入力
8
インストール概要画面でイン
ストールの基本的な設定を行
います。
仮想マシンの設定で右側が見
切れていますが気にしないで
ください。
まずは「!」アイコンが付いた
項目を設定します。
「インストール先」の項目を
クリックしてください。
9
インストール先のディスクを
指定します。
ここではディスクをディレク
トリごとに分割したりできま
すが、今回はディスク全体を
Linux全体の領域として使用す
ることとします。
何も変更せずに「完了(D)」を
押してください。
10
この状態で「!」アイコンの項
目がなくなったためインスト
ールを開始できますが、追加
の設定として以下の設定を行
っていきます。
・時刻と日付
・ソフトウェアの選択
・ネットワーク設定
まずは「時刻と日付(T)」をク
リックしてください。
11
アジア/東京を選択するため、
地図から東京近辺をクリック
して、地域・都市がアジア/東
京となったことを確認し、
「完了(D)」を押してください。
NTPを使用して時刻を正確に
することもできますが今回は
省略します。
インストールの概要画面に戻
ったら「ソフトウェアの選択
(S)」をクリックしてください。
12
ソフトウェアの選択では、
Linuxをどのような構成でイン
ストールするかを選択します。
今回はインストール時は最小
限としてインストールし、イ
ンストール後に使用するソフ
トウェアを追加していくよう
にします。
「最小限のインストール」を
選択し、「完了(D)」を押して
ください。
インストールの概要画面に戻
ったら「ネットワークとホス
ト名」をクリックしてくださ
い。
13
ネットワークとホスト名では
仮想マシンに割り当てるホス
ト名、IPアドレスを設定しま
す。
ホスト名を変更後、「適用
(A)」を押してください。
次にネットワークの「オフ」
を「オン」にし、「設定(C)」
を押してください。
ホスト名:connpassアカウン
トの頭4文字
14
編集画面が開かれたら、
「IPv4設定」タブをクリック
してください。
デフォルトでは自動(DHCP)の
設定となっていますが、今回
は静的アドレスを割り当てま
す。
メソッドを「手動」に変更し、
「追加(A)」を押してください。
その後、アドレスを以下の通
り設定してください。
アドレス 192.168.210.xxx
ネットマスク 24
ゲートウェイ 192.168.210.1
DNSサーバー 192.168.210.1
設定完了したら「保存(S)」を
押してください。
15
ネットワークとホスト名の画
面は「完了」を押してインス
トール概要の画面に戻ります。
インストール設定はこれで完
了です。
「インストールの開始」を押
してください。
2分45秒程度で完了します。
16
インストールが開始されます。
インストール中にrootパスワー
ドの設定と一般ユーザーの作
成を行います。
「rootパスワード(R)」を押し
てください。
17
rootパスワードを設定し、「完
了(D)」を押してください。
脆弱なパスワードを設定した
場合は「完了(D)」を2回押す
必要があります。
インストール中画面に戻った
ら「ユーザーの作成(U)」を押
してください。
18
root以外に通常使用するユーザ
ーを作成します。
各項目を設定し、「完了(D)」
を押してください。
ここでは「このユーザーを管
理者にする」はオンに設定し
ます。
19
「完了しました!」と表示さ
れればインストール完了です。
インストールメディアを取り
出し、「再起動」を押してく
ださい。
20
インストール完了後、OSが起動したらまずは最低限のセキュリティ設定を実施します。
ここから先はすべてTeratermを使用してSSHログインして作業を行います。
TeratermでIPアドレス/プロトコルを指定し、インストール時に作成したユーザーでログイン後、「su - 」
コマンドでrootユーザーとしてログインしてください。
■SELinuxの設定
SELinuxはデフォルトでは有効となっていますが、有効状態のまま運用する場合は各ソフトウェアのインス
トール・設定を行うたびにポリシーの設定を行う必要があります。
また、攻撃からの防御としては次の2点のほうが重要であるため、今回はSELinuxは無効化します。
■ファイアウォールの設定
外部からの通信を事前に設定されたもののみを許可するため、ファイアウォールの設定を行います。
■SSHサーバーの設定
デフォルトで有効となっているSSHサーバーは管理のために使用しますが、攻撃対象ともなりやすいサー
ビスです。まずはこのサービスを攻撃されにくくします。
インストール完了
21
22
手順14
TeraTermを起動します
ホストに「」作成したIPアドレスを⼊⼒し
ます。
「続⾏」します。
Teratermで接続します
# getenforce
Enforcing
# setenforce 0
# getenforce
Permissive
# cat /etc/sysconfig/selinux
# vi /etc/sysconfig/selinux
# cat /etc/sysconfig/selinux
SELinuxの設定
setenforceで設定する内容はOS再起動では保持されないため、
設定ファイルを修正する。
SELINUX=enforcing
↓
SELINUX=disabled
コマンド概要
getenforce SELinuxの状態確認
setenforce SELinuxの設定変更
cat ファイルの内容表示
vi ファイルの編集 (viの操作方法説明は省略します) 23
$su –
パスワード:
#
Enforcing 有効
Permissive ポリシー違反等のログは出力するが、操作は許可
Disabled無効
rootに昇格して下さい
# firewall-cmd --list-all
services: cockpit dhcpv6-client ssh
ports:
# firewall-cmd --add-port=54321/tcp
# firewall-cmd --remove-service=cockpit
# firewall-cmd --remove-service=dhcpv6-client
# firewall-cmd --remove-service=ssh
# firewall-cmd --list-all
services:
ports: 54321/tcp
# firewall-cmd --list-all -–permanent
# firewall-cmd --runtime-to-permanent
# firewall-cmd --list-all --permanent
ファイアウォールの設定
コマンド概要
firewall-cmd firewalldの各種設定・設定確認を行うコマンド
デフォルトではssh(22/tcp)のほか、使用しないサー
ビスが許可されています。
後の手順でSSHサービスのポート変更を行うため、
変更後のポートを許可します
使用しないサービスはすべて削除します
上で設定した内容はOS再起動により失われます。
permanentが再起動時に読み込まれる内容となり
ますので、上で設定した内容(runtime)を
permanentにコピーします。
24
# cat /etc/ssh/sshd_config
# vi /etc/ssh/sshd_config
Port 54321
PermitRootLogin no
# cat /etc/ssh/sshd_config
# systemctl restart sshd
# ss –lntp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:54321 0.0.0.0:* users:(("sshd",pid=811,fd=5))
LISTEN 0 128 [::]:54321 [::]:* users:(("sshd",pid=811,fd=7))
SSHサーバーの設定
コマンド概要
systemctl Linuxのサービスを制御するためのコマンド
ss ソケット情報の表示をするためのコマンド
設定( /etc/ssh/sshd_config )ファイルの初期値は、#でコメントされていますので、コメント解除して下
さい。
SSHポートの変更を行います。
Port {ポート番号} を設定してください。
SSHで直接rootでのログインを拒否します。
「PermitRootLogin no」を設定してください。
設定の反映のため、sshdの再起動を行います。
Sshdの待ち受けポートが22ではなく変更したポート
となっていることを確認してください。
25
時間が余ったら1
teratermの自動ログ取得設定をして下さい。作成するログに日付情報を付加して下さい。
時間が余ったら2
rootのパスワードリセットする
時間が余ったら3
ホスト名をCLIで設定変更する
時間が余ったら4
IPアドレスをCLIで設定変更する
26
時間が余ったら

Weitere ähnliche Inhalte

Empfohlen

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationErica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellSaba Software
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming LanguageSimplilearn
 

Empfohlen (20)

How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 
Introduction to C Programming Language
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
 

Linux#1