Centos6.5 installation cloudstack 4.3-management node and compute node installation

Source: Internet
Author: User
Tags bz2 comments mkdir centos iptables cloudstack

Installation process has also encountered a lot of problems, especially thanks to Brother @itnihao help, think of the middle of the night to help solve the two-level storage can not start the problem, it is my lost youth.

1. Prerequisites

At least one computer that supports hardware virtualization. If it is a PC, virtualization is turned on in the motherboard BIOS.
Minimal install CD A C-class address with XXX.XXX.XXX.1/24 as a gateway and no DHCP server in the network; the machine running cloudstack cannot use dynamic addresses. This is just for the sake of simplicity, my environment is 192.168.1.0/24 network.

2. Introduction to the Environment

Cloudstack can be divided into management node installation and managed node installation, my Cloudstack deployed at home on a PC, and mapped on the router, and then used the Dnspod DDNS to update the domain name resolution. Here I use a single node method

Computer Configuration 8 Nuclear bulldozers, 8G memory (conditional memory can be a bit more, then you can run a few more virtual machines), home intranet IP is 192.168.1. Network segment, install Cloudstack the IP of this machine is 192.168.1.4

First, we will first prepare the installation environment to be cloudstack. These include the following steps.
2.1 Operating System

Install the CentOS system on your device using the CentOS 6.5 x86_64 minimized installation image, and the following installation operation is done using the default option.

After the installation is complete, you can use the root user to connect to the system via SSH. Note that you should disable root logging in the production environment, so you should turn off remote logins after you have completed the installation and configuration.

2.2 Network Configuration

By default, the network needs to be configured to work properly in our environment. Because the DHCP server is not used, we need to manually configure the network interface. For this exercise we assume that only the Eth0 network interface is used.

Log in to the local console using the root user. Check/etc/sysconfig/network-scripts/ifcfg-eth0, which should be the default as follows:


Device= "Eth0"
Hwaddr= "52:54:00:b9:a6:c0"
Nm_controlled= "Yes"
Onboot= "No"
Unfortunately, the current configuration is not allowed to connect to the network, of course, does not meet our installation cloudstack conditions. We use the following example to configure the IP address, subnet mask, and so on:

Device=eth0
Hwaddr=52:54:00:b9:a6:c0
Nm_controlled=no
Onboot=yes
Bootproto=none
ipaddr=192.168.1.4
netmask=255.255.255.0
gateway=192.168.1.1
dns1=8.8.8.8
dns2=8.8.4.4
After the network is configured, we need to run some commands to start the network:


# Chkconfig Network on

# Service Network Start

2.3 Host Name Configuration
Cloudstack requires the proper configuration of the host name. By default, the host name is Localhost.localdomain after the operating system is installed. Run the following command to test:


# hostname--fqdn
This will return this result:


localhost
To correct this situation, we need to edit the/etc/hosts file to set the host name, similar to the following format:


127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.4 cloudstack.54im.com
After you edit the Hosts file, use the following command to restart the network:

# Service Network Restart
Now use the HOSTNAME–FQDN command to re-examine the host name and confirm that the correct FQDN is returned

2.4 SELinux Configuration
In order for Cloudstack to work properly, we must set the SELinux to permissive. Need to be in effect under the current system running state and after startup, make the following configuration.

To set the SELinux to permissive in the system's running state, execute the following command:

# Setenforce 0
Follow the Lezilai configuration/etc/selinux/config file to ensure that the current SELinux status is permissive. As shown in this example:


# This file controls the ' state of ' SELinux on the system.
# selinux= can take one of these three values:
# Enforcing-selinux security policy is enforced.
# Permissive-selinux Prints warnings instead of enforcing.
# disabled-no SELinux policy is loaded.
Selinux=permissive
# selinuxtype= can take one of these two values:
# targeted-targeted processes are protected,
# Mls-multi level security protection.
selinuxtype=targeted

2.5 NTP

You need to specify an NTP server for all servers in the Cloudstack environment to ensure clock synchronization. However, NTP is not installed by default installation. To install NTP, follow these steps:


# yum-y Install NTP
In fact, the default configuration already meets our requirements, so all we have to do is enable NTP and configure it to run automatically after startup:


# Chkconfig NTPD on
# service NTPD Start

2.6 Configuration Cloustack Software Library

We need to configure this machine to use the Cloudstack software library.

Annotations

