Skip to content

Commit 0557c0f

Browse files
daviftorresDavi Torres
andauthored
Initial changes to the kvm.rst (#528)
Co-authored-by: Davi Torres <[email protected]>
1 parent 26d0c07 commit 0557c0f

File tree

1 file changed

+136
-145
lines changed
  • source/installguide/hypervisor

1 file changed

+136
-145
lines changed

source/installguide/hypervisor/lxc.rst

Lines changed: 136 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ LXC does not have any native system VMs, instead KVM will be used to run
7171
system VMs. This means that your host will need to support both LXC and
7272
KVM, thus most of the installation and configuration will be identical
7373
to the KVM installation. The material in this section doesn't duplicate
74-
KVM installation docs. It provides the CloudStack-specific steps that
75-
are needed to prepare a KVM host to work with CloudStack.
74+
information, so perform the steps in the Host KVM Installation section first
75+
:ref:`host-kvm-installation`.
7676

7777
.. warning::
7878
Before continuing, make sure that you have applied the latest updates to
@@ -123,235 +123,226 @@ KVM Instances.
123123
NTP is required to synchronize the clocks of the servers in your
124124
cloud. Unsynchronized clocks can cause unexpected problems.
125125

126-
#. Install NTP
126+
#. Install NTP
127127

128-
.. parsed-literal::
129-
130-
$ yum install ntp
128+
In RHEL or CentOS:
131129

132130
.. parsed-literal::
133131
134-
$ apt-get install openntpd
135-
136-
#. Repeat all of these steps on every hypervisor host.
137-
138-
139-
Install and configure the Agent
140-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
141-
142-
To manage LXC Instances on the host CloudStack uses a Agent. This Agent
143-
communicates with the Management server and controls all the Instances
144-
on the host.
145-
146-
First we start by installing the agent:
147-
148-
In RHEL or CentOS:
149-
150-
.. parsed-literal::
151-
152-
$ yum install -y epel-release
153-
$ yum install cloudstack-agent
154-
155-
In Ubuntu:
156-
157-
.. parsed-literal::
158-
159-
$ apt-get install cloudstack-agent
160-
161-
Next step is to update the Agent configuration settings. The settings
162-
are in ``/etc/cloudstack/agent/agent.properties``
163-
164-
#. Set the Agent to run in LXC mode:
165-
166-
.. parsed-literal::
132+
$ yum install chrony
167133
168-
hypervisor.type=lxc
134+
In Ubuntu:
169135

170-
#. Optional: If you would like to use direct networking (instead of the
171-
default bridge networking), configure these lines:
136+
.. parsed-literal::
172137
173-
.. parsed-literal::
138+
$ apt install chrony
174139
175-
libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.DirectVifDriver
140+
In SUSE:
176141

177-
.. parsed-literal::
142+
.. parsed-literal::
178143
179-
network.direct.source.mode=private
144+
$ zypper install chrony
180145
181-
.. parsed-literal::
146+
#. Repeat all of these steps on every hypervisor host.
182147

183-
network.direct.device=eth0
184148

185-
The host is now ready to be added to a cluster. This is covered in a
186-
later section, see :ref:`adding-a-host`. It is
187-
recommended that you continue to read the documentation before adding
188-
the host!
149+
Configure package repository
150+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189151

152+
CloudStack is only distributed from source from the official mirrors.
153+
However, members of the CloudStack community may build convenience
154+
binaries so that users can install Apache CloudStack without needing to
155+
build from source.
190156

191-
Install and Configure libvirt
192-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
193-
194-
CloudStack uses libvirt for managing Instances. Therefore it is
195-
vital that libvirt is configured correctly. Libvirt is a dependency of
196-
cloudstack-agent and should already be installed.
157+
If you didn't follow the steps to build your own packages from source in
158+
the sections for `“Building RPMs from Source”
159+
<../building_from_source.html#building-rpms-from-source>`__ or
160+
`“Building DEB packages” <../building_from_source.html#building-deb-packages>`__
161+
you may find pre-built DEB and RPM packages for your convenience linked from
162+
the `downloads <http://cloudstack.apache.org/downloads.html>`_ page.
197163

198-
#. In order to have live migration working libvirt has to listen for
199-
insecured TCP connections. We also need to turn off libvirts attempt
200-
to use Multicast DNS advertising. Both of these settings are in
201-
``/etc/libvirt/libvirtd.conf``
164+
.. note::
165+
These repositories contain both the Management Server and KVM Hypervisor
166+
packages.
202167

203-
Set the following parameters:
168+
RPM package repository
169+
~~~~~~~~~~~~~~~~~~~~~~
204170

