Showing posts with label debian. Show all posts
Showing posts with label debian. Show all posts

Thursday, July 16, 2015

How to Share ZFS on NFS protocol

How to Share ZFS on NFS protocol.

หลังจากที่เราได้สร้าง zpool และ zfs dataset แล้ว เราจะแชร์ไฟล์ให้เครื่องอื่นๆใน network ได้ใช้ ก็สามารถทำได้โดยใช้คำสั่งตามนี้ครับ

zfs set sharenfs=rw=host1:host2:host3,root=host1:host2:host3 {zpoolname}


แค่นี้ก็สามารถ share ไฟล์ให้ client ต่างๆได้แล้ว

credit : http://zfsonlinux.org/

Wednesday, July 8, 2015

How to install ZFS on Linux(zol) on Debian

          ZFS zeta byte file system คือ file system ชนิดหนึ่งเป็นของ Sun ซึ่งต่อมาทำเป็น open source
 Install package
# wget http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_4_all.deb
# dpkg -i zfsonlinux_4_all.deb
# wget http://zfsonlinux.org/4D5843EA.asc -O - | apt-key add -
# apt-get update
# apt-get install debian-zfs parted
Prepare disk
# parted /dev/sd{X} mklabel gpt
Create zpool(Disk)
# zpool create -m none -o ashift=12 {poolname} /dev/sd{X}
Check pool status
# zpool status
or
# zpool get {all,poolname}
Create zfs(partition)
# zfs create iqpool/data
# zfs set dedup={on,off} iqpool/data
# zfs set atime={on,off} iqpool/data
Check zfs status
# zfs list
# zfs get iqpool/data

Monday, July 21, 2014

How to install phpMyAdmin on debian7 or ubuntu

phpMyAdmin is a free web software to work with MySQL on the web. It provides a convenient visual front end to the MySQL capabilities.

Before working with phpMyAdmin, you need to have LAMP installed on your server. If you don't have the Linux, Apache, MySQL, PHP stack on your server, you can find the tutorial for setting it up here.

Install phpMyAdmin

In Debian and Ubuntu it simple.You can use apt-get for setup it.

# su -
# apt-get install phpmyadmin
or

# sudo apt-get install phpmyadmin


if you enabled sudo

During the installation, phpMyAdmin will walk you through a basic configuration. Once the process starts up, follow these steps:
Select Apache2 for the server
Choose YES when asked about whether to Configure the database for phpmyadmin with dbconfig-common
Enter your MySQL password when prompted
Enter the password that you want to use to log into phpmyadmin

After the installation has completed, add phpmyadmin to the apache configuration.
# sudo Include /etc/phpmyadmin/apache.conf > /etc/apache2/apache2.conf

Restart apache2 Service.
# sudo /etc/init.d/apache2 restart

You can then access phpmyadmin by going to youripaddress/phpmyadmin.

Sunday, July 20, 2014

How to install GlusterFS on Debian 7 wheezy

This tutorial I will explain GlusterFS configuration in Debian 7.6.0 and You can use this tutorial for ubuntu. GlusterFS is an open source distributed file system which provides easy replication over multiple storage nodes. Gluster File System is a distributed filesystem allowing you to create a single volume of storage which spans multiple disks, multiple machines and even multiple data centres.

How to use it? It simply.Please follow this step below.

Prerequisites
  • 2 x Debian 7 Server
  • IPaddr and hostname for all server
    I use :
  • Server 1 ipaddr : 192.168.207.129
    Server 1 hostname : debian7n1
  • Server 2 ipaddr : 192.168.207.130
    Server 2 hostname : debian7n2
     Install GlusterFS
The next step is to make the all machines server.
     


$ su -
# wget -O - http://download.gluster.org/pub/gluster/glusterfs/3.5/3.5.1/Debian/pubkey.gpg | apt-key add -
# echo deb http://download.gluster.org/pub/gluster/glusterfs/3.5/3.5.1/Debian/apt wheezy main > /etc/apt/sources.list.d/gluster.list
# apt-get install glusterfs-server glusterfs-client -y
# update-rc.d glusterd defaults
# gluster --version

