[solved] How to install centos without GUI on a virtual machine?

Issues related to applications and software problems
Post Reply
Zefengwang
Posts: 7
Joined: 2019/03/20 09:09:40

[solved] How to install centos without GUI on a virtual machine?

Post by Zefengwang » 2019/03/20 09:31:00

Hello everyone!

I have recently encountered a problem, I need to install centos on a computer, after I need to install a virtual machine and install centos again on the macine.

ok, it's easy.

but I need to install them all without GUI, but all of them have it!!!
now I install centos on the computer with GUI and using mini install, it without GUI. its great.
but when I try virtual machine manager, it dependence the GUI lib. ok, fine . when I try to install client machine, it requests x11. so i give it up.

I try vbox, it can create vm (virtual machine) with command line, but when I run it at first with headless argument, I don't what to do next ......

so can you help me?
I need your help!
Last edited by Zefengwang on 2019/03/27 02:17:14, edited 3 times in total.

darthbolek
Posts: 26
Joined: 2019/03/17 11:48:21

Re: How to install centos without GUI on a virtual machine?

Post by darthbolek » 2019/03/20 19:16:17

It is called kickstart installation.

steps:
1. prepare kickstart file
2. make it available to the VM (ex. on USB, or better via ftp server)
3. boot your VM as usual for regular install
4. at boot time specify extra boot parameter: location to kickstart file
5. enjoy install automation

Zefengwang
Posts: 7
Joined: 2019/03/20 09:09:40

Re: How to install centos without GUI on a virtual machine?

Post by Zefengwang » 2019/03/21 02:51:21

Thank you! I will try it!
later I will give you the result!
Thank you again!

-----------------
sorry I have another question? Is there any Virtual Machine software without GUI dependence?
Both Virtual box and Virtual Machine Manager need install GUI lib. I don't need it.

------------------
yesterday I log the centos via Xshell for installing the centos without headless argument, but the vbox asks for x11 request.
so I use Xmanage. But it need authorization. I don't have it.
so I also need a vm without GUI.
Thank you aaaaaaaagain!
------------------

darthbolek
Posts: 26
Joined: 2019/03/17 11:48:21

Re: How to install centos without GUI on a virtual machine?

Post by darthbolek » 2019/03/21 11:38:11

Zefengwang wrote:
2019/03/21 02:51:21
sorry I have another question? Is there any Virtual Machine software without GUI dependence?
KVM+libvirtd

Code: Select all

sudo yum group install "Virtualization Host"
sudo systemctl start libvirtd
Than you can use virsh to manage VMs from CLI

There is also command virt-install (sudo yum install virt-install)

Most likely you will have to configure networking bridges...

darthbolek
Posts: 26
Joined: 2019/03/17 11:48:21

Re: How to install centos without GUI on a virtual machine?

Post by darthbolek » 2019/03/21 14:44:53

darthbolek wrote:
2019/03/20 19:16:17
steps:
1. prepare kickstart file
2. make it available to the VM (ex. on USB, or better via ftp server)
3. boot your VM as usual for regular install
4. at boot time specify extra boot parameter: location to kickstart file
5. enjoy install automation
step 4 implies GUI access... my bad

Alternative:
3. boot custom installation image (with your kickstart file included) (you will have to make it first... :) )
Since you can use any boot image on the CLI, I'd ignore PXE completely - it is simply not required.

Thinking out of the box:
Maybe creating the VM somewhere else (with GUI), and than copying the VM image file to the destination will be faster/easier?

Zefengwang
Posts: 7
Joined: 2019/03/20 09:09:40

Re: How to install centos without GUI on a virtual machine?

Post by Zefengwang » 2019/03/25 11:23:32

darthbolek wrote:
2019/03/21 14:44:53
darthbolek wrote:
2019/03/20 19:16:17
steps:
1. prepare kickstart file
2. make it available to the VM (ex. on USB, or better via ftp server)
3. boot your VM as usual for regular install
4. at boot time specify extra boot parameter: location to kickstart file
5. enjoy install automation
step 4 implies GUI access... my bad

Alternative:
3. boot custom installation image (with your kickstart file included) (you will have to make it first... :) )
Since you can use any boot image on the CLI, I'd ignore PXE completely - it is simply not required.

