Unix/Linux

Cấu hình Proxmox server sử dụng một Public IP cho tất cả VM

Đăng vào ngày 2 Tháng Sáu 2013 lúc 12:41 bởi Duy Khánh Mục: IT, Unix/Linux, Virtualization  ||  Tags: , ,    Bình luận (0)

I - Cài đặt và cấu hình Proxmox:

- Download file ISO tại trang chủ: http://www.proxmox.com

- Sau khi cài đặt thành công proxmox, chúng ta có thể truy cập vào giao diện web tại địa chỉ https://<ip-server>:8006

- Mặc định sau khi cài đặt xong Proxmox địa chỉ IP public sẽ được gán trên card vmbr0, card này được bridge với card eth0 của server. Chúng ta cần thay đổi một số thông tin tại đây.

/etc/network/interfaces

Địa chỉ IP public của server sẽ được gán trên card eth0. Đối với card vmbr0 chúng ta sẽ chuyển bridge_ports sang none (thay vì eth0) trước đó. Cấu hình mẫu như bên dưới

# network interface settings
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address  192.168.100.115
        netmask  255.255.255.0
        gateway  192.168.100.2
        dns-nameservers 8.8.8.8

auto vmbr0
iface vmbr0 inet static
        address  10.10.10.1
        netmask  255.255.255.0
        bridge_ports none
        bridge_stp off
        bridge_fd 0

Giả sử ở cấu hình trên, địa chỉ public của server sẽ là 192.168.100.115 được gán lên card eth0, còn địa chỉ 10.10.10.1 được gán trên card vmbr0 sẽ giao tiếp với các VM bên trong.

Trên giao diện web của Proxmox, thẻ network ta sẽ có thông tin như sau

Chúng ta cũng sẽ setup một VM để test. VM này sẽ có địa chỉ IP là 10.10.10.10.

 

II - Cài đặt và cấu hình shorewall

- Cài đặt shorewall bằng lệnh: apt-get install shorewall

- Kích hoạt Ip forwarding trên shorewall bằng cách mở file /etc/shorewall/shorewall.conf

Đổi

IP_FORWARDING=Off

Thành

IP_FORWARDING=On

- Cấu hình Zone trong file /etc/shorewall/zones. Chúng ta sẽ có 3 Zone fw, net, và dmz. Trong đó net là zone giao tiếp từ môi trường internet, dmz là zone nội bộ bên trong.

#ZONE   TYPE            OPTIONS         IN                      OUT
#                                       OPTIONS                 OPTIONS
fw      firewall
net     ipv4
dmz     ipv4

- Cho biết các zone được kết nối thông qua interface nào. Tạo file /etc/shorewall/interfaces

#ZONE   INTERFACE       BROADCAST       OPTIONS
net     eth0            detect          blacklist,nosmurfs
dmz     venet0          detect          routeback
dmz     vmbr0           detect          routeback,bridge

- Tiếp tục, chúng ta cấu hình các policy mặc định giữa các zone. Tạo file /etc/shorewall/policy

#SOURCE DEST    POLICY          LOG     LIMIT:          CONNLIMIT:
#                               LEVEL   BURST           MASK

# From Firewall Policy
fw      fw      ACCEPT
fw      net     ACCEPT
fw      dmz     ACCEPT

# From DMZ Policy

dmz     dmz     ACCEPT
dmz     net     ACCEPT
dmz     fw      DROP            info

# From Net Policy
net     fw      DROP            info
net     dmz     DROP            info 

# THE FOLLOWING POLICY MUST BE LAST
#
all     all     REJECT          info

- Thiết lập rules cho shorewall tại /etc/shorewall/rules

#ACTION          SOURCE     DEST       PROTO   DEST        SOURCE     ORIGINAL    RATE

# Permit access to SSH
SSH/ACCEPT       net        fw         -       -            -          -          6/min:5

# Permit access to Proxmox Manager and Console
ACCEPT           net        fw                        tcp     8006,5900:5999
# VM access rules DNAT net dmz:10.10.10.10:22 tcp 1022 # PING Rules Ping/ACCEPT all all # LAST LINE -- DO NOT REMOVE

