17 October 2016

How To Convert a Physical Linux Server to Virtual Machine with VMware vCenter Converter Standalone (P2V)


        พอดีมีโอกาส ต้องทำการ ย้าย Physical Linux Server ที่ตัวเองทำไว้เมื่อประมาณ 2 ปีแล้ว ยังไม่ตาย แต่ Hardware หมด MA แล้ว ไปไว้ที่ ESXi Server (Hypervisor) ซึ่งต้องเป็น Virtual Machine นะครับ

หมายเหตุ: ผมลองกับ Production จริงๆ แล้วครับ 

Physical Server เป็น CentOS 6.6 64bit
ส่วน ESXi เป็น 5.5 นะ

เนื่องจาก ตัวที่จะย้ายไปเป็น VMware ESXi สบายหน่อยมี Tools ให้ใช้อยู่แว้ว Free ด้วย ไป Download ตาม Link นะ (ต้องใช้ Account นะครับ)
Download VMware vCenter Converter Standalone for P2V Conversion

จากนั้นก็ทำการติดตั้ง VMware vCenter Converter Standalone ลงบนเครื่อง Notebook หรือ PC เราครับ

1.  เปิดโปรแกรม VMware vCenter Converter Standalone ขึ้นมาแล้ว เลือก Convert machine



How To Rate Limit Download Speed and Throttling for Apache HTTP with mod_ratelimit


ประเด็นคือผมอยาก Limit Speed ของการ Download ไฟล์บน Apache HTTP โดยใช้ Mod RateLimit

ข้อมูลเพิ่มเติม
http://httpd.apache.org/docs/trunk/mod/mod_ratelimit.html

1. ทำการ Enable mod ratelimit บน Apache (HTTP)
a2enmod ratelimit
2. ทำการ Configuration ระบุในส่วนของ URL ที่ต้องการ Limit Speed Download
vi /etc/apache2/conf-available/ratelimit.conf


3. ทำการ Enable Configure
a2enconf ratelimit
4. ทำการ Restart Apache
service apache2 restart

5. ทดสอบ Download file ขนาด 1.3GB ทั้ง Limite 500Kbps และ Unlimite ในการ Download Speed จาก Browser



เรียบร้อยแล้วครับ


How To Configure Username and Password Authentication with Apache HTTP


เนื่องจากผมต้องการ Share file บน HTTP Server (Apache2) โดยอยากให้มี User และ password

1. ทำการ update repo และติดตั้ง apache2 , apache2-utils เพิ่มเติม
root@linux:~#sudo apt-get update
root@linux:~#sudo apt-get install apache2 apache2-utils -y

2. ทำการสร้าง Account สำหรับเข้าใช้งาน
root@linux:~# htpasswd -c /etc/apache2/.htpasswd user-share
New password:
Re-type new password:
Adding password for user user-share
root@linux:~#

3. ทำการ Configure Site บน Apache2 สำหรับการเข้าใช้งาน
root@linux:~# vi /etc/apache2/sites-enabled/000-default.conf



4. ทำการ Restart Apache2
root@linux:~#/etc/init.d/apache2 restart
 * Restarting web server apache2                                                                                                         [ OK ]
root@linux:~#

5. จากนั้นลองเรียก URL path ที่ทำการ Configure ข้างต้นและใส่ user และ password ที่ได้ตั้งไว้ครับ





เสร็จเรียบร้อยครับ


URL Refer:
https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-apache-on-ubuntu-14-04

16 September 2016

Run command 'docker-compose up -d' see ERROR: In file './docker-compose.yml' service 'version'


Run Command:
# docker-compose up -d

ERROR Message :
ERROR: In file './docker-compose.yml' service 'version' doesn't have any configuration options. All top level keys in your docker-compose.yml must map to a dictionary of configuration options.
Check list:
# docker-compose --version
docker-compose version 1.5.2, build unknown
Fixed Issue:
# curl -L https://github.com/docker/compose/releases/download/1.8.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
and Run docker-compose again.

URL Refer:

https://github.com/docker/compose/issues/2863

https://github.com/docker/compose/releases

24 August 2016

How to Learn KVM-QEMU QCOW2 QEMU-IMG and Snapshots Tools


         ถ้ากล่าวถึงเรื่อง Virtualization หรือ Cloud คนมักจะนึกถึง Virtual Machine (VM) โดยพวก VM เหล่านี้ทุกสิ่งที่อย่างจะเป็น ของปลอมหรือของจำลองทั้งหมด
       
         QCOW2 virtual disk format เป็นตัวที่น่าสนใจเป็นอย่างมากๆ Advanced feature จะใช้ผ่าน QEMU image tools พวกการสร้าง virtual disk หรือการสร้าง Snapshots บน Image (virtual disk) เป็นต้น


เบื้องต้นเริ่มลองใช้คำสั่งกันเลย

1. คำสั่ง Dump information เกี่ยวกับ image file.

Command Format:
qemu-img info {image-name}

image-name คือ ชื่อของ virtual-disk
Example Command:
root@ubuntu#qemu-img info hda.qcow2
image: hda.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 2.3G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false
root@ubuntu# du -sh *
2.4G    hda.qcow2
root@ubuntu#

2. คำสั่งสร้างไฟล์ QCOW2 image

Command Format:
qemu-img create -f qcow2 {image-name}  {max-storage}

image-name คือ ชื่อของ virtual-disk ที่จะสร้าง
max-storage คือ ขนาดที่ใหญ่ที่สุดที่สร้างใช้งานได้ของ virtual-disk ที่จะสร้างมา