These are some common commands I use to set up a new physical or virtual machine.
Allow user to execute sudo without password
echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/dont-prompt-$USER-for-sudo-password
Install ssh
sudo apt install ssh
Copy ssh key to another machine
ssh-copy-id -i ~/.ssh/mykey user@host
Install Nomachine
wget https://download.nomachine.com/download/7.7/Linux/nomachine_7.7.4_1_amd64.deb
sudo dpkg -i nomachine_7.7.4_1_amd64.deb
For arm64, the link is
https://download.nomachine.com/download/7.9/Arm/nomachine_7.9.2_1_arm64.deb
Install QEMU guest agent
sudo apt -y install qemu-guest-agent.
sudo systemctl enable qemu-guest-agent
sudo systemctl enable qemu-guest-agent
sudo systemctl start qemu-guest-agent
To test connection speed, install iperf (sudo apt install iperf), then run
iperf -s
on one machine and
iperf -c 192.168.x.x
on another machine.
To enable auto login on Windows 10, run this command as an administrator
reg ADD “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PasswordLess\Device” /v DevicePasswordLessBuildVersion /t REG_DWORD /d 0 /f
then run
netplwiz
and uncheck "Users must enter a user name and password".
If there is a need to set the service tag, this can be done by, for example,
smbios-sys-info --service-tag --set=9QYZF42
If need be, install smbios-utils using
apt install smbios-utils
first.
To transfer Windows OEM license to a VM: (from this reddit post)
This will link the license to the motherboard UUID. And you can transfer it from VM to VM in the future. I suppose you could possibility link it to a made up UUID, although there maybe a checksum or some other security in place?
1. Use to find the motherboard UUID, sudo dmidecode
2. Copy the physical UUID into VM XML file. Example,
<uuid>8bc28570-e584-0000-0000-000000000000</uuid>
1. Use to find the motherboard UUID, sudo dmidecode
2. Copy the physical UUID into VM XML file. Example,
<uuid>8bc28570-e584-0000-0000-000000000000</uuid>
Another method, from superuser.com:
On the Ubuntu host, type this command:
sudo strings /sys/firmware/acpi/tables/MSDM
This will print out a few lines, the last line being the activation key contained in the laptop's firmware:
MSDMU
LENOVOTP-N11
PTEC
#####-#####-#####-#####-#####
Within the Windows guest:
1. Click the search loop.
2. Type activation.
3. Click the Activation settings item that appears.
4. Click the Change product key button.
5. Enter the activation key obtained from Ubuntu command above.
6. Click Activate.
sudo strings /sys/firmware/acpi/tables/MSDM
This will print out a few lines, the last line being the activation key contained in the laptop's firmware:
MSDMU
LENOVOTP-N11
PTEC
#####-#####-#####-#####-#####
Within the Windows guest:
1. Click the search loop.
2. Type activation.
3. Click the Activation settings item that appears.
4. Click the Change product key button.
5. Enter the activation key obtained from Ubuntu command above.
6. Click Activate.
The original product key can also be viewed in Command Prompt using:
wmic path softwarelicensingservice get OA3xOriginalProductKey
To get the UUID of the motherboard using Windows, run in Command Prompt:
wmic csproduct get UUID
Of course, another way is to use Microsoft support and see if they can help with the transfer.
For a laptop, to prevent Linux from going to sleep when the lid is closed (from here) and switch off the screen after 5 minutes (another good reference is here):
1. Edit /etc/systemd/logind.conf.
Add in the following 2 lines in the file:
Add in the following 2 lines in the file:
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore
HandleLidSwitchDocked=ignore
2. Restart the service by typing the following:
systemctl restart systemd-logind.service
3. Edit /etc/default/grub. Change the following line to read:
GRUB_CMDLINE_LINUX="consoleblank=300"
The “300” is the number of seconds before the screen goes to sleep.
4. Then restart so that it sets it in place by typing:
4. Then restart so that it sets it in place by typing:
update-grub
Good to have programs installed on the host:
sudo apt install -y ifupdown2 bmon iftop tmux mc htop
Note: This post is really a note to self and will be updated as and when necessary.
No comments:
Post a Comment