Trong ví dụ về cấu hình rule ở trên, chúng ta cho phép SSH và ping tới Proxmox server. Ngoài ra, chúng ta còn thực hiện việc NAT port 22 trên VM. Với cấu hình này, nếu chúng ta muốn SSH tới VM từ bên ngoài internet, chúng ta có thể SSH thông qua public IP với port là 1022 (Cấu hình cho các dịch vụ khác tương tự).

- Thiết lập cho phép kết nối từ VM ra ngoài internet thông qua tệp tin /etc/shorewall/masq

#INTERFACE      SOURCE          ADDRESS         PROTO   PORT(S) IPSEC   MARK
eth0            10.10.10.0/24

# LAST LINE -- DO NOT REMOVE

- Kiểm tra cấu hình của shorewall đã đúng hay chưa

shorewall check
- Nếu mọi cấu hình đều OK, chúng ta kích hoạt cho phép Shorewall được khởi động
/etc/default/shorewall
- Khởi động Shorewall
service shorewall start
Chú ý: Nếu bạn SSH tới Proxmox server từ xa. Việc cấu hình sai shorewall có thể làm bạn bị mất kết nối khi khởi động dịch vụ shorewall. Để tránh tình trạng này, chúng ta có thể sử dụng lệnh sau để kiểm tra trước. Với lệnh này, shorewall sẽ chỉ apply cấu hình trong vòng 60 giây, sau thời gian đó, nó sẽ tự động khôi phục lại trạng thái trước đó.
shorewall try /etc/shorewall 60
Mọi cấu hình đã xong, bây giờ chúng ta có thể truy xất SSH tới VM bên trong thông qua ip public của Proxmox Server.

Install puppet on ubuntu server

Đăng vào ngày 26 Tháng Năm 2013 lúc 22:24 bởi Duy Khánh Mục: IT, Unix/Linux  ||  Tags: , ,    Bình luận (0)

Install puppet master

master$ sudo apt-get -y install puppetmaster

Regenerate Master Certificate

master$ sudo service puppetmaster stop

master$ sudo rm -r /var/lib/puppet/ssl

Add master’s name to config

master$ sudoedit /etc/puppet/puppet.conf

add these names under [master] heading

dns_alt_names = puppet, master.local, puppet.khanh.com.vn

Certificate is automatically generated when you start PuppetMaster

master$ sudo service puppetmaster start

Connect from Slave

slave$ sudo apt-get -y install puppet

slave$ sudoedit /etc/puppet/puppet.conf

Add master DNS name under [agent] heading. Puppet will connect to server.

[agent]

server = master.local

Allow puppet slave to start

slave$ sudoedit /etc/default/puppet

Change to yes:

START=yes

Sign Slave Certificate on Master

master$ sudo puppet cert --list

master$ sudo puppet cert --sign slave.example.com

Create Site Manifest and a Module

....

Test Slave get configuration from Master

slave$ sudo puppet agent --test

------------------------

Force agent to regenerate certificate request by generate command

 

[puppet agent]$ puppet  certificate   generate    web1  --ca-location  remote
warning: peer certificate won't be verified in this SSL session
err: Error 400 on SERVER: web1 already has a revoked certificate; ignoring certificate request
err: Try 'puppet help certificate generate' for usage
#It because the revoked certificate still exist in the server, it need to be deleted
[puppet master]$ puppet cert list –all
- web1                                     (BA:18:D1:86:D6:5E:9E:99:55:39:3D:67:79:BF:BD:D0) (certificate revoked)
[puppet master]$ puppet cert clean web1
#re-run the command, the warning is expected because the request hasn’t been signed by master yet
[puppet agent]$puppet certificate generate web1 --ca-location remote
warning: peer certificate won't be verified in this SSL session
true
#The pending request appears in master 
[puppet master]$ puppet cert list
web1 (3B:ED:D9:8D:2F:C2:A1:D3:89:B4:D0:FD:41:7E:5E:0C)
#Sign the certificate
[puppet master]# puppet cert sign web1