205-
.. parsed-literal::
171+
There is a RPM package repository for CloudStack so you can easily
172+
install on RHEL and SUSE based platforms.
206173

207-
listen_tls = 0
174+
If you're using an RPM-based system, you'll want to add the Yum
175+
repository so that you can install CloudStack with Yum.
208176

209-
.. parsed-literal::
177+
In RHEL or CentOS:
210178

211-
listen_tcp = 1
179+
Yum repository information is found under ``/etc/yum.repos.d``. You'll
180+
see several ``.repo`` files in this directory, each one denoting a
181+
specific repository.
212182

213-
.. parsed-literal::
183+
To add the CloudStack repository, create
184+
``/etc/yum.repos.d/cloudstack.repo`` and insert the following
185+
information.
214186

215-
tcp_port = "16509"
187+
In the case of RHEL being used, you can replace 'centos' by 'rhel' in the value of baseurl
216188

217-
.. parsed-literal::
189+
.. parsed-literal::
218190
219-
auth_tcp = "none"
191+
[cloudstack]
192+
name=cloudstack
193+
baseurl=http://download.cloudstack.org/centos/$releasever/|version|/
194+
enabled=1
195+
gpgcheck=0
220196
221-
.. parsed-literal::
197+
Now you should now be able to install CloudStack using Yum.
222198

223-
mdns_adv = 0
199+
In SUSE:
224200

225-
#. Turning on "listen\_tcp" in libvirtd.conf is not enough, we have to
226-
change the parameters as well:
201+
Zypper repository information is found under ``/etc/zypp/repos.d/``. You'll
202+
see several ``.repo`` files in this directory, each one denoting a
203+
specific repository.
227204

228-
On RHEL or CentOS modify ``/etc/sysconfig/libvirtd``:
205+
To add the CloudStack repository, create
206+
``/etc/zypp/repos.d/cloudstack.repo`` and insert the following
207+
information.
229208

230-
Uncomment the following line:
209+
.. parsed-literal::
231210
232-
.. parsed-literal::
211+
[cloudstack]
212+
name=cloudstack
213+
baseurl=http://download.cloudstack.org/suse/|version|/
214+
enabled=1
215+
gpgcheck=0
233216
234-
#LIBVIRTD_ARGS="--listen"
235217
236-
On Ubuntu: modify ``/etc/default/libvirt-bin``
218+
Now you should now be able to install CloudStack using zypper.
237219

238-
Add "-l" to the following line
239220

240-
.. parsed-literal::
221+
DEB package repository
222+
~~~~~~~~~~~~~~~~~~~~~~
241223

242-
libvirtd_opts="-d"
224+
You can add a DEB package repository to your apt sources with the
225+
following commands. Replace the code name with your Ubuntu LTS version :
226+
Ubuntu 20.04 (focal), Ubuntu 22.04 (jammy), Ubuntu 24.04 (noble).
243227

244-
so it looks like:
228+
Use your preferred editor and open (or create)
229+
``/etc/apt/sources.list.d/cloudstack.list``. Add the community provided
230+
repository to the file (replace "trusty" with "xenial" or "bionic" if it is the case):
245231

246-
.. parsed-literal::
232+
.. parsed-literal::
247233
248-
libvirtd_opts="-d -l"
234+
deb https://download.cloudstack.org/ubuntu focal |version|
249235
250-
#. In order to have the VNC Console work we have to make sure it will
251-
bind on 0.0.0.0. We do this by editing ``/etc/libvirt/qemu.conf``
236+
We now have to add the public key to the trusted keys.
252237

253-
Make sure this parameter is set:
238+
.. parsed-literal::
254239
255-
.. parsed-literal::
240+
wget -O - https://download.cloudstack.org/release.asc |sudo tee /etc/apt/trusted.gpg.d/cloudstack.asc
256241
257-
vnc_listen = "0.0.0.0"
242+
Now update your local apt cache.
258243

259-
#. Restart libvirt
244+
.. parsed-literal::
260245
261-
In RHEL or CentOS:
246+
sudo apt update
262247
263-
.. parsed-literal::
248+
Your DEB package repository should now be configured and ready for use.
264249

265-
$ service libvirtd restart
250+
Install and configure the Agent
251+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
266252

267-
In Ubuntu:
253+
To manage LXC Instances on the host CloudStack uses a Agent. This Agent
254+
communicates with the Management server and controls all the Instances
255+
on the host.
268256

269-
.. parsed-literal::
257+
.. note::
258+
Depending on your distribution you might need to add the corresponding package repository
259+
for CloudStack.
270260

