如何安裝 VMware Tools on Debian, Ubuntu and CentOS with Command Line

Today we use virtualization for both development, testing and also production. One of the most popular virtualization solution is VMware. There are many products that we can use for free such as VMware Playeror VMware vSphere Hypervisor (ESXi).

If you want Guest OS to be fully working in VMware products, you must install VMware Tools that will give better virtualization support such as you can move mouse better without have to press Ctrl + Alt to get out from Guest OS. Or in Linux Server that don't have GUI, Host OS can read or change some value from Guest OS such as IP Address.

Install VMware Tools on Windows OS will be very easy as install normal software. But this article will help you to install VMware Tools on Linux Server that have only CLI for you. In principle you must have compiler and linux headers so you can go smooth with installing VMware Tools.

置放 VMware Tools 光碟

This step will be the same for Debian, Ubuntu and CentOS

If you use VMware Workstation go to VM > Install VMware Tools...

/system/files/vmware-tools/vmware-tools-01.png

如果你使用 VMware vSphere Hypervisor (ESXi) go to VM > Guest > Install/Upgrade VMware Tools

/system/files/vmware-tools/vmware-tools-02.png

安裝 VMware Tools on Debian

We must log in with root user. It is better if we start with update all the software in system first then reboot one time.

apt-get update && apt-get dist-upgrade
shutdown -r now

Install compiler and Linux Header with command

apt-get update && apt-get install build-essential linux-headers-$(uname -r) libglib2.0-0

Mount VMware Tools disc and extract file

mount /dev/cdrom /mnt
tar xvfz /mnt/VMwareTools-*.tar.gz -C /tmp/

Start installing VMware Tools with command

perl /tmp/vmware-tools-distrib/vmware-install.pl

Then press Enter to all the questions to use all default answer. Then reboot again and it will be done.

shutdown -r now

安裝 VMware Tools on Ubuntu

We must log in with user that has sudo privilege. It is better if we start with update all the software in system first then reboot one time.

sudo apt-get update && sudo apt-get dist-upgrade
sudo shutdown -r now

Install compiler and Linux Header with command

sudo apt-get update && sudo apt-get install build-essential linux-headers-$(uname -r)

Mount VMware Tools disc and extract file

sudo mount /dev/cdrom /mnt
sudo tar xvfz /mnt/VMwareTools-*.tar.gz -C /tmp/

Start installing VMware Tools with command

sudo perl /tmp/vmware-tools-distrib/vmware-install.pl

Then press Enter to all the questions to use all default answer. Then reboot again and it will be done.

sudo shutdown -r now

安裝 VMware Tools on CentOS

We must log in with root user. It is better if we start with update all the software in system first then reboot one time.

yum update
shutdown -r now

Install compiler and Linux Header with command

yum install gcc perl

Mount VMware Tools disc and extract file

mount /dev/cdrom /mnt
tar xvfz /mnt/VMwareTools-*.tar.gz -C /tmp/

Start installing VMware Tools with command

perl /tmp/vmware-tools-distrib/vmware-install.pl

Then press Enter to all the questions to use all default answer. Then reboot again and it will be done.

shutdown -r now

Xenserver 的那些事

1.用命令列設定 VM 記憶體
xe vm-memory-limits-set uuid="UUID of your VM" static-min=1073741824 dynamic-min=1073741824 dynamic-max=1073741824 static-max=1073741824

2.新增一顆空白硬碟
# ll /dev/disk/by-id
#
xe sr-create content-type=user device-config:device=/dev/disk/by-id/scsi-SATA_QEMU_HARDDISK_QM00002 host-uuid=984d9af1-9924-4a66-a535-a3819e1e1341 name-label="Local storage 2" shared=false type=ext

3.自動啟動VM

MySQL-MariaDB遠端存取操作流程

輸入指令(讓使用者從任何主機連接到mysql or MariaDB伺服器)