Install sysbench on CentOS

Đăng vào ngày 24 Tháng Tư 2013 lúc 22:45 bởi Duy Khánh Mục: IT, SQL, Unix/Linux  ||  Tags: , ,    Bình luận (0)

Download sysbench from: http://sourceforge.net/projects/sysbench/

Sysbench need mysql-devel installed

# yum install mysql-devel

Following commands to install sysbench

# aclocal

# libtoolize --force --copy

sysbench_installation_root_folder >  ./autogen.sh

sysbench_installation_root_folder > ./configure

sysbench_installation_root_folder > make

sysbench_installation_root_folder > make install 

 

Example: Benchmark MySQL

1. Create test table in database test with 1.000.000 records

# sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=mypassword prepare

2. Benchmark MySQL follow command

# sysbench --test=oltp --oltp-table-size=1000000 --mysql-db=test --mysql-user=root --mysql-password=mypassword --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run

3. Clean up DB afterwards

# sysbench --test=oltp --mysql-db=test --mysql-user=root --mysql-password=mypassword cleanup

Chạy nhiều Tomcat instance trên cùng một server

Đăng vào ngày 28 Tháng Ba 2013 lúc 07:42 bởi Duy Khánh Mục: IT, Unix/Linux, Web Design  ||  Tags: , , ,    Bình luận (1)

B1: Cài đặt Tomcat

Cài đặt Tomcat phân chia thành các thư mục khác nhau, ví dụ /var/tomcat/serverA /var/tomcat/serverB. Trong đó các thư mục serverA, serverB cần có những thư mục nội dung và cấu hình sau: bin, lib, conf, logs, temp, webapps, work

Xem thêm: Cách cài đặt Tomcat7

B2: Thay đổi port

Mỗi Instance sẽ lắng nghe trên các port khác nhau, cần phải thay đổi để không bị xung đột. Có 3 port cần phải đổi là

  • shutdown port: Port này được dùng bở tiến trình java khi tomcat chạy. Khi script shutdown.sh được thực hiện, tomcat sẽ gửi tín hiện kết thúc thông qua port này. Ví dụ 8005
  • connector port: Port dùng để kết nối tới tomcat từ xa (trình duyệt). Ví dụ 8080
  • ajp port: Port dùng khi apache httpd server liên lạc với tomcat, sử dụng để tạo loadbalancer. Ví dụ: 8009

Bạn cần sử file conf/server.xml thay đổi port

B3: Tạo init script cho mỗi Instance

 

#!/bin/bash

    # description: Tomcat Start Stop Restart

    # processname: tomcat

    # chkconfig: 234 20 80

    JAVA_HOME=/usr/java/jdk1.7.0_17/

    export JAVA_HOME

    PATH=$JAVA_HOME/bin:$PATH

    export PATH

    CATALINA_HOME=/usr/share/tomcat7

 

    case $1 in

    start)

    sh $CATALINA_HOME/bin/startup.sh

    ;;

    stop)

    sh $CATALINA_HOME/bin/shutdown.sh

    ;;

    restart)

    sh $CATALINA_HOME/bin/shutdown.sh

    sh $CATALINA_HOME/bin/startup.sh

    ;;

    esac

    exit 0

 

------------------------

 

 

#!/bin/bash

    # description: Tomcat Start Stop Restart

    # processname: tomcat

    # chkconfig: 234 20 80

    JAVA_HOME=/usr/java/jdk1.7.0_17/

    export JAVA_HOME

    PATH=$JAVA_HOME/bin:$PATH

    export PATH

    CATALINA_BASE=/usr/share/tomcat7-new

 

    case $1 in

    start)

    sh $CATALINA_BASE/bin/startup.sh

    ;;

    stop)

    sh $CATALINA_BASE/bin/shutdown.sh

    ;;

    restart)

    sh $CATALINA_BASE/bin/shutdown.sh

    sh $CATALINA_BASE/bin/startup.sh

    ;;

    esac

    exit 0

