Tuesday, February 27, 2018

如何在Ubuntu 16.04 desktop 透過PXE安裝Ubuntu?

在開始之前,請先準備與安裝相關的service在Ubuntu desktop 16.04 LTS:

準備:
1. Download Ubuntu desktop ISO
2. Download PXE bootloader

安裝:
1. DHCP Server
$ sudo apt-get install isc-dhcp-server
2. TFTP Server
$ sudo apt-get install tftpd-hpa inetutils-inetd
3. NFS Server
$ sudo apt-get install nfs-kernel-server
配置:
1. DHCP Server:
$ sudo vi /etc/dhcp/dhcpd.conf
 subnet 192.168.1.0 netmask 255.255.255.0 {
 range 192.168.1.200 192.168.1.253;
 option domain-name-servers 8.8.8.8;
 option routers 192.168.1.1;
 option broadcast-address 192.168.1.255;
 default-lease-time 600;
 max-lease-time 7200;
 next-server 192.168.1.254;
 filename "pxelinux.0";

 }
 $ sudo systemctl restart isc-dhcp-server
 2. TFTP Server:
$ sudo vi /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure"
RUN_DAEMON="yes"
OPTIONS="-l -s /var/lib/tftpboot"
$ sudo vi /etc/xinetd.conf
tftp    dgram   udp    wait    root    /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot
$ sudo systemctl restart tftpd-hpa 
3. PXE bootloader:
$ tar -xJf syslinux-6.03.tar.xz
$ cd syslinux-6.03
$ sudo cp bios/core/pxelinux.0 /var/lib/tftpboot
$ sudo cp bios/com32/lib/libcom32.c32 /var/lib/tftpboot
$ sudo cp bios/com32/libutil/libutil.c32 /var/lib/tftpboot
$ sudo cp bios/com32/elflink/ldlinux/ldlinux.c32 /var/lib/tftpboot
$ sudo cp bios/com32/menu/vesamenu.c32 /var/lib/tftpboot
$ mkdir /var/lib/tftpboot/pxelinux.cfg
$ sudo vi /var/lib/tftpboot/

pxelinux.cfg/default 
DEFAULT vesamenu.c32
MENU TITLE Network boot
LABEL ubuntu-mate-16.04.2-desktop-amd64
  MENU LABEL ubuntu-mate-16.04.2-desktop-amd64
  KERNEL vmlinuz.efi
  APPEND initrd=initrd.lz root=/dev/nfs boot=casper netboot=nfs nfsroot=192.168.1.254:/var/nfs/ubuntu_desktop splash -- 
* Remember to copy vmlinuz.efi and initrd.lz to the folder /var/lib/tftpboot from Ubuntu ISO.
* 補充: 針對18.04要修改一下設定檔如下:
  APPEND initrd=./u18/initrd_ubuntu18.04.lz root=/dev/nfs boot=casper netboot=nfs nfsroot=192.168.1.254:/var/nfs/ubuntu18.04 splash toram --


4. NFS file Server:
$ sudo mount -o loop ubuntu-16.04.3-desktop-amd64.iso /mnt/
$ sudo mkdir -p /var/nfs/ubuntu_desktop
$ sudo cp -rf /mnt/* /var/nfs/ubuntu_desktop/
$ sudo vi /etc/exports

/var/nfs/ubuntu_desktop *(ro,sync)
$ sudo systemctl restart nfs-kernel-server
$ showmount -e localhost 
Export list for localhost:
/var/nfs/ubuntu_desktop *

Boot from Network boot:















Done!

Tuesday, February 13, 2018

How can I move Launcher from left to the buttom on Ubuntu 16.04?

It's very simple, and it works for me even if I reboot or re-login the system b/c Ubuntu will remember it.

Steps:
1. Open a terminal

2. To execute "gsettings set com.canonical.Unity.Launcher launcher-position Bottom"

Done~

Sunday, February 04, 2018

How can I get detail information of USB device?

The command lsusb, which able to list all USB devices of machine below:
lawrence@Lawrence-ThinkPad-X200:~$ lsusb
Bus 002 Device 004: ID 7392:7711 Edimax Technology Co., Ltd EW-7711UTn nLite Wireless Adapter [Ralink RT2870]
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 17ef:480c Lenovo Integrated Webcam
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 08ff:2810 AuthenTec, Inc. AES2810
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


However, I would like to know more informations. For example, speed, vendor, manufacturer......, etc. And there is a command usb-devices, which can help me.


lawrence@Lawrence-ThinkPad-X200:~$ usb-devices 
T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=7392 ProdID=7711 Rev=01.01
S:  Manufacturer=RalinkS:  Product=802.11 n WLAN
S:  SerialNumber=1.0
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=450mA
I:  If#= 0 Alt= 0 #EPs= 7 Cls=ff(vend.) Sub=ff Prot=ff Driver=rt2800usb
T:  Bus=04 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=5000 MxCh= 2
D:  Ver= 3.00 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
P:  Vendor=1d6b ProdID=0003 Rev=04.13
S:  Manufacturer=Linux 4.13.0-32-generic xhci-hcd
S:  Product=xHCI Host Controller
S:  SerialNumber=0000:0d:00.0
C:  #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub


Above you can see the Spd=480/USB 2.0, and Spd=5000/USB 3.0.