quick start guide using virtuozzo 7 (β) on aws ec2

26
Quick Start Guide using Virtuozzo 7 (β) on AWS EC2 Twitter: @ ebiken | [email protected] Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 1

Upload: kentaro-ebisawa

Post on 22-Jan-2018

1.353 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

Quick Start Guideusing

Virtuozzo 7 (β) on AWS EC2

Twitter: @ebiken | [email protected]

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 1

Page 2: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

• Virtuozzo 7 is now available on Amazon EC2 since October 2015.• Announcement:

• https://lists.openvz.org/pipermail/users/2015-October/006548.html

• It is free provided you use t2.micro instance type.

• This document aims to give you a quick overview of steps to setup Virtuozzo on Amazon EC2.

• Steps was referenced from below OpenVZ wiki.

• Please check the page for further information.• https://openvz.org/Using_Virtuozzo_in_the_Amazon_EC2

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 2

About this Document

Page 3: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

• Virtuozzo only supports containers when deployed on Amazon EC2.• In other words, you can not create VMs on Virtuozzo running on EC2.

• (At least as of today)

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 3

Important notes when using Virtuozzo on AWS EC2

Page 4: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

1. Create EC2 (VPC) Instance• Create instance based on Community AMI (Virtuozzo)

• Configure "Security Groups".

• Create Key Pair.

2. Configuring IP Address for Container• To access container, you need to configure additional IP addresses.

• Allocate Private address

• Allocate Public (Elastic) IP address and associate with Private address

3. Connecting to the Instance via SSH

4. Create and Configure Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 4

Setting up Virtuozzo on Amazon EC2 : Overview

Page 5: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

1. Create EC2 (VPC) Instance

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 5

a. Sign into the AWS web console.

b. Click “EC2”c. Click “Launch Instance”

Page 6: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

1. Create EC2 (VPC) Instance

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 6

a. Chose “Community AMIs”

b. Search for “Virtuozzo”c. Click “Select”

Page 7: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

1. Create EC2 (VPC) Instance

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 7

a. Select “t2.micro” for free try.b. Click “Review and Launch”

Page 8: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

1. Create EC2 (VPC) Instance

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 8

By default, SSH is allowed from any address.

a. Click “Select”

Change any configuration to your preferred value.Recommend changing “Security Groups”.

Page 9: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

1. Create EC2 (VPC) Instance

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 9

b. Click “Add Rule”

Example to only allow access from the current address.

a. Select “My IP”

IPv4 Address you are currently accessing from is automatically filled.

Page 10: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

1. Create EC2 (VPC) Instance

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 10

a. Click “Launch”

Setting of “Security Groups” was changed.

Page 11: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

1. Create EC2 (VPC) Instance

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 11

“Key Pair” creation wizard would start afterclicking “Launch” in previous slide.

Page 12: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

1. Create EC2 (VPC) Instance

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 12

a. Select “Create a new key pair”

Create and Download Key Pair (Used later for SSH access)

b. Enter “Key pair name” and “Download Key Pair”

c. Click “Launch Instances”

Page 13: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

2. Configuring IP Address for Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 13

To access container, you need to configure additional IP addresses.• Allocate Private address• Allocate Public IP address and map with Private address

a. Select “Actions” -> “Networking” -> “Manage Private IP Addresses”

Page 14: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

2. Configuring IP Address for Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 14

a. Click “Assign new IP”

b. Click “Yes, Update”

d. Close the dialog window.

c. Address will be assigned.

Page 15: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

2. Configuring IP Address for Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 15

a. Click “Elastic IPs”

b. Click “Allocate New Address”

Allocating Public IP Address (Elastic Address)

Page 16: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

2. Configuring IP Address for Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 16

a. Select “VPC” (not EC2)

c. Click “Close”

Allocating Public IP Address (Elastic Address)

b. Select “Yes Allocate”

Page 17: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

2. Configuring IP Address for Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 17

!! Caution !!If EC2 was selected, instance would not be shown in the dialog box when associating it with instance / private address.

Page 18: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

2. Configuring IP Address for Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 18

a. Select “Associate Address”

b. Enter “Instance ID”

Address will be associated.

Associate Public (Elastic) with Private IP Address.

c. Select newly allocated private address

d. Click “Associate”

Page 19: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

3. Connecting to the Instance via SSH

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 19

Example of connecting to the Instance via SSH (using TeraTerm)

a. Enter Public IP address of the instance.

b. User = “ec2user” / No Passphrase.

c. Specify “*.pem” file of the “Key Pair”.d. Click “OK”

Page 20: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

4. Create and Configure Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 20

a. Check release. set hostname.[ec2user@ip-172-30-x-xx ~]$ cat /etc/redhat-release

CloudLinux release 7.1 (Vladimir Komarov)

[ec2user@ip-172-30-x-xx ~]$ cat /etc/parallels-release

Virtuozzo release 7.0.0 (495)

[ec2user@ip-172-30-x-xx ~]$ sudo -i

[root@ip-172-30-x-xx ~]# hostnamectl set-hostname vz7

[root@vz7 ~]# hostnamectl status

Static hostname: vz7

Icon name: computer-vm

Chassis: vm

Machine ID: 85bd28436587402eb9b5ce23627487e7

Boot ID: 587a70b90bcb4d2e9813e03048a0e9c2

Virtualization: xen

Operating System: Virtuozzo release 7.0.0 (495)

CPE OS Name: cpe:/o:virtuozzoproject:vz:7

Kernel: Linux 3.10.0-123.1.2.vz7.5.29

Architecture: x86_64

Check Release

Set hostname