Install Tomcat 7 on Centos 6.3

Đăng vào ngày 16 Tháng Ba 2013 lúc 07:46 bởi Duy Khánh Mục: IT, Unix/Linux, Web Design  ||  Tags: , , , ,    Bình luận (1)

This post will cover installing and basic configuration of apache-tomcat-7.0.30

If you do not already have the Java Development Kit (JDK) installed on your machine, you will need to download and install the required JDK for your platform.

If you do have the JDK installed, you can skip to: Step 2: Download and Install the  apache-tomcat-7.0.30

Step 1: Install the JDK
[root@station1 Downloads]# rpm -ivh jdk-7u7-linux-x64.rpm

--> 

[root@station1 Downloads]# JAVA_HOME=/usr/java/jdk1.7.0_17
[root@station1 Downloads]# export JAVA_HOME
[root@station1 Downloads]# PATH=$JAVA_HOME/bin:$PATH
[root@station1 Downloads]# export PATH 
[root@station1 Downloads]# vim /root/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
JAVA_HOME=/usr/java/jdk1.7.0_17/
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
#PATH=$PATH:$HOME/bin
#export PATH
Restart or logout and login
[root@station1 Downloads]# echo $JAVA_HOME
/usr/java/jdk1.7.0_17/
       Step 2: Download and Unpack apache-tomcat-7.0.30 (or latest)
To download apache-tomcat click here
[root@station1 Downloads]# tar -xzvf apache-tomcat-7.0.30.tar.gz 
[root@station1 Downloads]# mv apache-tomcat-7.0.30 /usr/share/ 
[root@station1 Downloads]# vim /etc/init.d/tomcat 
    #!/bin/bash
    # description: Tomcat Start Stop Restart
    # processname: tomcat
    # chkconfig: 234 20 80
    JAVA_HOME=/usr/java/jdk1.7.0_17
    export JAVA_HOME
    PATH=$JAVA_HOME/bin:$PATH
    export PATH
    CATALINA_HOME=/usr/share/apache-tomcat-7.0.30

    case $1 in
    start)
    sh $CATALINA_HOME/bin/startup.sh
    ;;
    stop)
    sh $CATALINA_HOME/bin/shutdown.sh
    ;;
    restart)
    sh $CATALINA_HOME/bin/shutdown.sh
    sh $CATALINA_HOME/bin/startup.sh
    ;;
    esac
    exit 0
[root@station1 ~]# chmod 755 /etc/init.d/tomcat
[root@station1 ~]# chkconfig --add tomcat
[root@station1 ~]# chkconfig --level 234 tomcat on
[root@station1 ~]# chkconfig --list tomcat
tomcat             0:off    1:off    2:on    3:on    4:on    5:off    6:off
[root@station1 ~]# service tomcat stop
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_17
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar
[root@station1 ~]# service tomcat start
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_17
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar
[root@station1 ~]# service tomcat restart
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_17
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_07
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar
For logs

[root@station1 ~]# less /usr/share/apache-tomcat-7.0.30/logs/catalina.out
We can now access the Tomcat Manager page at http://127.0.0.1:8080
------------

Fedora - How to change boot sequence in Grub2

Đăng vào ngày 16 Tháng Ba 2013 lúc 07:40 bởi Duy Khánh Mục: IT, Unix/Linux  ||  Tags: , ,    Bình luận (2)

his is for dual boot os users, there are many who prefers dual boot to keep another OS optional. For any reason if you wish to change boot sequence unlike grub, grub2 requires couple of commands to run.

Here will take example to keep Windows as default boot.
First of all find menuentry for Windows

cat/boot/grub2/grub.cfg |grep Windows

result:-

