Virtual Appliance¶
How to run PMM Server as a virtual machine.
https://docs.percona.com/percona-monitoring-and-management/setting-up/server/virtual-appliance.html
Summary
- Download and verify the latest OVF file.
- Import it.
- Reconfigure network.
- Start the VM and get IP.
- Log into PMM UI.
- (Optional) Change VM root password.
- (Optional) Set up SSH.
- (Optional) Set up static IP.
Most steps can be done with either a user interface or on the command line, but some steps can only be done in one or the other. Sections are labelled UI for user interface or CLI for command line instructions.
Terminology¶
- Host is the desktop or server machine running the hypervisor.
- Hypervisor is software (e.g. VirtualBox, VMware) that runs the guest OS as a virtual machine.
- Guest is the CentOS virtual machine that runs PMM Server.
OVA file details¶
Item | Value |
---|---|
Download page | https://www.percona.com/downloads/pmm2/2.41.2/ova |
File name | pmm-server-2.41.2.ova |
VM name | PMM2-Server-2024-03-20-N (N =build number) |
VM specifications¶
Component | Value |
---|---|
OS | CentOS 7.9 (64-bit) |
CPU | 1 |
Base memory | 4096 MB |
Disks | LVM, 2 physical volumes |
Disk 1 (sda ) | VMDK (SCSI, 40 GB) |
Disk 2 (sdb ) | VMDK (SCSI, 400 GB) |
Users¶
Default Username | Default password |
---|---|
root | percona |
admin | admin |
Download¶
UI¶
- Open a web browser.
- Visit the PMM Server download page.
- Choose a Version or use the default (the latest).
- Click the link for
pmm-server-2.41.2.ova
to download it. Note where your browser saves it. - Right-click the link for
pmm-server-2.41.2.sha256sum
and save it in the same place as the.ova
file. - (Optional) Verify.
CLI¶
Download the latest PMM Server OVA and checksum files.
wget https://www.percona.com/downloads/pmm2/2.41.2/ova/pmm-server-2.41.2.ova
wget https://www.percona.com/downloads/pmm2/2.41.2/ova/pmm-server-2.41.2.sha256sum
Verify¶
CLI¶
Verify the checksum of the downloaded .ova file.
shasum -ca 256 pmm-server-2.41.2.sha256sum
VMware¶
Import¶
UI¶
- Select File → Import.
- Click Choose file….
- Navigate to the downloaded
.ova
file and select it. - Click Open.
- Click Continue.
In the Save as dialog:
a. (Optional) Change the directory or file name.
b. Click Save.
Choose one of:
- (Optional) Click Finish. This starts the virtual machine.
- (Recommended) Click Customize Settings. This opens the VM’s settings page without starting the machine.
CLI¶
- Install
ovftool
. (You need to register.) Import and convert the OVA file. (
ovftool
can’t change CPU or memory settings during import, but it can set the default interface.)Choose one of:
Download and import the OVA file.
ovftool --name="PMM Server" --net:NAT=Wi-Fi \ https://www.percona.com/downloads/pmm2/2.41.2/ova/pmm-server-2.41.2.ova \ pmm-server-2.41.2.vmx
Import an already-downloaded OVA file.
ovftool --name="PMM Server" --net:NAT=WiFi \ pmm-server-2.41.2.ova \ pmm-server.vmx
Reconfigure interface¶
When using the command line, the interface is remapped during import.
UI¶
- If started, shut down the virtual machine.
- In the VMware main window, select the imported virtual machine.
- Click Virtual Machine → Settings….
- Click Network Adapter.
- In the Bridged Networking section, select Autodetect.
- Close the settings window.
Start guest and get IP address¶
UI¶
- In the VMware main window, select the imported virtual machine.
- Click the play button or select Virtual Machine → Start Up.
- When the instance has been booted, note the IP address in the guest console.
CLI/UI¶
Start the virtual machine in GUI mode. (There’s no way to redirect a VMware VM’s console to the host.)
vmrun -gu root -gp percona start \ pmm-server.vmx gui
When the instance has been booted, note the IP address in the guest console.
(Optional) Stop and restart the instance in headless mode.
vmrun stop pmm-server.vmx vmrun -gu root -gp percona start \ pmm-server.vmx nogui
VirtualBox¶
Import¶
UI¶
- Select File → Import appliance….
- In the File field, type the path to the downloaded
.ova
file, or click the folder icon to navigate and open it. - Click Continue.
- On the Appliance settings page, review the settings and click Import.
- Click Start.
- When the guest has booted, note the IP address in the guest console.
CLI¶
Open a terminal and change the directory to where the downloaded
.ova
file is.(Optional) Do a ‘dry run’ import to see what values will be used.
VBoxManage import pmm-server-2.41.2.ova --dry-run
Import the image. Choose one of:
With the default settings.
VBoxManage import pmm-server-2.41.2.ova
With custom settings (in this example, Name: “PMM Server”, CPUs: 2, RAM: 8192 MB).
VBoxManage import --vsys 0 --vmname "PMM Server" \ --cpus 2 --memory 8192 pmm-server-2.41.2.ova
Interface¶
UI¶
- Click Settings.
- Click Network.
- In the Adapter 1 field, click Attached to and change to Bridged Adapter.
- In the Name field, select your host’s active network interface (e.g.
en0: Wi-Fi (Wireless)
). - Click OK.
CLI¶
Show the list of available bridge interfaces.
VBoxManage list bridgedifs
Find the name of the active interface you want to bridge to (one with Status: Up and a valid IP address). Example:
en0: Wi-Fi (Wireless)
Bridge the virtual machine’s first interface (
nic1
) to the host’sen0
ethernet adapter.VBoxManage modifyvm 'PMM Server' \ --nic1 bridged --bridgeadapter1 'en0: Wi-Fi (Wireless)'
Redirect the console output into a host file.
VBoxManage modifyvm 'PMM Server' \ --uart1 0x3F8 4 --uartmode1 file /tmp/pmm-server-console.log
Get IP¶
UI¶
- Select the PMM Server virtual machine in the list.
- Click Start.
- When the guest has booted, note the IP address in the guest console.
CLI¶
Start the guest.
VBoxManage startvm --type headless 'PMM Server'
(Optional) Watch the log file.
tail -f /tmp/pmm-server-console.log
Wait for one minute for the server to boot up.
Choose one of:
- Read the IP address from the tailed log file.
Extract the IP address from the log file.
grep -e "^IP:" /tmp/pmm-server-console.log | cut -f2 -d' '
(Optional) Stop the guest:
VBoxManage controlvm "PMM Server" poweroff
Log into user interface¶
UI¶
Open a web browser and visit the guest IP address.
The PMM login screen appears.
Enter the default username and password in the relevant fields and click Log in.
username:
admin
password:
admin
(Recommended) Follow the prompts to change the default password.
You also can change the default password through SSH by using the change-admin-password
command.
- The PMM Home Dashboard appears.
(Optional) Change root password¶
UI¶
Start the virtual machine in GUI mode.
Log in with the default superuser credentials:
Username:
root
Password:
percona
Follow the prompts to change the password.
(Optional) Set up SSH¶
UI/CLI¶
Create a key pair for the
admin
user.ssh-keygen -f admin
Log into the PMM user interface.
Select PMM → PMM Settings → SSH Key.
Copy and paste the contents of the
admin.pub
file into the SSH Key field.Click Apply SSH Key. (This copies the public key to
/home/admin/.ssh/authorized_keys
in the guest).Log in via SSH (
N.N.N.N
is the guest IP address).ssh -i admin admin@N.N.N.N
(Optional) Set up static IP¶
When the guest OS starts, it will get an IP address from the hypervisor’s DHCP server. This IP can change each time the guest OS is restarted. Setting a static IP for the guest OS avoids having to check the IP address whenever the guest is restarted.
CLI¶
Start the virtual machine in non-headless (GUI) mode.
Log in as
root
.Edit
/etc/sysconfig/network-scripts/ifcfg-eth0
Change the value of
BOOTPROTO
:BOOTPROTO=none
Add these values:
IPADDR=192.168.1.123 # replace with the desired static IP address NETMASK=255.255.255.0 # replace with the netmask for your IP address GATEWAY=192.168.1.1 # replace with the network gateway for your IP address PEERDNS=no DNS1=192.168.1.53 # replace with your DNS server IP
Restart the interface.
ifdown eth0 && ifup eth0
Check the IP.
8. Preserve the network configuration across reboots.ip addr show eth0
echo "network: {config: disabled}" > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
Remove¶
UI¶
Stop the virtual machine: select Close → Power Off.
Remove the virtual machine: select Remove → Delete all files.
Tidak ada komentar:
Posting Komentar