Thuta Learning
ရှာဖွေရန်
ProjectsDevOps & Toolsbeginner

Mini Project: ပထမဆုံး Linux Server Setup

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Mini Project: ပထမဆုံး Linux Server Setup ကို ကြောက်စရာမလိုအောင် နားလည်မယ်
  • Terminal ထဲမှာ ကိုယ်တိုင် command ကို စမ်းသုံးတတ်အောင် လုပ်မယ်
  • Real server/project မှာ ဒီ command ဘယ်လို အသုံးဝင်သလဲ ချိတ်မြင်မယ်

ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်

Real-world server setup ဆိုတာ command တစ်ခုတည်း run လိုက်တာနဲ့ ပြီးတာ မဟုတ်ပါဘူး — chapter တစ်ခုချင်းစီက concept တွေကို order တကျ ပေါင်းစပ်ရတဲ့ workflow ပါ။ ဒီ project ရဲ့ checklist က: (1) SSH key ဖန်တီးပြီး server ဆီ ချိတ်ဆက် (2) sudo apt update && upgrade ဖြင့် software အသစ်ဆုံးဖြစ်အောင်လုပ် (3) ordinary user account ဖန်တီးပြီး sudo privilege ပေး (root ကို disable) (4) ufw firewall ကို SSH port အရင်ဖွင့်ပြီးမှ enable (5) install လိုအပ်တဲ့ package (nginx စသည်) (6) systemctl ဖြင့် service enable+start (7) cron job တစ်ခု backup အတွက် schedule ချ (8) log ကို journalctl ဖြင့် စစ်ဆေးပြီး အားလုံး active ဖြစ်ကြောင်း confirm။ ဒီ sequence က real DevOps engineer တွေ လက်တွေ့ လုပ်နေတဲ့ pattern အတိုင်းပါ။

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

ဒီ project ကို ကိုယ်ပိုင် VM/WSL ပေါ်မှာ risk-free စမ်းလို့ရပါတယ် — cloud server အစစ် မလိုသေးပါဘူး။ Command တစ်ကြောင်းချင်းစီကို run ပြီးတိုင်း status command (systemctl status, ufw status, journalctl) ဖြင့် အောင်မြင်မှုကို confirm လုပ်ရင် troubleshooting time များစွာ သက်သာစေပါတယ်။ ဒီ checklist ကို script file (shell scripting အခန်းများကနေ သင်ခဲ့တဲ့ pattern) အဖြစ် ပြောင်းရေးထားရင် နောက်တစ်ခေါက် server အသစ် setup လုပ်ချင်တိုင်း command ၂၀ ကြောင်းကို ပြန်ရိုက်စရာမလိုတော့ဘဲ script တစ်ခုတည်း run ရုံပါ — ဒါက automation ရဲ့ အစပါ။

အတူတူ terminal ထဲ စမ်းမယ်

bash
# Mini project checklist (VM/WSL ပေါ်မှာ practice)
ssh-keygen -t ed25519
sudo apt update && sudo apt upgrade -y
sudo adduser deploy && sudo usermod -aG sudo deploy
sudo ufw allow OpenSSH && sudo ufw enable
sudo apt install -y nginx
sudo systemctl enable nginx && sudo systemctl start nginx
crontab -e   # backup rule ထည့်
journalctl -u nginx -n 20
You should see
journalctl -u nginx -n 20 ကို run ရင် nginx service start ဖြစ်ကြောင်း log line ကို confirm ဖတ်ရမည်, ufw status ကို run ရင် OpenSSH port active ဖြစ်နေမည်။

၅ မိနစ် စမ်းကြည့်

ဒီ checklist ရဲ့ command ၈ ကြောင်းကို ကိုယ့် VM/WSL ပေါ်မှာ တစ်ကြောင်းချင်း run ကြည့်ပါ (root/production server ပေါ်မှာ မလုပ်ပါနှင့်)။ Command တစ်ခုချင်းစီပြီးရင် status command ဖြင့် confirm လုပ်ပါ။

သတိလေးတစ်ချက်

ဒီ project ရဲ့ command တွေထဲမှာ sudo, ufw, systemctl ပါဝင်နေတာမို့ production/live server ပေါ်မှာ မစမ်းခင် VM သို့မဟုတ် disposable cloud server (snapshot ယူထားတာ) ပေါ်မှာသာ စမ်းသပ်ပါ။

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Step order ကို ကျော်ပြီး firewall ကို SSH ဖွင့်ခင် enable လုပ်ခြင်း (locked out risk ကို ပြန်သတိရပါ)
  • Checklist တစ်ခုလုံးကို production server အစစ်ပေါ်မှာ ပထမဆုံးအကြိမ် စမ်းခြင်း — VM/WSL ပေါ်မှာ အရင် practice လုပ်ပါ

အခု ကိုယ်တိုင် စမ်းကြည့်

ဒီ checklist ရဲ့ command ၈ ကြောင်းကို ကိုယ့် VM/WSL ပေါ်မှာ တစ်ကြောင်းချင်း run ကြည့်ပါ (root/production server ပေါ်မှာ မလုပ်ပါနှင့်)။ Command တစ်ခုချင်းစီပြီးရင် status command ဖြင့် confirm လုပ်ပါ။

You'll know it worked when: journalctl -u nginx -n 20 ကို run ရင် nginx service start ဖြစ်ကြောင်း log line ကို confirm ဖတ်ရမည်, ufw status ကို run ရင် OpenSSH port active ဖြစ်နေမည်။

Mini Project: ပထမဆုံး Linux Server Setup | Thuta Learning