Ubuntu

You are currently browsing the articles from KomKid.Net matching the category Ubuntu.

Ubuntu with RAM 4GB

ใช้งาน Ubuntu โดยที่มี RAM 2 GB มานาน วันดีคืนดีซื้อมาเพิ่มอีก 2 GB แทนที่จะเห็นเป็น 4 GB ดันเห็นแค่ 2.7 GB เอง
พอลองเปิด Windows7 ดูบ้างก็เห็นเป็น 4 GB (Available 2.7 GB) เหมือนกัน
พอค้นคว้าดูก็พบว่าเป็นข้อจำกัดของ OS 32 bit นี่เอง แต่สำหรับ Ubuntu มีทางแก้ไขคือ เปิดใช้งาน Physical Address Extension :P AE

1. ตรวจสอบก่อนว่า CPU เรา support มั้ย

1
grep --color=always -i PAE /proc/cpuinfo

ถ้าได้ผลก็ดำเนินการต่อได้

2. ติดตั้ง Kernel สำหรับใช้งาน PAE

1
sudo aptitude install linux-generic-pae linux-headers-generic-pae

ที่มา : https://help.ubuntu.com/community/EnablingPAE

Written by Komkid on January 23rd, 2012 with no comments.
Read more articles on IT Tips and Ubuntu.

Ubuntu : Internet Sharing

#nano /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 192.168.1.10
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
post-up /usr/local/bin/iptable.sh

#nano /usr/local/bin/iptable.sh

#!/bin/bash
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -P FORWARD ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp –dport 80 -j REDIRECT –to-port 8080
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

#apt-get install squid3
#nano /etc/squid3/squid.conf

http_port 8080 transparent
acl localnet src 192.168.1.0/24
http_access allow localnet
http_access deny all

#apt-get install dnsmasq
#nano /etc/dnsmasq.conf

interface=eth1
dhcp-range=192.168.1.11,192.168.1.20,12h

script : share-net-script

Written by Komkid on July 7th, 2011 with no comments.
Read more articles on Internet and IT Tips and Ubuntu.

Ubuntu : Shutter add-ons

อ้าว Shutter (โปรแกรมสำหรับ capture screen) ทำไม capture แล้ว edit ไม่ได้หว่า
search ดูถึงได้รู้ว่า ขาด add-ons บางอย่างไปนี่เอง ว่าแล้วก็ติดตั้งซะเลย

1
2
apt-get install libgoo-canvas-perl
apt-get install gnome-web-photo

อันแรกเอาไว้ capture แล้ว edit ได้
อันที่สองเอาไว้ capture หน้า web page ยาว ๆ มันจะ scroll ให้อัตโนมัติ

Written by Komkid on October 20th, 2010 with no comments.
Read more articles on IT Tips and Software and Ubuntu.

Ubuntu : Backup & Restore

คำสั่ง mt (Magnatic Tape) ปกติระบบจะ mount ไว้ให้ที่ /dev/st0

1
2
3
4
mt -f /dev/st0 status # ตรวจสอบสถานะ
mt -f /dev/st0 rewind # สั่งหมุน tape กลับ
mt -f /dev/st0 erase # ลบข้อมูล (นานมาก)
mt -f /dev/st0 offline #สั่งเด้ง tape ออก

Cleaning Cartridge # บางรุ่นอาจไม่เหมือนกัน
ใส่เข้าไป พอมัน load เข้าไปแล้วทำความสะอาดเสร็จจะเด้งออกมาเอง
(Cleaning Cartridge เป็นแบบใช้แล้วใช้เลย rewind กลับมาใช้อีกไม่ได้)

คำสั่ง Backup & Restore
Backup ใช้ -c

1
tar -cvf backup_filename data_to_backup

เช่น

1
tar -cvf backup.tar /home/nikom

กรณีต้องการให้บีบอัดไฟล์ด้วย เพิ่ม parameter -z

1
tar -cvzf backup.tar.gz /home/nikom

Restore เปลี่ยน -c เป็น -x (เข้าไปใน directory ที่จะ restore ก่อน เพราะสั่งตรงไหน restore มาตรงนั้น)

1
tar -xvf backup_filename

เช่น

1
tar -xvf backup.tar

restore ไฟล์ที่บีบไว้ ใช้ -z เหมือนกัน

1
tar -xvzf backup.tar.gz

Tape
backup ลง tape

1
tar -cvf /dev/st0 data_to_backup

ดูรายการใน tape

1
 tar -tvf /dev/st0

restore จาก tape

1
 tar -tvf /dev/st0 backup_filename

backup & restore กับ tape ก็ใช้ -z สำหรับการบีบอัดได้

backup แบบ incremental
การ backup เฉพาะส่วนที่เพิ่มขึ้น ทำได้โดยใช้ -g ตามด้วย ไฟล์ที่ใช้เก็บส่วนต่าง เช่น

1
 tar -g /home/nikom/tar_inc_file.dat -cvf /dev/st0 /home/nikom

Written by Komkid on October 20th, 2010 with no comments.
Read more articles on Admin and Ubuntu.

Ubuntu : Automount NTFS partition when login

ติดตั้ง ubuntu ใหม่ทีไร ลืมทุกที
1.แก้ fstab
1.1 mkdir /media/Data1 #สร้าง mount point
1.2 sudo apt-get install ntfs-3g
1.3 sudo nano /etc/fstab
1.4 เพิ่มบรรทัดดังนี้
/dev/sda1 /media/Data1 ntfs-3g defaults 0 0

2.ใช้ script
2.1 nano /etc/automount.sh
2.2 ดังนี้

1
2
3
#!/bin/bash
mount /dev/sda1 /media/Data -t ntfs -o rw
mount /dev/sda2 /media/Data2 -t ntfs -o rw

Written by Komkid on October 20th, 2010 with no comments.
Read more articles on Ubuntu.

« Older articles

No newer articles