The Apache Cloudstack is officially issued as source code. Therefore, there is no "official" installer available. The Complete Setup Wizard describes how to get the source code and make the RPM package and Yum Library. This guide simplifies these operations as much as possible, so we use a community-provided Yum library.

To add a cloudstack library, create a/etc/yum.repos.d/cloudstack.repo file and add the following information.


[Cloudstack]
Name=cloudstack
baseurl=http://cloudstack.apt-get.eu/rhel/4.3/
Enabled=1
Gpgcheck=0

2.7 NFS

Both primary and secondary storage we use NFS storage. Next we're going to set up two NFS shares. First install Nfs-utils.


# yum Install Nfs-utils
Now we are configuring two different shared directories on the NFS server. We need to configure them separately in the/etc/exports file. Make sure that this file contains the following contents:


/secondary * (Rw,async,no_root_squash)
/primary * (Rw,async,no_root_squash)
Test your own play, you can configure NFS in this way, the production environment, * so that the client can mount these 2 directories, of course, the IP fixed dead is not a very good solution, after all, the virtual machine is also to be able to mount level two storage, you can use a firewall or Hosts.allow Deny to control

You may notice that the two directories do not exist in the system at all. We can use the following command to create and give the appropriate permissions:

# mkdir/primary
# mkdir/secondary
CentOS 6.x uses NFSv4 by default. NFSV4 requires all clients to set the domain. In our environment, the domain name is Cloud.priv, to achieve this goal, please remove the following annotation in the/etc/idmapd.conf file and modify it: domain = Cloud.priv

Next, remove the comments for the following options in the/etc/sysconfig/nfs file:


lockd_tcpport=32803
lockd_udpport=32769
mountd_port=892
rquotad_port=875
statd_port=662
statd_outgoing_port=2020
Next you need to configure firewall policies to allow client access to NFS. Edit/etc/sysconfig/iptables

-a input-s 192.168.1.0/24-m state--state new-p UDP--dport 111-j
-a ACCEPT input-s state-- State new-p TCP--dport 111-j ACCEPT
-A input-s 192.168.1.0/24-m State--state new-p TCP--dport 2049-j r>-a input-s 192.168.1.0/24-m state--state new-p TCP--dport 32803-j ACCEPT
-a input-s 192.168.1.0/24-m state --state new-p UDP--dport 32769-j ACCEPT
-A input-s 192.168.1.0/24-m State--state new-p TCP--dport 892-j T
-a input-s 192.168.1.0/24-m state--state new-p UDP--dport 892-j ACCEPT
-a input-s 192.168.1.0/24-m state --state new-p TCP--dport 875-j ACCEPT
-A input-s 192.168.1.0/24-m State--state new-p UDP--dport 875-j ACCEPT
-a input-s 192.168.1.0/24-m state--state new-p TCP--dport 662-j
-a ACCEPT input-s state --state new-p UDP--dport 662-j ACCEPT
After the configuration is complete, restart the Iptables service with the following command line:


# Service Iptables Restart
Execute the following command to add the NFS service to boot:


# service Rpcbind Start
# Service NFS Start
# Chkconfig Rpcbind on
# Chkconfig NFS On
Once the NFS service is started, we do not have to mount the 2 directories manually, and the system virtual machine will mount itself when it is started.
Check out these 2 directories

# exportfs-a
If the client and server side use the NFS V4 version, you need to modify the/etc/idmapd.conf on the hypervisor and Management Server

# vi/etc/idmapd.conf
Modify into your own domain name


Domain = 54im.com

3. Manage Server Installation

We will be installing Cloudstack management nodes and related tools.

3.1 Installation Configuration database

Next, install the MySQL database and configure some options to make sure and cloudstack work properly.

Perform the following command to install:

# yum-y Install Mysql-server
After installing MySQL we need to change some of the configuration in the/etc/my.cnf file. We need to add the following parameters under [Mysqld]: Of course, in the late period according to Cloudstack actual operation of the MySQL optimization.


Innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
Log-bin=mysql-bin
Binlog-format = ' ROW '
After the correct configuration is complete, use the following command to enable MySQL to start and add it to the power-on autostart entry:


# service Mysqld Start
# Chkconfig Mysqld on
If you want to be lazy do not want to manually set the password and do some security, you can run mysql_secure_installation according to the wizard to operate on MySQL.


Mysql_secure_installation
3.2 Installation Cloudstack

