In cloud-init I took one of the centos VM, while I am creating the VM there is an option called "custom data" in that given one of the sample scripts for testing, I attach the script.
owner: azureuser:azureuser
path: /home/azureuser/myapp/index.js
content: |
var express = require('express')
var app = express()
var os = require('os');
app.get('/', function (req, res) {
res.send('Hello World from host ' + os.hostname() + '!')
})
app.listen(3000, function () {
console.log('Hello world app listening on port 3000!')
})
runcmd:
service nginx restart
cd "/home/azureuser/myapp"
npm init
npm install express -y
nodejs index.js
After deployment of centos VM the "user-data script" is not working, these are logs
I have doubt that when I tested on the ubuntu machine is working fine, but I tried a number of times on centos vms still it is not working, is script issue or centos os is not compatible for cloud-init?
That script in the quickstart is intended for an UbuntuLTS image.
Azure Supports cloud-init for a number of CentOs images. See the list here to ensure your using the correct version for your script. This doc here has good examples for a Centos image.
Hello everyone,
In cloud-init I took one of the centos VM, while I am creating the VM there is an option called "custom data" in that given one of the sample scripts for testing, I attach the script.
just follow this link "
([(https://docs.microsoft.com/en-us/azure/virtual-machines/linux/tutorial-automate-vm-deployment)])
OS:
NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"
kernel : Kernel: Linux 3.10.0-1160.6.1.el7.x86_64
[root@centos-7-cloud-init cloud.cfg.d]# cloud-init --version /bin/cloud-init 19.4
script:
cloud-config
package_upgrade: true packages:
After deployment of centos VM the "user-data script" is not working, these are logs
I have doubt that when I tested on the ubuntu machine is working fine, but I tried a number of times on centos vms still it is not working, is script issue or centos os is not compatible for cloud-init?
Here I attached cloud-init logs cloud-init.log
Thanks,
Bobby.
Edited: Added doc metadata
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.