glusterfs 3.5.1 built on Jun 28 2014 04:14:49

Repository revision: git://git.gluster.com/glusterfs.git

Copyright (c) 2006-2011 Gluster Inc. <http://www.gluster.com>

GlusterFS comes with ABSOLUTELY NO WARRANTY.

You may redistribute copies of GlusterFS under the terms of the GNU General Public License.


Now it is mandatory that both machines must listen to each other with their hostname
   
# vi /etc/hossts

192.168.207.129         debian7n1
192.168.207.130         debian7n2

Now step : run this command gluster peer probe [hostname] in debian7n1 for connect both machine

# gluster peer probe devian7n2
peer probe: success

# gluster peer status

Number of Peers: 1

Hostname: debian7n2
Uuid: 58e8bbb2-6067-47b3-b1c7-1f2316d55013
State: Peer in Cluster (Connected)

Now I will create a common folder on both debian virtual machine at /data

# fdisk -l /dev/sd*
Disk /dev/sdb: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders, total 10485760 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/sdb doesn't contain a valid partition table 
# mkfs.ext3 /dev/sdb
mke2fs 1.42.5 (29-Jul-2012)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n)  y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1342177280
40 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376, 294912, 819200, 884736
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 
# mkdir /data
#mount /dev/sdb /data

If you wish you can use any other mount points on both machines.
Now we need to create the volume where the data will reside. The volume will be called GlusterVol. Now run on any machine.
please follow this step on one machine:
# gluster volume create GlusterVol replica 2 transport tcp debian7n1:/data debian7n2:/data force
volume create: GlusterVol: success: please start the volume to access data

run this command to start volume

# gluster volume start GlusterVol volume start: GlusterVol: success # gluster volume info 
Volume Name: GlusterVol
Type: Replicate
Volume ID: 63bc4f7e-beb1-47b5-9cb9-9f111cb6b510
Status: Started
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: debian7n1:/data
Brick2: debian7n2:/data

Saturday, July 19, 2014

How to install LAMP on Debian 7

     หลังจากที่เราติดตั้ง Debian 7 กันไปแล้ว คราวนี้เรามาทำ web server หรือที่เค้าเรียกกันว่า LAMP(Linux, Apache, My Sql, PHP) กันดีกว่าครับ

     ว่าแล้วเราก็มาเริ่มกันเลยดีกว่าครับ
  • ก่อนอื่นเราต้องเข้าเป็น root ของระบบก่อนนะครับ
    $ su -
  • จากนั้นเรามาทำการอัพเดตกันหน่อยครับ
    root@debian:~# apt-get update
  • จากนั้นก็ติดตั้ง my sql ครับ
    root@debian:~# apt-get install mysql-server mysql-client
  • ตั้งรหัสผ่าน root ของ mysql ครับ

  • ยืนยันรหัสผ่านครับ

  • ติดตั้ง apache ครับ
    root@debian:~# apt-get install apache2 -y
  • ต่อไปก็ติดตั้ง Php, perl และ pyton ครับ

    root@debian:~# apt-get install php5 php-pear php5-mysql libapache2-mod-php5 -y
    root@debian:~# apt-get install perl libapache2-mod-perl2 -y
    root@debian:~# apt-get install python libapache2-mod-python -y
  • รีสตาร์ท service อีกทีครับ

    root@debian:~# /etc/init.d/apache2 restart
  • ทดสอบการใช้งาน php

    root@debian:~# nano -w /var/www/test.php
  • ใส่ Code นี้ลงไปครับเป็น code แสดงข้อมูลต่างๆของ php ที่ติดตั้งไปครับ

    <?php
         phpinfo();
    ?>
  • ทดสอบโดยการเปิด browser แล้วไปที่ http://<IP-address or Server name>/test.php ถ้าขึ้นก็เป็นอันใช้ได้ครับ

**หมายเหตุ
ถ้าจะเข้าใช้จากชื่อเครื่องต้องไปใส่ที่ไฟล์ /etc/hosts ก่อนนะครับโดยเพิ่ม

