CentOS 7 och MariaDB 10

Posted by Håkan Stensby in cname | Kommentarer inaktiverade för CentOS 7 och MariaDB 10

Efter lite stök och bök har CentOS7 anlänt som webserver och även databasserver med CentOS7 och MariaDB 10.

Det är lite omställning från gamla CentOS/RHEL med att använda systemd och firewalld, innan man fått kläm på inställningar.
Med PHP 5.4, Apache 2.4 och MariaDB 10 blev det en utmaning att få ihop det, av de äldre versionerna kan man göra det i sömnen nästan, men bara att gå ifrån att göra ”service httpd restart” till ”systemctl restart httpd” sitter en bit in 🙂
Numera rekommenderar RHEL att använda Open-VM-Tools istället för sin egen vmware-tools, bara det liksom!
Man vänjer sig dock snabbt och det är ändå väldigt mycket mer lättarbetat när man väl får kläm på det.
Det är ungefär som vmware’s webgui, är man van med tjockklienten är det svårt att gå över, men när man väl gjort det är det ingen återvändå, betydligt mer logiskt och lättarbetat (dock lite trögt än så länge).

Vissa webbar har flyttats till nya platformen och vill man ha senare PHP/SQL får man kontakta supporten.

Trevlig helg därute!

VMWare move from old VC to new VC

Posted by Håkan Stensby in cname | Kommentarer inaktiverade för VMWare move from old VC to new VC

In the process of moving from an old vCenter to a new vCenter (same storage) you might need consider some things

  • What do you want to do and when?
  • Commit snapshots? (consolidate disks)
  • Remove floppys?
  • Remove from old vCenter
  • Add to new vCenter
  • Add hardware?
  • Add hotplug cpu/mem?
  • Snapshot before upgrade virtual hardware?
  • Hardware upgrade?
  • New network name?
  • Upgrade vmware tools (reboot?) ?

 

Scripts to help with this, both on the way down and up so it will be made exactly the same every time and dont do anything else than what is set out to do. Im not used to powershell so bare with me.

What if we have vm appliances with very old hardware versions? should those get upgraded directly or does it need more digging to see if its supported? In this version its not yet considered and if we have a CSV file with alot of vm’s we can migrate/move all these vms at once but in doing so you have little control over whats happening in your vCenter environment, letting this beast loose on 100+ vms might be bad for you hart.

 

<# 
.Synopsis 
 Move to new VC, deregister
.DESCRIPTION 
 Remove ISO files to CD
 Shutdown a vm
 Remove floppy
 Consolidate disks
 Deregister VM
 
.EXAMPLE 
 Enable-VMHotAdd -VM MyVM -Device CPU 
.EXAMPLE 
 $vm = "MyVM"
 $vm | vcold.ps1
.EXAMPLE 
 $vmlist = "MyVM1","MyVM2","MyVM3"
 $vmlist | % { Enable-VMHotAdd -VM $_ -Device CPU }
.REMARKS 
 VM's need to register in the new VC with vcnew script
#> 
# See to that only 1 input is made

[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string] $vm = $null
)
# Functions
function disconect_vm_cdrom ()
 {
 Get-VM $vm | Get-CDDrive | Where {$_.ConnectionState.Connected} | Set-CDDrive -Connected $false -Confirm:$false
 }
 
# Power off VM
Write-Host -foregroundcolor yellow "Shutdown-VMGuest -VM $vm -Confirm:$false"
Shutdown-VMGuest -VM $vm -Confirm:$false
#Wait for Shutdown to complete
 do {
 #Wait 5 seconds
 Write-Host -foregroundcolor yellow "waiting 5 seconds to check powerstate"
 Start-Sleep -s 5
 #Check the power status
 $MyVM = Get-VM -Name $vm
 $status = $MyVM.PowerState
 }until($status -eq "PoweredOff")
Write-Host -foregroundcolor yellow "powerstate is PoweredOff"
# remove floppy
Write-Host -foregroundcolor yellow "get-vm $vm | Get-FloppyDrive | Remove-FloppyDrive -Confirm:$false"
get-vm $vm | Get-FloppyDrive | Remove-FloppyDrive -Confirm:$false

Write-Host -foregroundcolor yellow "disconect_vm_cdrom $vm"
disconect_vm_cdrom $vm

# Consolidate disks ?
Write-Host -foregroundcolor yellow "ConsolidateVMDisks"
(Get-VM -Name "$vm").ExtensionData.ConsolidateVMDisks()