mysql -u root -p"youpassword" 

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
MySql 8.0==================================================
回復傳統密碼規則
[mysqld]
default-authentication-plugin=mysql_native_password

CREATE USER 'admin3'@'%' IDENTIFIED BY 'password';
GRANT ALL ON *.* TO 'admin3'@'%';
FLUSH PRIVILEGES;
每行結尾為[;]分號
這樣就能遠端連線了。
[註]有時候必須先修改 root 密碼
#ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
啟動日誌檔=================================================
https://www.jianshu.com/p/db19a1d384bc

 

Xenserver添加存在資料的第二顆硬碟

  • Do a pvscan to get the Universally Unique Identifier (UUID) of an existing SR on a local disk. This example uses UUID 39baf126-a535-549f-58d6-feeda55f7801:# pvscan
    PV /dev/sda3 VG VG_XenStorage-39baf126-a535-549f-58d6-feeda55f7801 lvm2 [66.87 GB / 57.87 GB free]
    Total: 1 [66.87 GB] / in use: 1 [66.87 GB] / in no VG: 0 [0 ]
  • Note the output above, the VG name of the local drive /dev/sda3 is VG_XenStorage-39baf126-a535-549f-58d6-feeda55f7801 . The VG name contains the SR UUID that resides on this storage media. In this case, the UUID is 39baf126-a535-549f-58d6-feeda55f7801.
  • Introduce the SR with the following command:# xe sr-introduce uuid=39baf126-a535-549f-58d6-feeda55f7801 type=ext name-label=”Local storage” content-type=user
    This command sets up database records for the SR named “Local storage”.
  • Locate the SCSI ID of the device or partition where the SR data is stored:
    # ls -l /dev/disk/by-id/

    total 0
    lrwxrwxrwx 1 root root 9 Jan 15 09:44 scsi-SATA_ST3500320AS_9QM13WP2 -> ../../sdb
    lrwxrwxrwx 1 root root 10 Jan 15 09:44 scsi-SATA_ST3500320AS_9QM13WP2-part1 -> ../../sdb1
    lrwxrwxrwx 1 root root 9 Jan 15 09:44 scsi-SATA_ST380815AS_6QZ5Z1AM -> ../../sda
    lrwxrwxrwx 1 root root 10 Jan 15 09:44 scsi-SATA_ST380815AS_6QZ5Z1AM-part1 -> ../../sda1
    lrwxrwxrwx 1 root root 10 Jan 15 09:44 scsi-SATA_ST380815AS_6QZ5Z1AM-part2 -> ../../sda2
    lrwxrwxrwx 1 root root 10 Jan 15 09:44 scsi-SATA_ST380815AS_6QZ5Z1AM-part3 -> ../../sda3

    In this case, the SCSI ID of the device /dev/sda3 is scsi-SATA_ST380815AS_6QZ5Z1AM-part3. This is the device name to use in the next command, where a PBD (physical block device – a connector between the XenServer host and the SR) is created.

  • Run the xe host-list command to find out the host UUID for the local host:
    # xe host-list

    uuid ( RO) : 83f2c775-57fc-457b-9f98-2b9b0a7dbcb5
    name-label ( RW): xenserver1
    name-description ( RO): Default install of XenServer
  • Create the PBD using the device SCSI ID, host UUID and SR UUID detected above:
    # xe pbd-create sr-uuid=39baf126-a535-549f-58d6-feeda55f7801
    device-config:device=/dev/disk/by-id/scsi-SATA_ST380815AS_6QZ5Z1AM-part3 host-uuid=83f2c775-57fc-457b-9f98-2b9b0a7dbcb5
    aec2c6fc-e1fb-0a27-2437-9862cffe213e
  • Attach the PBD created with xe pbd-plug command:
    # xe pbd-plug uuid=aec2c6fc-e1fb-0a27-2437-9862cffe213e
    The SR should be connected to the XenServer host and be visible in XenCenter.