Virtuozzo 7 (β) is based on CloudLinux 7.1, which is based on CentOS7 / RHEL7. Thus, General Linux commands are identical to above distributions.

Page 21: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

4. Create and Configure Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 21

b. Container creation / configuration[ec2user@vz7 ~]$ prlctl create 100700 --vmtype ct

Creating the Virtuozzo Container...

The Container has been successfully created.

[ec2user@vz7 ~]$ prlctl set 100700 --ipadd 172.30.x.xxx/24

Enable automatic reconfiguration for this network adapter.

Configure venet0 (+) type='routed'

ips='172.30.x.xxx/255.255.255.0 '

Configured venet0 (+) type='routed'

ips='172.30.x.xxx/255.255.255.0 '

The CT has been successfully configured.

[ec2user@vz7 ~]$ prlctl set 100700 --nameserver 8.8.8.8

The CT has been successfully configured.

[ec2user@vz7 ~]$ prlctl set 100700 --hostname ct100700

The CT has been successfully configured.

[ec2user@vz7 ~]$ prlctl start 100700

Starting the CT...

The CT has been successfully started.

Set name server and hostname

Create container.(Container ID = 100700 can be any number above 100)

Set private IP address allocated on AWS console.

Start container

Page 22: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

4. Create and Configure Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 22

c. Check container. Set container password.

[ec2user@vz7 ~]$ sudo -i

[root@vz7 ~]# prlctl list

UUID STATUS IP_ADDR T NAME

{319323f3-7333-4286-98cc-12777e6d9c3c} running 172.30.x.xxx CT 100700

[root@vz7 ~]# prlctl enter 100700

entered into CT

CT-319323f3 /# passwd

Changing password for user root.

New password:

Retype new password:

passwd: all authentication tokens updated successfully.

“prlctl list” will show containers on the host.

Enter container and set password.(password will be used when SSH to the container)

Page 23: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

4. Create and Configure Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 23

d. Login to the container via SSH.SSH to “Elastic IP” associated with Private IP address of the container.

User name : rootPassphrase: <the one you set in the container>

No need to specify “*.pem” file.(Only User name / Passphrase)

Page 24: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

4. Create and Configure Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 24

e. Sample output inside Container[root@ct100700 ~]# ps aux

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

root 1 0.0 0.2 19284 1452 ? Ss 10:17 0:00 init

root 2 0.0 0.0 0 0 ? S 10:17 0:00 [kthreadd/319323]

root 3 0.0 0.0 0 0 ? S 10:17 0:00 [khelper]

root 140 0.0 0.1 10692 696 ? S<s 10:18 0:00 /sbin/udevd -d

root 511 0.0 0.2 179560 1344 ? Sl 10:18 0:00 /sbin/rsyslogd -i /var/ru

root 530 0.0 0.2 66276 1136 ? Ss 10:18 0:00 /usr/sbin/sshd

root 540 0.0 0.1 21768 908 ? Ss 10:18 0:00 xinetd -stayalive -pidfil

root 551 0.0 0.1 66460 904 ? Ss 10:18 0:00 /usr/sbin/saslauthd -m /v

root 552 0.0 0.1 66460 652 ? S 10:18 0:00 /usr/sbin/saslauthd -m /v

root 573 0.0 0.4 82640 2260 ? Ss 10:19 0:00 sendmail: accepting conne

root 582 0.0 0.8 98436 4428 ? Ss 10:19 0:00 sshd: root@pts/0

root 584 0.0 0.3 11492 1620 pts/0 Ss+ 10:19 0:00 -bash

root 597 0.0 0.8 98440 4424 ? Ss 10:20 0:00 sshd: root@pts/1

smmsp 599 0.0 0.3 78236 2052 ? Ss 10:20 0:00 sendmail: Queue runner@01

root 610 0.0 0.6 175264 3600 ? Ss 10:20 0:00 /usr/sbin/httpd

apache 615 0.0 0.4 175264 2220 ? S 10:20 0:00 /usr/sbin/httpd

root 622 0.0 0.2 20028 1204 ? Ss 10:20 0:00 crond

root 629 0.0 0.1 4116 596 ? Ss+ 10:20 0:00 /sbin/mingetty console

root 630 0.0 0.1 4116 596 ? Ss+ 10:20 0:00 /sbin/mingetty tty2

root 631 0.0 0.3 11492 1744 pts/1 Ss 10:20 0:00 -bash

root 645 0.0 0.2 13372 1060 pts/1 R+ 10:24 0:00 ps aux

[root@ct100700 ~]#

Small number of processes.(PID starts from 1 == init)

Page 25: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

4. Create and Configure Container

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 25

e. Sample output inside Container[root@ct100700 ~]# ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN

link/void

inet 127.0.0.1/32 scope host venet0

valid_lft forever preferred_lft forever

inet 172.30.x.xxx/24 brd 172.30.0.255 scope global venet0:0

valid_lft forever preferred_lft forever

[root@ct100700 ~]# cat /etc/redhat-release

CentOS release 6.7 (Final)

[root@ct100700 ~]# cat /etc/parallels-release

cat: /etc/parallels-release: No such file or directory

Only “lo” and “venet”.No “eth” etc having MAC addr.

Running “CentOS 6.7”(different distribution from the host)

No “/etc/parallels-release”

Page 26: Quick Start Guide using Virtuozzo 7 (β) on AWS EC2

Quick Start Guide using Virtuozzo 7 (beta) on AWS EC2 | 2015/10/31 26

Checkout OpenVZ wiki for more info!!

https://openvz.org/

Feedback to the slides is also welcome.Twitter: @ebiken | email: [email protected]