271-
$ service libvirt-bin restart
261+
First we start by installing the agent:
272262

263+
In RHEL or CentOS:
273264

274-
Configure the Security Policies
275-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
265+
.. parsed-literal::
276266
277-
CloudStack does various things which can be blocked by security
278-
mechanisms like AppArmor and SELinux. These have to be disabled to
279-
ensure the Agent has all the required permissions.
267+
$ yum install -y epel-release
268+
$ yum install cloudstack-agent
280269
281-
#. Configure SELinux (RHEL and CentOS)
270+
In Ubuntu:
282271

283-
#. Check to see whether SELinux is installed on your machine. If not,
284-
you can skip this section.
272+
.. parsed-literal::
285273
286-
In RHEL or CentOS, SELinux is installed and enabled by default.
287-
You can verify this with:
274+
$ apt install cloudstack-agent
288275
289-
.. parsed-literal::
276+
In SUSE:
290277

291-
$ rpm -qa | grep selinux
278+
.. parsed-literal::
292279
293-
#. Set the SELINUX variable in ``/etc/selinux/config`` to
294-
"permissive". This ensures that the permissive setting will be
295-
maintained after a system reboot.
280+
$ zypper install cloudstack-agent
296281
297-
In RHEL or CentOS:
298282
299-
.. parsed-literal::
283+
If you're using a non-root user to add the LXC host, please add the user to
284+
sudoers file:
300285

301-
$ vi /etc/selinux/config
286+
.. parsed-literal::
302287
303-
Change the following line
288+
cloudstack ALL=NOPASSWD: /usr/bin/cloudstack-setup-agent
289+
Defaults:cloudstack !requiretty
304290
305-
.. parsed-literal::
291+
Next step is to update the Agent configuration settings. The settings
292+
are in ``/etc/cloudstack/agent/agent.properties``
306293

307-
SELINUX=enforcing
294+
#. Set the Agent to run in LXC mode:
308295

309-
to this
296+
.. parsed-literal::
310297
311-
.. parsed-literal::
298+
hypervisor.type=lxc
312299
313-
SELINUX=permissive
300+
#. Optional: If you would like to use direct networking (instead of the
301+
default bridge networking), configure these lines:
314302

315-
#. Then set SELinux to permissive starting immediately, without
316-
requiring a system reboot.
303+
.. parsed-literal::
317304
318-
.. parsed-literal::
305+
libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.DirectVifDriver
319306
320-
$ setenforce permissive
307+
.. parsed-literal::
321308
322-
.. note:: In a production environment, selinux should be set to enforcing
323-
and the necessary selinux policies are created to allow the
324-
services to run.
309+
network.direct.source.mode=private
325310
326-
#. Configure Apparmor (Ubuntu)
311+
.. parsed-literal::
327312
328-
#. Check to see whether AppArmor is installed on your machine. If
329-
not, you can skip this section.
313+
network.direct.device=eth0
330314
331-
In Ubuntu AppArmor is installed and enabled by default. You can
332-
verify this with:
315+
The host is now ready to be added to a cluster. This is covered in a
316+
later section, see :ref:`adding-a-host`. It is
317+
recommended that you continue to read the documentation before adding
318+
the host!
333319

334-
.. parsed-literal::
335320

336-
$ dpkg --list 'apparmor'
321+
Install and Configure libvirt
322+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
337323

338-
#. Disable the AppArmor profiles for libvirt
324+
CloudStack uses libvirt for managing System VM Instances, even in a LXC host. Therefore it is
325+
vital that libvirt is configured correctly. Libvirt is a dependency of
326+
cloudstack-agent and should already be installed.
339327

340-
.. parsed-literal::
328+
Please refer to :ref:`install-and-configure-libvirt` for the steps to install and configure
329+
libvirt. Only the, perform the next steps.
341330

342-
$ ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/
331+
In Ubuntu:
343332

344-
.. parsed-literal::
333+
.. parsed-literal::
345334
346-
$ ln -s /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper /etc/apparmor.d/disable/
335+
apt install libvirt-daemon-driver-lxc -y
347336
348-
.. parsed-literal::
349337
350-
$ apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd
338+
Configure the Security Policies
339+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
351340

352-
.. parsed-literal::
341+
CloudStack does various things which can be blocked by security
342+
mechanisms like AppArmor and SELinux. These have to be disabled to
343+
ensure the Agent has all the required permissions.
353344

354-
$ apparmor_parser -R /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper
345+
Please refer to :ref:`configure-the-security-policies` for the steps to install and configure libvirt.
355346

356347

357348
Configure the network bridges

0 commit comments

Comments
 (0)