ip-address            hostname

เข้าไปครับ
เสร็จเรียบร้อยแล้วครับสำหรับการติดตั้ง ถ้าจะเอาหน้าเพจไปใส่ก็ใส่ที่ /var/www/ ได้เลยครับ

credit by : https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian

Thursday, July 17, 2014

How to install Debian 7.5 on VMware ESXi 5.5

     Debian Linux(เดเบียน ลินุกซ์)

     Debian คือ Linux Distro เจ้าหนึ่งที่มีผู้ใช้งานมากมายทั่วโลก ไม่แพ้ตัวอื่นๆเลย แต่ยังไม่มากนักในไทย = = และที่สำคัญเจ้าตัวนี้ยังเป็นต้นแบบของตัวอื่นๆ เช่น Ubuntu ครับ

     How to install Debian 7.5 on VMware ESXi 5.5

     ในครั้งนี้ผมขอข้ามขั้นตอนการสร้าง virtual machine ปไเลยนะครับ เนื่องจากเคยลงไว้แล้ว ก็แค่เลือก OS ให้ตรงกับที่เราต้องการในครั้งนี้ นั่นก็คือ Debian 7 ครับ ถ้าเสร็จแล้วก็มาเริ่มกันเลยครับ

download link www.debian.org
  • เปิดเครื่องก่อนครับ เมื่อเปิดขึ้นมาแล้วจะได้หน้าตาแบบนี้ครับ ถ้าใครไม่ได้แบบนี้ให้รีสตาร์ท VM 1 ทีครับ แล้วเลือก install หรือ Graphic install ครับ แต่ในที่นี้ผมจะเลือก install ครับ

  • จากนนั้นเลือกภาษาครับ เป็น English หรือใครถนัดภาษาอื่นก็แล้วแต่ครับ ฮี่ๆๆ (ไม่มีภาษาไทยนะครับ)

  • เลือก location ครับ

  • เลือกภาษาคีย์บอร์ดครับ

  • ใส่ชื่อเครื่องครับ

  • ใส่ชื่อโดเมนครับ

  • ตั้งรหัสผ่านของ user root ครับ

  • อีกครั้งครับ

  • สร้างบัญชีผู้ใช้งาน(user account) ครับ

  • ตั้ง user name ของบัญชีผู้ใช้ที่เราสร้างเมื่อสักครู่ครับ

  • ตั้งรหัสผ่านครับ

  • เลือก Time zone ครับ

  • กำหนด partition ครับ เลือกบรรทัดแรกไปได้เลยครับ

  • Enter เลยครับ

  • เลือกว่าจะแยก /home /usr /var ... หรือไม่ ถ้ายังไม่รู้คืออะไรให้เลือกบรรทัดแรกไปก่อนครับ

  • ตรวจสอบ และเลือก finish ได้เลยครับ

  • เลือก yes เพื่อยืนยันการเปลี่ยนแปลงครับ

  • จากนั้นก็จะถามว่าต้องการติดตั้ง package เลยหรือไม่ ถ้าต้องการก็ตอบ ใช่ ได้เลยครับ หรือจะรอติดตั้งเองหลังจากติดตั้ง OS เสร็จแล้วก็ได้ครับ

  • เลือก package ที่ต้องการติดตั้งครับ

  • เสร็จแล้วก็รอครับ
  • จากนั้นจะถามว่าต้องการติดตั้ง grub boot loader หรือไม่ ตอบ ใช่ ไปเลยครับ

  • กด Continue เพื่อสิ้นสุดการติดตั้งครับ หลังจากนั้นเครื่องจะรีสตาร์ทครับ

  • หน้าตาหลังจากรีสตาร์ทเสร็จ ก็ล็อกอินเข้า user ที่เราได้สร้างเอาไว้เพื่อเข้าใช้งานได้เลยครับ





  • เท่านี้ก็เป็นอันเสร็จเรียบร้อยแล้วครับสำหรับการติดตั้ง Debian 7.5 ครับ
    ก็ขอให้สนุกกับการใช้งานกันนะครับ ^ ^