JSON file using HTTP file server

I have a JSON file and a RHEL kickstart file that I’m trying to access thru HTTP file server on a specific port. All this is on the same server. So when trying to build my server, i"m getting this error:

vsphere-iso: Error finding port: port 8099 cannot be opened: listen tcp 0.0.0.0:8099: bind: address already in use

How can I achieve this?

Could you please do a netstat -pan | grep 8099. It looks like something is already listening on the port.

Yes my HTTP file server is running on the same server…

netstat -pan|grep http
tcp6 0 0 :::8443 :::* LISTEN 19417/httpd
tcp6 0 0 :::8099 :::* LISTEN 19417/httpd
tcp6 0 0 :::80 :::* LISTEN 19417/httpd
unix 3 STREAM CONNECTED 17387164 19417/httpd

I have tried this in the JSON file:

“http_directory”: “http”,
“http_port_min”: “8098”,
“http_port_max”: “8098”,

and this as a boot command:
“boot_command”:[
" Vmlinuz initrd=initrd.img inst.text inst.ks=http://srvcreation02.dlgl.net:8099/KS/ghi-ks.cfg ",
“i”
]

and getting : no such file or directory.

If I open a browser to http://srvcreation02.dlgl.net:8099/KS , I have access to the file…

You misunderstood the http feature. If you define the http_directory packer will spawn its own http server listen on the defined port und providing the files in the directory defined in http_directory.

But I have no glue why Packer shouldn’t find the file on your already running server. Access control problems?

Here is part of the JSON file:
“http_directory”: “KS”

“boot_command”:[
" Vmlinuz initrd=initrd.img inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/KS/ghi-ks.cfg ",
“i”

The KS directory is in the same directory from where I’m starting packer build… So what di I miss? Thx

forgot this.:

vsphere-iso: output will be in this color.

==> vsphere-iso: Creating VM…
==> vsphere-iso: Customizing hardware…
==> vsphere-iso: Mounting ISO images…
==> vsphere-iso: Starting HTTP server on port 8900
==> vsphere-iso: Set boot order…
==> vsphere-iso: Power on VM…
==> vsphere-iso: Waiting 10s for boot…
==> vsphere-iso: HTTP server is working at http://10.94.17.85:8951/
==> vsphere-iso: Typing boot command…
==> vsphere-iso: Waiting for IP…
Cancelling build after receiving interrupt
==> vsphere-iso: Power off VM…
==> vsphere-iso: Destroying VM…
Build ‘vsphere-iso’ finished.
Cleanly cancelled builds after being interrupted.

When removing the HTTP_DIRECTORY, it’s using my HTTP file server which is running on the same server that PACKER is installed. If I manually create my VM in VMware, break the boot sequence and spycify “inst.ks=http://10.94.17.85/KS/ghi-ks.cfg” in the boot sequence, I’m able to install RHEL 8.2 correctly. But if I specify the same command in my JSON file, I keep getting “file or directory not found”. So I must be missing something…

Thanks for your help.