Now we start to install the Management Server. Execute the following command:


# yum-y Install Cloud-client
After waiting for the program to execute, we initialize the database and execute the following command line and options:

cloudstack-setup-databases cloud:<dbpassword>@<ip address MySQL server>
--deploy-as=root:<password>
-E <encryption_type>
-M <management_server_key>
-K <database_key>
-I. <management_server_ip>
Here we run like this


# cloudstack-setup-databases Cloud:password@localhost--deploy-as=root:this_mysql_password
When the operation is complete, you should see "Cloudstack has successfully initialized the database." The news.

After creating the database, we perform the final steps to install and start the Management Server:


# cloudstack-setup-management

3.3 Uploading system templates

Cloudstack uses a set of system virtual machines to provide access to virtual machine consoles, various network services, and the ability to manage storage. When you boot the cloud, this step gets these system mirrors that are ready for deployment.

Now we're going to download the virtual machine templates from the shared storage that we just mounted and deploy them. There is a script on the Management server to manipulate these system virtual machine mirrors.

#/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt-m/secondary-u http:// Download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-kvm.qcow2.bz2-h kvm-f
If you have downloaded the template in advance, just import it


#/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt-m/secondary-f Systemvm64template-2014-01-14-master-kvm.qcow2.bz2-h kvm-f
Other types of virtual machine templates can be downloaded for reference

For Hyper-V
#/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt-m/mnt/secondary-u http:// Download.cloud.com/templates/4.3/systemvm64template-2013-12-23-hyperv.vhd.bz2-h hyperv-f

For XenServer:
#/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt-m/mnt/secondary-u http:// Download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-xen.vhd.bz2-h xenserver-f

For vsphere:
#/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt-m/mnt/secondary-u http:// Download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-vmware.ova-h vmware-f

For LXC:
#/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt-m/mnt/secondary-u http:// Download.cloud.com/templates/4.3/systemvm64template-2014-01-14-master-kvm.qcow2.bz2-h lxc-f

Summary of our Management Server settings. We still need to configure the Cloudstack after hypervisor is configured.

4. KVM Installation and Configuration

We use KVM as hypervisor-we restore the initialization already done on the hypervisor host and overwrite the installation Agent software, you can repeat the same steps to add other KVM nodes to the cloudstack environment.

4.1 Prerequisites

We also use the Management Server as a compute node so that we can take advantage of those preparations that are done when the Management Server is installed, and here I just list these steps:

Network configuration
Host Name
SELinux
Ntp
Configuring the Cloustack Software Library
You do not need to operate on the management node, but you will need to do all of these operations on any subsequent nodes.


4.2 Installation Cloud-agent

Installing a KVM Agent only requires a simple command, but next we need to do a lot of configuration.


# yum-y Install Cloud-agent

4.3 Configuring KVM

We need to configure Kvm:libvirt and QEMU in two parts.

4.3.1 Configure QEMU

KVM has only a relatively simple configuration item. We need to edit the QEMU vnc configuration. Make sure the/etc/libvirt/qemu.conf file has the following line and remove its comments.

vnc_listen=0.0.0.0

4.3.2 Configuration Libvirt

Cloudstack uses Libvirt to manage virtual machines. Therefore, it is very important to properly configure Libvirt. Libvirt is a dependent component of cloud-agent and it should already be installed.

In order to realize dynamic migration libvirt need to listen for unreliable TCP connections. You also need to turn off Libvirts to try to broadcast using multicast DNS. These are all configured in the/etc/libvirt/libvirtd.conf file.
Set the following parameters:


LISTEN_TLS = 0
LISTEN_TCP = 1
Tcp_port = "16059"
Auth_tcp = "None"
MDNS_ADV = 0
It is not enough to enable "listen_tcp" only in libvirtd.conf, we must also modify the parameters in/ETC/SYSCONFIG/LIBVIRTD:
Uncomment the downlink:

Shell


#LIBVIRTD_ARGS = "--listen"
Restart Libvirt
Shell


# Service LIBVIRTD Restart
After the KVM configuration finishes installing and configuring the KVM, we need to actually configure our cloud in the Cloudstack management interface.

5. Access to the user interface

To access the Cloudstack Web interface, you need to enter http://192.168.1.4:8080/client in the browser and log in using the user ' admin ' and the default password ' password '. After the first logon, there are two options to set the Cloudstack. Here we choose to continue to perform the basic configuration installation.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.