Thinking out of the box:
Maybe creating the VM somewhere else (with GUI), and than copying the VM image file to the destination will be faster/easier?
Hello! here is a good news!!!
I did it!
(My target machine is centos, but now I try it successfully on Ubuntu. But I think it's the same. I will Try it again)
here is my parameters:

Code: Select all

sudo    virt-install \
        --name zf02 \
        --memory 2048 \
        --vcpus 2 \
        --location /home/zf/vm/iso/CentOS-7-x86_64-DVD-1810.iso \
        --boot menu=on \
        --disk size=10 \
        --network bridge=virbr0 \
        --graphics none \
        --console pty --extra-args 'console=ttyS0' \
        --boot useserial=on \
and the ks.cfg is below:

Code: Select all

#Generated by Kickstart Configurator
#platform=AMD64 or Intel EM64T

#System language
lang en_US
#Language modules to install
langsupport en_US
#System keyboard
keyboard us
#System mouse
mouse
#System timezone
timezone --utc Asia/Shanghai
#Root password
rootpw --iscrypted $1$BsNUJNaX$.O0VZ7vXow7eFUO/CyKEp/
#Initial user
user zf --fullname "zf" --iscrypted --password $1$eE/.AccN$22BDpQC7E6dgQWKRL6FEq0
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use CDROM installation media
cdrom
#System bootloader configuration
bootloader --location=mbr 
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel 
#System authorization infomation
auth  --useshadow  --enablemd5 
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled --trust=eth0 --http --ftp --ssh --telnet --smtp 
#Do not configure the X Window System
skipx
I don't know if the ks file is work, but really I get what I want!
And You Have Help Me a Lot!
Thank You Very Much!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
here is my result!
微信截图_20190326015626.png
微信截图_20190326015626.png (30.04 KiB) Viewed 31580 times
Thank You Again!

------------------------------------------------------------------------------------------------

Now I know the ks.cfg file didn't work ....

I edited it as following:

Code: Select all

#Generated by Kickstart Configurator
#platform=AMD64 or Intel EM64T

#System language
lang en_US
#Language modules to install

#System keyboard
keyboard us
#System mouse
#mouse
#System timezone
timezone --utc Asia/Shanghai
#Root password
rootpw --iscrypted $1$/azyf.KL$Byrb5iWdbJIy882h0XCls0
#Initial user
user zf --name "zf" --iscrypted --password $1$HcXV6Az.$QhoKTFiTGJLHWjEi1IMBi1
#Reboot after installation
reboot
#Use text mode install
text
#Install OS instead of upgrade
install
#Use CDROM installation media
cdrom
#System bootloader configuration
bootloader --location=mbr 
#Clear the Master Boot Record
zerombr
#Partition clearing information
clearpart --all --initlabel 
#Disk partitioning information
part swap --size 2048 --grow --maxsize 2048 
part /boot --fstype ext4 --size 4096 
part /home --fstype ext4 --size 10240 
part / --fstype ext4 --size 4096 
#System authorization infomation
auth  --useshadow  --enablemd5 
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled 
#Do not configure the X Window System
skipx
It works, but the disk status is not good, so the installation will stop.
can you tell me how to config it in kickstart file?

-------------------------------------------------------------------------------------------------------------------
ok. I configured it and it works now.

But I have another problem.
about the net.
my host net ip is 10.110.130.xxx,
my guest net ip is 192.168.122.xxx

I need to access the guest client from another computer addressed 10.110.130.xxx

so……

how to configure it ?


-------------------------------------------------------------
ok I did it

there is nothing left


Thank you very much!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

aks
Posts: 3073
Joined: 2014/09/20 11:22:14

Re: How to install centos without GUI on a virtual machine?

Post by aks » 2019/03/26 19:08:17

Close/Solved?

Zefengwang
Posts: 7
Joined: 2019/03/20 09:09:40

Re: How to install centos without GUI on a virtual machine?

Post by Zefengwang » 2019/03/27 02:03:31

aks wrote:
2019/03/26 19:08:17
Close/Solved?
I would! but I don't know where to set it......
:cry: :cry: :cry:


----------------------------------------------------
just edit the title?

Post Reply