mangento 2 admin page redirect too many times error
The magento store was running fine after I initially configured, I can go to the backend and change the configurations with SSL on.
Suddenly when I tried to access the backend again later, it showed me this error on firefox, it showed the similar error on chrome also

The solution is configure the secure/use_in_adminhtml to 1,
SELECT * FROM core_config_data where path like '%web/secure/use_in_adminhtml%';
If no entry is returned, it just means the configuration is not set.
Then do
INSERT INTO core_config_data (scope,scope_id,path,value) VALUES ('default',0,'web/secure/use_in_adminhtml',1)
Clear the cache
php bin/magento cache:flush
After that, everything is working again.
virsh console ubuntu 18 container and frozen
I tried to install ubuntu 18.04 container on the centos 7 host
qemu-img create -f raw /data/pools/ubuntu1804.img 50G
make sure download the iso file to /data/images folder ubuntu-18.04.2-server-amd64.iso
virt-install \
--name ubuntu1804 \
--ram 4096 \
--disk path=/data/pools/ubuntu1804.img,size=20,bus=virtio \
--vcpus 2 \
--os-type linux \
--os-variant ubuntu18.04 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location '/data/images/ubuntu-18.04.2-server-amd64.iso' \
--extra-args 'console=ttyS0,115200n8 serial' \
--force --debug
after finishing all the process, when i tried virsh console ubuntu1804, it is frozen, googled and tried a lot of different options, finally this one worked
sudo apt install libguestfs-tools
sudo virt-edit -d ubuntu1804 /boot/grub/grub.cfg
Replace all instances of quiet
with quiet console=ttyS0
in the grub.cfg file and start my VM for console connect. then try to start the container and login again
virsh start ubuntu1804
virsh console ubuntu1804
after login, make sure update the grub
vi /etc/default/grub
change GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” to GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash console=ttyS0″, then
sudo update-grub
How to Enable or Disable Services in Ubuntu Systemd/Upstart
Often, there is a need to enable or disable services temporarily or permanently on our Ubuntu system. Sometimes, we may require certain services to start up automatically on boot up e.g ssh or web servers and sometimes we may need to disable services we no longer require and are hogging the CPU and RAM.
In this article, we take a look at how we can enable and disable services on Ubuntu.
To do this, we must first understand that there are 3 main init systems for Ubuntu
- Systemd
- Upstart
- SysV
Each init system has a different way of starting and stopping services. We’ll take a look at each one of these.
How to enable and disable services in Systemd init
To start a service in systemd run the command as shown:
systemctl start service-name
For example, to start apache web service, run
systemctl start apache2
To verify that the service is running, run
systemctl status apache2
Output
● apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: active (running) since Thu 2018-03-15 17:09:05 UTC; 35s ago Docs: man:systemd-sysv-generator(8) CGroup: /system.slice/apache2.service ├─2499 /usr/sbin/apache2 -k start ├─2502 /usr/sbin/apache2 -k start └─2503 /usr/sbin/apache2 -k start Mar 15 17:09:04 ip-172-31-41-251 systemd[1]: Starting LSB: Apache2 web server... Mar 15 17:09:04 ip-172-31-41-251 apache2[2475]: * Starting Apache httpd web ser Mar 15 17:09:05 ip-172-31-41-251 apache2[2475]: * Mar 15 17:09:05 ip-172-31-41-251 systemd[1]: Started LSB: Apache2 web server.
To stop the service running service
systemctl stop apache2
To confirm that the service is not running, run
systemctl status apache2
Output
● apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled) Drop-In: /lib/systemd/system/apache2.service.d └─apache2-systemd.conf Active: inactive (dead) since Thu 2018-03-15 17:19:47 UTC; 12s ago Docs: man:systemd-sysv-generator(8) Process: 2822 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS Process: 2687 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCE Mar 15 17:10:11 ip-172-31-41-251 systemd[1]: Starting LSB: Apache2 web server... Mar 15 17:10:11 ip-172-31-41-251 apache2[2687]: * Starting Apache httpd web ser Mar 15 17:10:12 ip-172-31-41-251 apache2[2687]: * Mar 15 17:10:12 ip-172-31-41-251 systemd[1]: Started LSB: Apache2 web server. Mar 15 17:19:46 ip-172-31-41-251 systemd[1]: Stopping LSB: Apache2 web server... Mar 15 17:19:46 ip-172-31-41-251 apache2[2822]: * Stopping Apache httpd web ser Mar 15 17:19:47 ip-172-31-41-251 apache2[2822]: * Mar 15 17:19:47 ip-172-31-41-251 systemd[1]: Stopped LSB: Apache2 web server.
To enable apache2 service on boot up run
systemctl enable apache2
To disable apache2 service on boot up run
systemctl disable apache2
To restart the service
systemctl restart apache2
To check whether the service is currently configured to start on the next boot up
systemctl is-enabled apache2
Output
Executing /lib/systemd/systemd-sysv-install is-enabled apache2 enabled
To check whether the service is active
systemctl is-active apache2
Output
active
How to remove Systemd services completely
What if you installed a package, and later on decide that you don’t
need it anymore. How do you go about removing it completely ? Follow the
commands below.
First, stop the service
systemctl stop service-name
Then disable the service
systemctl disable service-name
Removing the service in systemd
rm /etc/systemd/system/service-name
rm /etc/systemd/system/service-name/[related symlinks]
Reload systemd
systemctl daemon-reload
Finally run,
systemctl reset-failed
How to enable and disable services in Upstart init
Upstart init system was unveiled just before systemd It was used in Ubuntu 9.10 to Ubuntu 14.10. It ws later phased out paving way for systemd init in Ubuntu 15.04 and newer versions. In this example, let’s see how we can start and stop, enable and disable services in Ubuntu 14.04.
Upstart makes use of config files for controlling services.These files are held under the /etc/init directory. These files are made up of plain text sections organized in stanzas and each stanza describes a service and how it works.
To check whether a service is running or not run the command below
initctl status service-name
OR
service service-name status
OR
status service-name
In this example, we’ll check the status of cups, a Linux print server.
initctl status cups
OR
service cups status
OR
status cups
Output
cups start/running, process 3029
To stop the service run the command below
initctl stop cups
OR
service cups stop
OR
stop cups
Output
cups stop/waiting
To enable a service in Upstart init
In /etc/init/*.conf file, you’ll find the “respawn”
directive which jump-starts a service should it crash unexpectedly or
should the system reboot. Its normally enabled by default.
For example , in /etc/init/cups.conf file below,

the first argument (3) is the number of attempts it will try to restart and the second argument (12) is the time interval between retries. If it fails to restart automictically. it will be kept in a stopped state.
To disable a service in upstart init
run the command below
echo manual >> /etc/init/service.override
This creates an override file that disables a service without altering the job definition at all.
For cups service, the command will be
echo manual >> /etc/init/cups.override
Upon a reboot of the system, cups will be in a stopped state. If you wish to re-enable the service, you must delete the /etc/init/cups.override file.
Sysv-rc-conf tool
This is a text-based console that gives you an overview of different service and runlevels they are scheduled to start.
It can be installed using the following command
apt-get install sysv-rc-conf
To execute the tool, run
sysv-rc-conf

Jobs-Admin tool
This is another feature that allows you to control services and processes in a GUI environment
You can install this by running.
apt-get install jobs-admin

How to enable and disable services in SysV init
To enable a service in SysV init run
update-rc.d enable service-name
For instance, If you want to enable apache web server, you would run
update-rc.d enable apache2
To disable a service , run
update-rc.d disable service-name
For example
update-rc.d disable apache2
Nearly all Linux systems run on Systemd init From Ubuntu, Debian, RHEL, and CentOS. You’ll, therefore, discover that you’ll be using more of the systemctl command to start, stop, enable and disable services. We welcome you to try out the commands as shown in this article. Thank you.
systemctl: command not found
First you need to check if systemd package is installed – sudo dpkg -l | grep systemd
.
If not then install it by hands sudo apt-get install systemd
. But if it does it might be damaged, so you may try to reinstall it sudo apt-get install --reinstall systemd
.
If the package is installed, even after reinstallation it does not work, list the full path of the files inside this package sudo dpkg -L systemd
. Maybe binary files are located in a directory that is not included into $PATH variable
common used docker commands, list all, remove all containers, delete all images
To list all containers by container ID
docker ps -aq
stop all running containers
docker stop $(docker ps -aq)
To remove all containers
docker rm $(docker ps -aq)
To remove all imagees
docker rmi $(docker images -aq)
You might encounter this error
Error response from daemon: conflict: unable to delete 5e7a80b3348c (must be forced) – image is referenced in multiple repositories
Error response from daemon: conflict: unable to delete 5e7a80b3348c (must be forced) – image is referenced in multiple repositories
docker rmi $(docker images -q) --force
Background information:
You can see the containers on your computer using
- docker container ls
Example output:
- CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- 3477a4dcdce2 docker.elastic.co/elasticsearch/elasticsearch-oss:6.7.1 “/usr/local/bin/dock…” 2 days ago Up 2 days 0.0.0.0:9200->9200/tcp, 9300/tcp elasticsearch1
- 67997f002f15 appbaseio/dejavu “http-server ‘-p 135…” 2 days ago Up 2 days 0.0.0.0:1358->1358/tcp dejavu
As we can see, two containers are currently running on this computer.
For each container, the IMAGE
column shows us which image the container is running. For example, the second container is running on the appbaseio/dejavu
image.
When we tell docker to show us all images currently listed on the computer:
- $ docker image ls -a
- REPOSITORY TAG IMAGE ID CREATED SIZE
- <none> <none> 39ac507bd271 11 days ago 962MB
- <none> <none> 6a2c829a5d4f 11 days ago 962MB
- docker.elastic.co/elasticsearch/elasticsearch-oss 6.7.1 c91b419ac445 3 weeks ago 682MB
- pypy 3 75e018538e96 4 weeks ago 962MB
- node 10 64c810caf95a 4 weeks ago 899MB
- appbaseio/dejavu latest 47b8375dc541 2 months ago 141MB
- risingstack/alpine 3.4-v4.4.4-3.6.1 2d384efd00ab 2 years ago 247MB
We can immediately see that there are way more images than containers
There are four main reasons for that:
- Docker keeps old versions of containers, they are not automatically deleted. In this example, there are two versions of
docker.elastic.co/elasticsearch/elasticsearch-oss
: Version6.7.1
and version7.0.0
even though I’m currently only using version6.7.1
. According to the list, version7.0.0
takes up an additional 682 Megabytes of space on my SSD but note that this number may not be accurate (see layered images below) - Docker does not automatically delete images that you no longer use (e.g. if you used a an image just for a quick test but don’t use it any more)
- Docker uses layered images. This means that an image like
appbaseio/dejavu
is not standalone but is (usually) based on some underlying image likeubuntu
ordebian
. In most cases there are many layers (typically around 5-10) of an image due to the way they are built. While this leads to less disk space being consumed since some images are used by multiple “daughter” images, this still leads to a lot of images laying around on your drive, often including unused intermediary images. - In case you build docker images yourself, especially in case you are creating your own Dockerfile, during development often a lot of images are generated (representing intermediary versions of the software you are developing)
In order to delete an image that you no longer need, use the docker image rm <image ID>
command. Copy the image ID from the IMAGE ID
column of the output of docker image ls
as shown above.
For example, in order to delete the version 7.0.0
image of elasticsearch, use
- $ docker image rm 0e92b9e5fe1e
- Untagged: docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.0
- Untagged: docker.elastic.co/elasticsearch/[email protected]:e9ab1f4c2ffbc7054dab91e8dc7fd9a56d53cce734098910d876eb14849b1ba3
- Deleted: sha256:0e92b9e5fe1e0949f5174ed86d9cbc3c2a041df493453f82b6c044ff78c7d17b
- Deleted: sha256:c2a552806b86aba72a6e6ea5efaaa295286e8b0cf42a14d799428e58f20e7090
- Deleted: sha256:71e7a706f7c03f0c7add24844f7b311edf83838ef383a877bcb94684b011893d
- Deleted: sha256:d43e5d351c26273e43b11f6937cb9a3192d856b4e083acfbc14b8500056221f2
- Deleted: sha256:f3a2ae77ca96f2f55300b00beedbf14ade0a27bf29c395dcbf84b5bf02ef80ad
- Deleted: sha256:5d7f2d83e59c0684b4a94ab5f6479d798444bdca8fe6c813f7ef6188cdd12ce5
- Deleted: sha256:cc16decd0c6f218c3a21749e747d43deced9e8929e8db0b6050dd4102301651a
As you can see from the output, this will not only delete the ElasticSearch image 0e92b9e5fe1e
itself but also all the other images that image depended on (which are not also used by any other image).
upgrade ubuntu 14.04 to latest 18.04
You’ll first need to make sure update-manager-core is present (it may already be installed):
sudo apt-get install update-manager-core
Next, run:
sudo do-release-upgrade
You may need to check /etc/update-manager/release-upgrades
and change the line:
Prompt=lts
to:
Prompt=normal
how to enable certbot wildcard on centos 7
certbbot definitely is a great FREE service.
There are 2 options to install the wildcard, one with Docker and one manual install. Of course we’ll use manual install as the Docker install will create the certificates inside the Docker image and it will be very difficult for us to use.
1. First, Let’s get the certbot-auto
wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto
certbot-auto
accepts the same flags as certbot
; it installs all of its own dependencies and updates the client code automatically.
2. Then the command to use the manual plugin will look something like this:
./certbot-auto certonly --manual -d *.charliexiong.com -d charliexiong.com --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory
I saved this to a file like certbot-charliexiong.com-run
chmod a+x certbot-charliexiong.com-run
3. run the command
./certbot-charliexiong.com-run
It will try to install the needed packages
Then it will ask for needed information



After all these, you’ll need to create a TXT record with the name and value provided from the output.
Wait for a few minutes for the TXT record to be live, then enter.
That’s it, the wildcard certificates are available under /etc/letsencrypt folder
how to fix gitlab ce migration empty repository error
Recently I needed to migrate the gitlab from one server to another one, followed the step to install gitlab community edition on my new server. I used Omnibus, it is much easier to maintain on the centos.
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
after installed and reconfigured the gitlab, I tried to restore the back file and configuration folder.
Then I use git pull to test the repository, everything seems good
However after I restarted the gitlab again, suddenly the repository is gone
on my terminal is showing this error
“GitLab: A repository for this project does not exist yet. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.”
on the browser it is showing this
I googled for a while and found no clue, most of the threads are talking about gitlab.com missing repository, but not self installed.
Finally I found one thread mentioning about default git_data_dirs , then I checked the /etc/gitlab/gitlab.rb, and found that the it is pointing to a different folder
#git_data_dirs({ “default” => { “path” => “/var/opt/gitlab/git-data” } })
git_data_dirs({ “default” => { “path” => “/data/gitroot” } })
Not sure when it got changed, the /data/gitroot folder does exist even though I didn’t manually created them and found some of the repositories there, but not all the repositories.
The /var/opt/gitlab/git-data has all my repositories, so I just changed back the default git_data_dirs.
Everything works like charm now.
Installing Virtual Machines with virt-install, plus copy pastable distro install one-liners
Table of Contents
virt-install is a command line tool for creating new KVM , Xen or Linux container guests using the libvirt hypervisor management library. It allows you to create a VM and start an installation from the command line.
This article is a quick introduction to virt-install. It also has a copy pastable getting started examples for different distro’s. Make sure to change the mirror to one near you for faster downloads.
I myself use virt-install together with kickstart, debootstrap and a PXE server to create images for Openstack. I’ve used in the past with a Django web frontend were developers could request and destroy vm’s themself. Every requested VM was a new fresh installed one, backed by KVM and virt-install.
Please do note that you need to have kvm and libvirt running on your machine. This article does not cover the installation of those, but your package manager probably does.
Disk images
A VM needs a place to store it’s data. The hypervisor emulates a disk and most of the time uses an image as its source. We can create an empty, 8 GB raw disk image with the following command:
fallocate -l 8G name.img
The KVM hypervisor supports qcow2. qcow2 images support compression, snapshots and a few other nice things like growing on demand (thin provisioning, sparse file) and a read only base image. There was a performance overhead but nowdays that is almost negligent. To create an 8 GB qcow2 image:
qemu-img create -f qcow2 ./name.qcow2 8G
virt-install
The virsh-install command is an easy way to spin up a VM from the command line. It allows you to start up an installation from a remote repo (network install), from a pxe boot or from a local iso. It also allows you to just boot a vm from a (live) cd iso.
Here are some copy pastable virt-install
commands to get you up and running with a few distributions. You do need to have libvirt and KVM running and the disk image should exist.
Please make sure you’ve created a disk image before executing these commands.
If your default bridge interface is not named br0
, change that. vmbr0
is also a common one.
The VM’s get 1 CPU core, 1 GB of RAM and an 8 GB disk. If you want more, change the command line accordingly.
Here is an image of an OpenSUSE install via virt install in the serial console:
Debian 8
virt-install \
--name debian8 \
--ram 1024 \
--disk path=./debian8.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant generic \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://ftp.nl.debian.org/debian/dists/jessie/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'
Debian 7
virt-install \
--name debian7 \
--ram 1024 \
--disk path=./debian7.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant debian7 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://ftp.nl.debian.org/debian/dists/jessie/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'
Debian 6
virt-install \
--name debian6 \
--ram 1024 \
--disk path=./debian6.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant debian6 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://ftp.nl.debian.org/debian/dists/squeeze/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'
CentOS 7
virt-install \
--name centos7 \
--ram 1024 \
--disk path=./centos7.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant centos7 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://mirror.i3d.net/pub/centos/7/os/x86_64/' \
--extra-args 'console=ttyS0,115200n8 serial'
CentOS 6
virt-install \
--name centos6 \
--ram 1024 \
--disk path=./centos6.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant centos6 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://mirror.i3d.net/pub/centos/6/os/x86_64/' \
--extra-args 'console=ttyS0,115200n8 serial'
CentOS 5
virt-install \
--name centos5 \
--ram 1024 \
--disk path=./centos5.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant centos5 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://mirror.i3d.net/pub/centos/5/os/x86_64/' \
--extra-args 'console=ttyS0,115200n8 serial'
Ubuntu 14.04
virt-install \
--name ubuntu1404 \
--ram 1024 \
--disk path=./ubuntu1404.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant generic \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://archive.ubuntu.com/ubuntu/dists/trusty/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'
Ubuntu 12.04
virt-install \
--name ubuntu1204 \
--ram 1024 \
--disk path=./ubuntu1204.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant ubuntu12.04 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'
Ubuntu 10.04
virt-install \
--name ubuntu1004 \
--ram 1024 \
--disk path=./ubuntu1004.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant ubuntu10.04 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://archive.ubuntu.com/ubuntu/dists/lucid/main/installer-amd64/' \
--extra-args 'console=ttyS0,115200n8 serial'
OpenSUSE 13
virt-install \
--name opensuse13 \
--ram 1024 \
--disk path=./opensuse13.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant generic \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://download.opensuse.org/distribution/13.2/repo/oss/' \
--extra-args 'console=ttyS0,115200n8 serial'
OpenSUSE 12
virt-install \
--name opensuse12 \
--ram 1024 \
--disk path=./opensuse12.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant generic \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://download.opensuse.org/distribution/12.3/repo/oss/' \
--extra-args 'console=ttyS0,115200n8 serial'
OpenSUSE 11
virt-install \
--name opensuse11 \
--ram 1024 \
--disk path=./opensuse11.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant generic \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://download.opensuse.org/distribution/11.4/repo/oss/' \
--extra-args 'console=ttyS0,115200n8 serial'
Generic ISO
Download an ISO file and give the filename to the --cdrom=
parameter. This is used instead of --location
. A VNC console is available on localhost, port 5999
for you to use.
An example for FreeBSD 10. First download the ISO:
wget http://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-amd64-dvd1.iso
Then start virt-install:
virt-install \
--name freebsd10 \
--ram 1024 \
--disk path=./freebsd10.qcow2,size=8 \
--vcpus 1 \
--os-type generic \
--os-variant generic \
--network bridge=virbr0 \
--graphics vnc,port=5999 \
--console pty,target_type=serial \
--cdrom ./FreeBSD-10.1-RELEASE-amd64-dvd1.iso \
You need to start up a VNC client to do the installation.
Do note that this method works for Windows ISO’s as well.
os-variant
You can get a list of supported operating system variants with the osinfo-query os
command. Below you’ll find an example output:
osinfo-query os
Short ID | Name | Version | ID
----------------------+----------------------------------------------------+----------+-----------------------------------------
debian7 | Debian Wheezy | 7 | http://debian.org/debian/7
freebsd10.0 | FreeBSD 10.0 | 10.0 | http://freebsd.org/freebsd/10.0
openbsd5.5 | OpenBSD 5.5 | 5.5 | http://openbsd.org/openbsd/5.5
rhel6.5 | Red Hat Enterprise Linux 6.5 | 6.5 | http://redhat.com/rhel/6.5
rhel7.0 | Red Hat Enterprise Linux 7.0 | 7.0 | http://redhat.com/rhel/7.0
ubuntu12.04 | Ubuntu Precise Pangolin LTS | 12.04 | http://ubuntu.com/ubuntu/12.04
win3.1 | Microsoft Windows 3.1 | 3.1 | http://microsoft.com/win/3.1
win7 | Microsoft Windows 7 | 6.1 | http://microsoft.com/win/7
winxp | Microsoft Windows XP | 5.1 | http://microsoft.com/win/xp
Kickstart and debootstrap
If you have a kickstart file set up you can give it directly to the vm using the --extra-args
parameter:
--extra-args "ks=http://server/vm.ks"
If you don’t have a server set up you can inject a file into the initrd
and use that for kickstarting:
--initrd-inject=vm.ks --extra-args "ks=file:/vm.ks"
preseed.cfg
is a regular preseed file (as described in the Debian Wiki) in your local filesystem. It must be named preseed.cfg in order for d-i to pick it up from the initrd.
Here is another, rather boring, image of a Debian install via virt-install:
Starting a VM
To start a VM you’ve just created after the installation, use the virsh start NAME
command:
virsh start centos7
Use the virsh list --all
to list all available virtual machines, including powered off ones:
$ virsh list --all
Id Name State
----------------------------------------------------
4 centos7 running
- debian7 shut off
- win7 shut off
- win98 shut off
- winxp shut off
Stopping and removing
To stop a VM, you give the (unintuitive) command virsh destroy NAME
:
virsh destroy centos7
It will not remove any data, just stop the VM by pulling the virtual power cable.
If you want to remove the VM from the virsh list
, you need to undefine it:
virsh undefine centos7
This will remove the configuration. If you don’t undefine the VM and want to try the virt-install
again it will give an error like this:
ERROR Guest name 'centos7' is already in use.
You do manually need to remove the virtual disk after undefining a vm.