## adjust resolution for VirtualBox Ubuntu VM
sudo apt-get install virtualbox-guest-dkms
## install Chinese input method
sudo apt-get install fcitx-googlepinyin
im-config
## install Ubuntu in a LVM-style way
# Enter the "Try Ubuntu" mode with Ubuntu Desktop 16.04 CD # use fdisk to make 3 partitions on /dev/sda (capacity: 500GB)
# within fdisk, type "g" to use gpt partition table
sudo fdisk /dev/sda # Below lists a sample of physical partitions
/dev/sda1 1G # for /boot /dev/sda2 7G # for swap /dev/sda3 80G # for LVM physical volume # create a physical volume with /dev/sda3 sudo pvcreate /dev/sda3 # init a volume group with the pv above sudo vgcreate vg1 /dev/sda3 # create a logical volume for the root / sudo lvcreate -L 7G -n lvroot vg1 # create a lv for /home sudo lvcreate -L 20G -n lvhome vg1 # create a lv for /tmp sudo lvcreate -L 5G -n lvtmp vg1 # for /usr sudo lvcreate -L 10G -n lvusr vg1 # for /usr/local sudo lvcreate -L 5G -n lvusrlocal vg1 # for /opt sudo lvcreate -L 5G -n lvopt vg1 # for /srv sudo lvcreate -L 5G -n lvsrv vg1 # for /var sudo lvcreate -L 10G -n lvvar vg1 # choose "Something else" to install Ubuntu # set ext4 as filesystem for these logical volumes # and set mount points according their names
## more with LVM
sudo lvdisplay vg1/lvhome sudo lvextend -L +5G vg1/lvhome sudo resize2fs /dev/vg1/lvhome
## using tornado, django, pymongo with python3
sudo apt-get install python3-pip pip3 -V sudo pip3 install tornado sudo pip3 install django sudo pip3 install pymongo
# ssh without password
ssh-keygen ssh-copy-id -p 64001 user@remoteHost
# mount partition at startup
ls -l /dev/disk/by-uuid cat /etc/fstab sudo fdisk -l sudo blkid # add a line like below to the file /etc/fstab /dev/disk/by-uuid/637d08c5-c89e-4dd6-8454-6c524c4207a7 /media/data ext4 defaults 0 0
# use curl with a proxy
curl -x 'http://domain\user:password@host:port' -O 'urlstring'
# allow apt pass a proxy
# create the apt.conf file if it doesn't exist sudo touch /etc/apt/apt.conf # add the following line to the file Acquire::http::Proxy "http://domain\user:password@host:port";
# change screen resolution for Ubuntu 14.04 Desktop running in Windows 8.1 Hyper-V
# update the file /etc/default/grub sudo vi /etc/default/grub # change the line below # GRUB_CMDLINE_LINUX="video=hyperv_fb:[width]x[height]" GRUB_CMDLINE_LINUX="video=hyperv_fb:1600x900" # update grub and reboot sudo update-grub sudo reboot
# change password for root
sudo passwd root
# enable manual login for Ubuntu Desktop
# create a config file under /etc/lightdm/lightdm.conf.d/ mkdir /etc/lightdm/lightdm.conf.d touch /etc/lightdm/lightdm.conf.d/show-manual-login.conf # add the following setting to the file sudo su -c 'printf "[SeatDefaults]\ngreeter-show-manual-login=true\n" > /etc/lightdm/lightdm.conf.d/show-manual-login.conf'
# disable guest login for Ubuntu Desktop
sudo su -c 'printf "[SeatDefaults]\nallow-guest=false\n" > /etc/lightdm/lightdm.conf.d/disable-guest-login.conf'
# hide user list on the Login screen
sudo su -c 'printf "[SeatDefaults]\greeter-hide-users=true\n" > /etc/lightdm/lightdm.conf.d/hide-user-list.conf'
# lock user
sudo passwd -l root
# install and configure openssh server
apt-get update apt-get install openssh-server vi /etc/ssh/sshd_config # PermitRootLogin yes /etc/init.d/ssh restart
# copy files from another machine
rsync -av root@ub14x64s-c1:/root/mysql-tarballs .
# ssh to another server
ssh [usename@]<hostname|ipaddress>
# configure network interface
# /etc/network/interfaces # The loopback network interface auto lo
iface lo inet loopback # The primary network interface auto eth0 eth1 eth2 iface eth0 inet static address 10.0.0.21 netmask 255.255.255.0 gateway 10.0.0.2 dns-search localdomain dns-nameservers 10.0.0.2 iface eth1 inet static address 10.0.1.21 netmask 255.255.255.0 iface eth2 inet manual up ip link set dev $IFACE up down ip link set dev $IFACE down
# install USB wireless network interface
# Tried and True environment: Ubuntu Server 14.04 x64, TL-WN821N Ver 3.0, No Network-Manager and wicd installed. # Use lsusb to view USB device information. Below is an example. #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 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287] #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 001: ID 1d6b:0001 Linux Foundation 1.1 root hub #Bus 003 Device 002: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical #Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub lsusb # Install ndiswrapper apt-get install ndiswrapper-utils-1.9 # Download and install driver # The driver for Windows XP 64bit works well on Ubuntu Server 14.04 64bit. mkdir /tmp/tl-wn821n cd /tmp/tl-wn821n wget http://www.tp-link.com/resources/software/TL-WN821N_V3_110125.zip unzip TL-WN821N_V3_110125.zip cd Driver\ Files/Windows\ XP\ 64bit/ ndiswrapper -i netathuwx.inf # Verify if the installtion succeeds. # If succeeds, the terminal will prompt you with the message below # "netathuwx : driver installed ... device (0CF3:7015) present (alternate driver: ath9k_htc)" ndiswrapper -l # Enable ndiswrapper to be loaded at system startup # by appending ndiswrapper to the end /etc/modules vi /etc/modules # Load ndiswrapper modprobe ndiswrapper ndiswrapper -m # The final step, reboot your system reboot
# configure wireless network interface
# Install wpasupplicant apt-get install wpasupplicant # Generate a conf file that contains wireless network name and password wpa_passphrase "your_wireless_network_name" "your_wireless_network_password" > /etc/wpa.conf # Open /etc/network/interfaces vi /etc/network/interfaces # Edit or add wlan0 settings like below. Below is an example of using static IP address auto wlan0 iface wlan0 inet static address 192.168.0.21 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 192.168.0.1 wpa-conf /etc/wpa.conf # Save the file, and reboot your system reboot
# set Windows 7 to boot as the default
# Edit /etc/default/grub, and change GRUB_DEFAULT like below GRUB_DEFAULT="Windows 7 (/dev/sda1)" # Execute update-grub to update /boot/grub/grug.cfg update-grub # Reboot your system reboot