# before deregister, show VMX filepath and NetworkName
Write-Host -foregroundcolor yellow "Get VMX Filepath for $vm"
Get-VM -Name $vm | Get-View | %{$_.Config.Files.VmPathName}
Write-Host -foregroundcolor yellow "Show network name"
Get-VirtualPortGroup -VM $vm|select Name
# Deregister VM from VC OLD
Write-Host -foregroundcolor yellow "Removing from inventory: Remove-Inventory -Item $vm -Confirm:$false"
Remove-Inventory -Item $vm -Confirm:$false

Register and do some stuff into the new vCenter

<# 
.Synopsis 
 Register VM's from VCOLD.PS1
.DESCRIPTION 
 Register VM from DS
 Snapshot (in case of restore)
 HW Upgrade v10 if old hw version is 8 or newer
 power on
 vmware tools upgrade
 reboot
 
.EXAMPLE 
 Enable-VMHotAdd -VM MyVM -Device CPU 
.EXAMPLE 
 $vm = "MyVM"
 $vm | vcold.ps1
.EXAMPLE 
 $vmlist = "MyVM1","MyVM2","MyVM3"
 $vmlist | % { Enable-VMHotAdd -VM $_ -Device CPU }
.REMARKS 
 VM's need to register in the new VC with vcnew script
#> 
# Se to that correctinput is made
param (
 [string]$ESXHost = $( Read-Host "Input ESXHost, please" ),
 [string]$VMXFile = $( Read-Host "Input VMXFile, please" ),
 [string]$Network = $( Read-Host "Input Network, please" ),
 [switch]$force = $false
 )
# register VM with DISKPATH
Write-Host -foregroundcolor yellow "New-VM -VMFilePath $VMXFile -VMHost $ESXHost -NetworkName $Network"
New-VM -VMFilePath $VMXFile -VMHost $ESXHost -NetworkName $Network
# Take a snapshot on the VM
New-Snapshot -Name "Beforev10" -VM $vm -Confirm:$false

# Hardwareversion upgrade 
Write-Host -foregroundcolor yellow "set-vm -Version v10 $vm -Confirm:$false"
set-vm -Version v10 $vm -Confirm:$false

# Power On and wait a while
Write-Host -foregroundcolor yellow "Start-VM -VM $vm -Confirm:$false"
Start-VM -VM $vm -Confirm:$false
#Wait for Shutdown to complete
 do {
 #Wait 5 seconds
 echo "waiting 40 seconds to check powerstate"
 Start-Sleep -s 40
 #Check the power status
 $MyVM = Get-VM -Name $vm
 $status = $MyVM.PowerState
 }until($status -eq "PoweredOn")
echo "powerstate is PoweredOn"

# Upgrade vmware tools 
Write-Host -foregroundcolor yellow "Mount-Tools -VM $vm"
Mount-Tools -VM $vm
Write-Host -foregroundcolor yellow "Update-Tools -VM $vm -NoReboot"
Update-Tools -VM $vm -NoReboot
Write-Host -foregroundcolor yellow "Dismount-Tools -VM $vm"
Dismount-Tools -VM $vm

 

AIRCAM NO SSL SNAPSHOT NOTES

Posted by Håkan Stensby in cname | Kommentarer inaktiverade för AIRCAM NO SSL SNAPSHOT NOTES

Logon to aircam, /tmp/system.cfg (use ubnt_system_cfg etc)

httpd.https.port=443
httpd.https.status=0
httpd.snapshot.status=1
httpd.snapshot.status=enable
httpd.status=1

http://<CAM_IP>/snapshot.cgi?chan=0 – 1280 (w) x 720 (h)
http://<CAM_IP>/snapshot.cgi?chan=1 – 640 (w) x 368 (h)
http://<CAM_IP>/snapshot.cgi?chan=2 – 320 (w) x 176 (h)
http://<CAM_IP>/snapshot.cgi?chan=3 – 160 (w) x 96 (h)

http://192.168.2.215/snapshot.cgi?chan=0

http://IPADDRESS:554/snapshot.cgi?user=[USERNAME]&pwd=[PASSWORD]&count=0

http://192.168.2.215:554/snapshot.cgi?user=ubnt&pwd=ubnt

ubnt_system_cfg flash httpd.snapshot.status enable
ubnt_system_cfg flash httpd.http.port=80 enable