menuentry "Windows 7 (loader) (on /dev/sda1)"--class windows --class os {

Set Windows menuentry as default (only entry mentioned in either " or 'from above command)

grub2-set-default "Windows 7 (loader) (on /dev/sda1)"

Verify default entry

grub2-editenv list

Generate updated grub.cfg

grub2-mkconfig -o/boot/grub2/grub.cfg

Below is to set Fedora as default boot

cat /boot/grub2/grub.cfg |grep Fedora
grub2-set-default "Fedora Linux, with Linux 3.1.0-5.fc16.i686"
grub2-editenv list
grub2-mkconfig -o /boot/grub2/grub.cfg

 

 

Extending a logical volume in a virtual machine running Red Hat or Cent OS

Đăng vào ngày 4 Tháng Hai 2013 lúc 20:38 bởi Duy Khánh Mục: Unix/Linux, VMware  ||  Tags: , , ,    Bình luận (1)

 

Note: These steps only apply to EXT3 file systems.
 
Caution: VMware recommends having a complete backup of the virtual machine prior making these changes.
  1. Power off the virtual machine.
  2. Edit the virtual machine settings and extend the virtual disk size. For more information, see Increasing the size of a virtual disk (1004047).
  3. Power on the virtual machine.
  4. Identify the device name, which is by default /dev/sda, and confirm the new size by running the command:

    # fdisk -l

  5. Create a new primary partition:
    1. Run the command:

      # fdisk /dev/sda (depending the results of the step 4)
       
    2. Press p to print the partition table to identify the number of partitions. By default there are 2: sda1 and sda2.
    3. Press n to create a new primary partition. 
    4. Press p for primary.
    5. Press 3 for the partition number, depending the output of the partition table print.
    6. Press Enter two times.
    7. Press w to write the changes to the partition table.

  6. Restart the virtual machine.
  7. Run this command to verify that the changes were saved to the partition table and that the new partition has an 83 type:

    # fdisk -l

  8. Run this command to convert the new partition to a physical volume:

    # pvcreate /dev/sda3

  9. Run this command to extend the physical volume:

    # vgextend VolGroup00 /dev/sda3

    Note: To determine which volume group to extend, use the command vgdisplay.

  10. Run this command to verify how many physical extents are available to the Volume Group:

    # vgdisplay VolGroup00 | grep "Free"

  11. Run the following command to extend the Logical Volume:

    # lvextend -L+#G /dev/VolGroup00/LogVol00

    Where # is the number of Free space in GB available as per the previous command.

    Note: to determine which logical volume to extend, use the command lvdisplay.

  12. Run the following command to expand the ext3 filesystem online, inside of the Logical Volume:

    # ext2online /dev/VolGroup00/LogVol00

    Note: Use resize2fs instead of ext2online if it is not a Red Hat virtual machine.

  13. Run the following command to verify that the / filesystem has the new space available:

    # df -h /

 

How to start applications on boot (Debian)

Đăng vào ngày 10 Tháng Chín 2012 lúc 22:32 bởi Duy Khánh Mục: IT, Unix/Linux  ||  Tags: ,    Bình luận (1)

update-rc.d is the utility that Debian provides to manage SystemV init scripts. If you are familiar with Redhat's chkconfig then you're half way to understanding how to use it. Here's how: Say you have a new service called "waffles" that you would like to start at boot time. Make sure that the file "/etc/init.d/waffles" exists. If this was debian package installed via apt you can almost be sure that this exists, if this was an installation from source, you may need to create your own init script or find a provided example, but this is outside of our scope. So let's say that this init script exists. Here is the simple command that you can type to make your service run at boot time.

# update-rc.d waffles defaults
This will make sure that when your system reaches runlevel 2, 3, 4 or 5 that the waffles service will start up and that in runlevel 0, 1 or 6 it will be stopped. So you're done with your waffles and you would like to stop them from starting up tomorrow morning when you reboot? Just issue this simple command to remove it from starting up at boot time:
# update-rc.d waffles remove
It's as simple as that, but sometimes you would like to make your setup a bit more complicated. Say for instance you don't want waffles to start up in runlevels 2 or 3? You could run the following command:
# update-rc.d waffles start 45 stop 01236
Waffles will start up when your system reaches runlevels 4 or 5, but stop at 0, 1, 2, 3 or 6. One last thing though, if you do not like the way update-rc.d functions or if you would just prefer a graphical interface, try installing rcconf ( apt-get install rcconf ). This tool is a graphical interface that can be used from the shell to configure your System V style init scripts.

Cấu hình file /etc/fstab để quản lý việc mount thiết bị trong Linux

Đăng vào ngày 29 Tháng Tám 2012 lúc 08:57 bởi Duy Khánh Mục: IT, Unix/Linux  ||  Tags: ,    Bình luận (0)

 

Trong Linux, file fstab nằm tại thư mục /etc. Bài viết này sẽ tìm hiểu nội dung và cách chỉnh sửa thông tin trong file này và ngụ ý rằng bạn đã biết cơ bản về lệnh mount (xem lại bài “Làm sao để mount/unmount filesystem trong Linux”).

 1.     Giới thiệu

File cấu hình /etc/fstab chứa thông tin về các thiết bị (phân vùng ổ cứng, CD/DVD, USB, ISO image…) trên máy tính bao gồm:

+ Đường dẫn tới file đại diện cho thiết bị.
+ Mount point: cho biết thiết bị được mount vào thư mục nào.
+ Các tùy chọn (option): chỉ ra thiết bị được mount như thế nào?
v.v..

Nếu bạn không thể truy cập các phân vùng dành cho Windows (NTFS, FAT), hoặc không thể mount ổ DVD, ghi dữ liệu vào USB, đọc file từ ổ mềm… thì có thể chip nhớ trên thiết bị bị lỗi hoặc cũng có thể bạn đã cấu hình file fstab không đúng cách!

fstab là file dạng văn bản (plain text), vì thế bạn có thể mở và chỉnh sửa nó sử dụng bất kỳ công cụ Text Editor nào với điều kiện bạn phải có đặc quyền root để lưu lại những thay đổi. Nếu bạn đang đăng nhập với tài khoản người dùng thông thường thì có thể sử dụng 2 lệnh suhoặc sudo để tạm thời chuyển sang đặc quyền root.

2.     Cấu trúc của file /etc/fstab

Vì mỗi hệ thống có các thiết bị khác nhau nên thông tin trong file fstab ở mỗi máy cũng khác nhau. Nhưng về cơ bản, khi bạn nắm được định dạng chung của fstab thì không có gì khó khăn khi xem thông tin trong file này trên các hệ thống khác. Khi lệnh mount được thực thi, hệ thống sẽ đọc thông tin trong file fstab để đưa ra cách xử lý tương ứng. Đây là 1 ví dụ về nội dung của file:

Như bạn thấy, mỗi dòng trong file fstab chứa thông tin về một thiết bị. Các cột ở mỗi hàng được phân cách bởi khoảng trắng. Thứ tự các dòng là không quan trọng. Sau đây phần giải thích kỹ hơn ý nghĩa của từng cột:

+ Cột 1: cho biết loại thiết bị (phân vùng, CD/DVD, USB, ISO image…). Đồng thời cũng cho biết đường dẫn tới file đại diện cho thiết bị (device file) . Trong Linux, mọi tài nguyên phần cứng lẫn phần mềm đều được xem là file, các device file thường nằm ở thư mục /dev

+ Cột 2: đường dẫn của mount point, là một thư mục trống được tạo sẵn trong cây thư mục. Khi gõ lệnh mount, nếu bạn không chỉ định rõ mount point thì đây là mount point mặc định cho thiết bị ở cột 1. Thư mục chứa mount point thường là /mnt hay /media , mặc dù bạn có thể mount thiết bị vào bất cứ thư mục trống nào.

+ Cột 3: là kiểu filesystem của thiết bị. Linux hỗ trợ nhiều kiểu filesystem, dưới đây là 1 số filesystem phổ biến:

  • Ext2 và Ext3: điểm khác biệt lớn nhất giữa 2 loại filesystem này là ext3 hỗ trợ tính năngjournaling, tức là khi bạn tắt máy không đúng cách (do cúp điện đột ngột, hệ thống bị treo nên phải nhấn nút khởi động lại…) thì khả năng mất mát dữ liệu ở mức thấp, đồng thời hệ điều hành sẽ không phải tốn thời gian để kiểm tra, tìm lỗi trên filesystem trong lần khởi động kế tiếp.
  • ReiserFS: cũng hỗ trợ tính năng journaling nhưng có thêm nhiều tính năng nổi trội hơn so với ext3. Ngày nay ext3, ReiserFS được chọn là filesystem mặc định trên nhiều bản phân phối Linux.
  • swap: phân vùng làm không gian bộ nhớ ảo, dùng để bổ sung thêm bộ nhớ cho hệ thống khi hệ điều hành phát hiện việc thiếu hụt bộ nhớ RAM.
  • Vfat (FAT16, FAT32) và NTFS: đây là các filesystem được Windows hỗ trợ.
  • nfs: dành cho các tài nguyên ở xa, được chia sẻ qua mạng sử dụng NFS
  • auto: đây không phải là 1 filesytem. Nó có nghĩa là hệ thống sẽ tự động nhận diện loại filesystem của thiết bị khi thiết bị đó được mount.

+ Cột 4: là các tùy chọn khi mount.

Nếu có nhiều tùy chọn thì chúng được phân cách bởi dấu phẩy. Dưới đây là 1 số tùy chọn đáng chú ý:

  • auto: tự động mount thiết bị khi máy tính khởi động.
  • noauto: không tự động mount, nếu muốn sử dụng thiết bị thì sau khi khởi động vào hệ thống bạn cần chạy lệnh mount.
  • user: cho phép người dùng thông thường được quyền mount.
  • nouser: chỉ có người dùng root mới có quyền mount.
  • exec: cho phép chạy các file nhị phân (binary) trên thiết bị.
  • noexec: không cho phép chạy các file binary trên thiết bị.
  • ro (read-only): chỉ cho phép quyền đọc trên thiết bị.
  • rw (read-write): cho phép quyền đọc/ghi trên thiết bị.
  • sync: thao tác nhập xuất (I/O) trên filesystem được đồng bộ hóa.
  • async: thao tác nhập xuất (I/O) trên filesystem diễn ra không đồng bộ.
  • defaults: tương đương với tập các tùy chọn rw, suid, dev, exec, auto, nouser, async

+ Cột 5 là tùy chọn cho chương trình dump, công cụ sao lưu filesystem. Điền 0: bỏ qua việc sao lưu, 1: thực hiện sao lưu.

+ Cột 6 là tùy chọn cho chương trình fsck, công cụ dò lỗi trên filesystem. Điền 0: bỏ qua việc kiểm tra, 1: thực hiện kiểm tra

Kết luận:

File /etc/fstab cung cấp các chỉ dẫn cho hệ điều hành trong việc nhận diện, quản lý việc mount các thiết bị. Đồng thời việc cấu hình lại file fstab cũng giúp ích cho bạn trong việc giảm bớt thời gian mount thiết bị bằng lệnh cũng như là kiểm soát việc truy cập tới thiết bị của người dùng.

–manthang

Debian Linux Stop Iptables Firewall

Đăng vào ngày 8 Tháng Tám 2012 lúc 10:14 bởi Duy Khánh Mục: IT, Unix/Linux  ||  Tags: ,    Bình luận (0)

You need to login as root user.
If it is remote server login over ssh session.
Type the following command to save existing iptables configuration.

iptables-save > /root/working.iptables.rules

Now, to stop firewall type the following commands:

iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
 
 

Nghe nhạc cho vui

Ghi Chú

+ command "netstat -ano": IPs access

+ Restore dữ liệu trên SQLServer bằng dòng lệnh

RESTORE DATABASE db_name
FROM DISK = 'E:\db.BAK'
WITH REPLACE

+ Cover từ VB.NET sang C#

http://developerfusion.com/tools/convert/vb-to-csharp/

Certifications