meltykissyuh
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # サーバー構築手順書 チーム名:ミレニアムズ メンバー:小林、中村、野口 ## もくじ 0. 環境構築に関しての注意 1. Linuxの導入手順 1-1. サーバ側   1-1-1. VirtualBox   1-1-2. AlmaLinux 1-2. クライアント側 1-3. サーバとクライアントの接続 2. Webサーバの構築手順 2-1. サーバ側 2-2. クライアント側 3. DNSサーバの構築手順 3-1. サーバ側 3-2. クライアント側 4. プロキシーサーバーの構築手順 4-1. サーバ側 5. OpenSSHでのキーペアの作成 5-1. サーバ側 5-2. クライアント側 ## 0.環境構築に関しての注意 #### エラーが発生しても慌てず一文字ずつ確認をお願いいたします。 #### スペルミスや文法ミスは頻出事項です。慌てず冷静な対処をお願いします。 ## 1. Linuxの導入手順 ### 1-1. サーバ側 #### 1-1-1. VirtualBox 1. テキスト「Linuxベーシック2_付録3_VirtualBoxの使用方法.pdf」p1~6参照 - テキストは[**こちら**](https://drive.google.com/file/d/1cjsH3Si8OtglAyn4T9meppEEkdoEOWKc/view) - Oracle VM VirtualBoxのダウンロードは[**こちら**](https://www.oracle.com/jp/virtualization/technologies/vm/downloads/virtualbox-downloads.html) - (注) VirtualBoxのバージョンは時期によって異なる #### 1-1-2. AlmaLinux 1. テキスト「Linuxベーシック2_付録3_VirtualBoxの使用方法.pdf」p7~8参照 - テキストは[**こちら**](https://drive.google.com/file/d/1cjsH3Si8OtglAyn4T9meppEEkdoEOWKc/view) - AlmaLinuxのダウンロードは[**こちら**](https://almalinux.org/ja/get-almalinux/) - (注) AlmaLinuxのバージョンは時期によって異なる 2. テキスト「Linuxベーシック2.pdf」 p41~53参照 - テキストは[**こちら**](https://drive.google.com/file/d/1oELAQIOdvJkvt0hjnCEZ63HH4EhOQiAr/view) - (注1) p47: ホスト名(H)は、「h111.r-exercise.com」とする - (注2) p47: IPv4設定はメソッドを「自動」にする - (注3) p49: ユーザー名(U)は、以降の分かりやすさを考慮して「server」とする - (注4) p51: 「アカウントが見つかりませんか?」からユーザー名を「root」にし、rootでログインしておく ### 1-2. クライアント側 1. 1-1-2の手順2を実行し、新たにAlmaLinux環境を作成 - テキストは[**こちら**](https://drive.google.com/file/d/1oELAQIOdvJkvt0hjnCEZ63HH4EhOQiAr/view) - (注1) p47: ホスト名(H)は、「h222.r-exercise.com」とする - (注2) p47: IPv4設定はメソッドを「自動」にする - (注3) p49: ユーザー名(U)は、以降の分かりやすさを考慮して「client」とする - (注4) p51: 「アカウントが見つかりませんか?」からユーザー名を「root」にし、rootでログインしておく ### 1-3. サーバとクライアントの接続 1. Windowsのコマンドプロンプトから、IPv4アドレスとデフォルトゲートウェイを取得する ``` C:\Windows\System32>ipconfig /all ``` 2. サーバ側とクライアント側双方で、「端末」を起動する - 左上の「アクティビティ」→ 「端末」 3. サーバ側とクライアント側双方で、Network Managerを起動する ``` [root@h111 ~]# nmtui ``` ``` [root@h222 ~]# nmtui ``` 4. サーバ側で「接続の編集」→「<編集>...」より、IPv4設定を以下のように編集する - <自動> → <手作業> - アドレス: [IPv4アドレス第3オクテットまで].111/24 - (例) 192.168.30.111/24 - ゲートウェイ: [デフォルトゲートウェイ] - (例) 192.168.30.1 - DNSサーバー: [IPv4アドレス第3オクテットまで].111、8.8.8.8 - (例) 192.168.30.111, 8.8.8.8 5. 「OK」→「戻る」→「接続をアクティベートする」 6. 「<解除>」→「<アクティベート>」 - <解除>に戻っていたらOK 7. クライアント側で「接続の編集」→「<編集>...」より、IPv4設定を以下のように編集する - <自動> → <手作業> - アドレス: [IPv4アドレス第3オクテットまで].222/24 - (例) 192.168.30.222/24 - ゲートウェイ: [デフォルトゲートウェイ] - (例) 192.168.30.1 - DNSサーバー: [IPv4アドレス第3オクテットまで].111、8.8.8.8 - (例) 192.168.30.111, 8.8.8.8 8. クライアント側で、手順4,5,6を行う 9. サーバ側とクライアント側双方で、IPアドレスを取得し、反映されているか確認する ``` [root@h111 ~]# ip a ``` ``` [root@h222 ~]# ip a ``` 10. サーバ側とクライアント側双方で、通信が行われるか確認する - 応答があればOK ``` [root@h111 ~]# ping [IPv4アドレス第3オクテットまで].222 ``` ``` [root@h222 ~]# ping [IPv4アドレス第3オクテットまで].111 ``` なお、以降はIPアドレスを以下と**仮定**して記載している - サーバ側: **192.168.30.111** - クライアント側: **192.168.30.222** ## 2. Webサーバの構築手順 ### 2-1. サーバ側 1. サーバ側でapacheのインストール ``` [root@h111 ~]# dnf -y install httpd ``` 2. systemctl コマンドにてサーバに適応、自動起動に設定 ``` [root@h111 ~]# systemctl status httpd ``` ``` Apacheが起動していないことを確認(disable,dead) ``` ``` [root@h111 ~]# systemctl start httpd ``` ``` [root@h111 ~]# systemctl enable httpd ``` 3. サーバ側がFirefoxにてwebページが参照できるかを確認(IPアドレス、ホスト名とドメイン名で検証) ``` http://192.168.30.111 ``` ``` http://h111.r-exercise.com ``` 4. webページ”millenniums.html”を/var/www/html/下にtest pageとして作成(内容グループ名およびメンバーを記載) ``` [root@h111 ~]# vi /var/www/html/○○.html ``` ↓ 〇〇.htmlの記述例 ```= <!doctype html> <html> <head> <title>top page</title> <body> <h1>。。。</h1> <h2>・・・</h2> ・ ・ ・ </body> </html> ``` 5. Apacheの設定ファイル/etc/httpd/conf/httpd.confをバックアップを取ったうえで編集 ``` [root@h111 ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.bk.conf ``` ``` [root@h111 ~]# vi /etc/httpd/conf/httpd.conf ``` 6. DirectoryIndexをindex.htmlをmillenniums.htmlに変更し"apachectl -t"で文法確認、syntax okとなればappacheを再起動、エラーが出れば文法の見直し ![スクリーンショット 2024-05-20 113645](https://hackmd.io/_uploads/HJqIdNum0.png) ``` [root@h111 ~]# apachectl -t ``` ``` [root@h111 ~]# systemctl restart httpd ``` 7. 念のためhtmlファイルのバックアップを作成 ``` [root@h111 ~]# cp /var/www/html/○○.html /var/www/html/○○.bk.html ``` 8. Webサーバ及びクライアントと通信できるかを確認 - 応答があればOK ``` [root@h111 ~]# ping 192.168.30.111 ``` ``` [root@h111 ~]# ping 192.168.30.222 ``` 9. Firefoxブラウザを開き、Webサイトが出力されるかを確認 ``` http://192.168.30.111 ``` ### 2-2. クライアント側 1. Firefoxブラウザを開き、Webサイトが出力されるか確認 ``` http://192.168.30.111 ``` ## 3. DNSサーバの構築手順 ### 3-1. サーバ側 1. 「dnf -y install bind」をサーバ側で実行しBindのインストール ``` [root@h111 ~]# dnf -y install bind ``` 2. systemctl コマンドにてサーバに適応、自動起動に設定 ``` [root@h111 ~]# systemctl start named ``` ``` [root@h111 ~]# systemctl enable named ``` ``` [root@h111 ~]# systemctl status named ``` 3. /etc/named.confのバックアップを取ったうえで編集、listen portに自IPアドレスを追記し、allow-queryをanyに、dnssec-validationをnoに変更 ``` [root@h111 ~]# cp /etc/named.conf /etc/named.bk.conf ``` ``` [root@h111 ~]# vi /etc/named.conf ``` ![ああああ](https://hackmd.io/_uploads/ByHE54dQ0.png) 4. named-checkconfにより/etc/named.confの文法ミスを確認、namedを再起動 ``` [root@h111 ~]# named-checkconf /etc/named.conf ``` ``` [root@h111 ~]# systemctl restart httpd ``` 5. 再度named.confを開きゾーン情報の定義 ``` [root@h111 ~]# vi /etc/named.conf ``` ↓ named.confの最後の行に以下を追加 ``` zone "r-exercise.com" IN { type master; file "named.r-exercise.com"; }; ``` 6. /var/named/にゾーンファイルnamed.r-exercise.comを作成 ``` [root@h111 ~]# vi /var/named/named.r-exercise.com ``` ↓ named.exercise.comの中身 ```= $TTL 1D $ORIGIN r-exercise.com. @ IN SOA ns root ( 2024052001 ; Serial 8H ; Refresh 4H ; Retry 1W ; Expire 1D ) ; Negative IN NS ns IN MX 10 mail ns IN A 192.168.30.111 mail IN A 192.168.30.111 h111 IN A 192.168.30.111 h222 IN A 192.168.30.222 www IN CNAME h111 ``` 7. ゾーンファイルの文法を確認 ``` [root@h111 ~]# named-checkzone r-exercise.com /var/named/named.r-exercise.com ``` 8. namedを再起動 ``` [root@h111 ~]# systemctl restart named ``` 9. ゾーンファイルが機能しているかを確認 - 応答があればOK Webサーバー側 ``` [root@h111 ~]# ping h111.r-exercise.com ``` DNSサーバー側 ``` [root@h111 ~]# ping www.r-exercise.com ``` 10. Firefoxブラウザを開き、Webサイトが出力されるか確認 ``` http://192.168.30.111 ``` ``` http://h111.r-exercise.com ``` ``` http://www.r-exercise.com ``` ### 3-2. クライアント側 1. サーバ側で記述したゾーンファイルが機能しているかを確認 - 応答があればOK ``` [root@h222 ~]# ping h111.r-exercise.com ``` ``` [root@h222 ~]# ping www.r-exercise.com ``` 2. 名前解決がうまくいっているかをFirefox上で確認 ``` http://192.168.30.111 ``` ``` http://h111.r-exercise.com ``` ``` http://www.r-exercise.com ``` ## 4. プロキシーサーバーの構築手順 1. Firewallを起動し、自動起動するように設定 ``` [root@h111 ~]# systemctl enable firewalld ``` ``` [root@h111 ~]# systemctl start firewalld ``` 2. Firewallが現在許可しているサービスを表示 ``` [root@h111 ~]# firewall-cmd --list-all ``` 3. クライアント側でFirefoxブラウザを開き、Webサイトが出力されるか確認 - アクセスできなければ、Firewallが機能している - 履歴はあらかじめ削除しておく ``` http://192.168.30.111 ``` ``` http://www.r-exercise.com ``` 4. httpサービスを許可する ``` [root@h111 ~]# firewall-cmd --add-service=http ``` 5. クライアント側でFirefoxブラウザを開き、Webサイトが出力されるか確認 - アクセスできれば、Firewallのサービス許可が反映されている ``` http://192.168.30.111 ``` 6. dnsサービスを許可する ``` [root@h111 ~]# firewall-cmd --add-service=dns ``` 7. クライアント側でFirefoxブラウザを開き、Webサイトが出力されるか確認 - アクセスできれば、Firewallのサービス許可が反映されている ``` http://www.r-exercise.com ``` 8. 変更内容を永続保存する ``` [root@h111 ~]# firewall-cmd --runtime-to-permanent ``` ## 5. OpenSSHでのキーペアの作成 ### 5-1. サーバ側 ``` [server@h111 ~]# mkdir ~/.ssh ``` ### 5-2. クライアント側 1. ``` [client@h222 ~]$ ssh-keygen ``` 2. ``` [client@h222 ~]$ scp ~/.ssh/id_rsa.pub server@192.168.30.111:~/.ssh/authorized_keys ``` 3. ``` [client@h222 ~]$ ls -l ssh ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully