OpenStack Bobcat : उदाहरण बनाएँ2023/10/05 |
वर्चुअल मशीन इंस्टेंस बनाएं और प्रारंभ करें।
|
|
[1] | एक सामान्य उपयोगकर्ता के रूप में लॉगिन करें और Keystone के प्रमाणीकरण के लिए एक कॉन्फ़िगरेशन बनाएं। कॉन्फ़िगरेशन में उपयोगकर्ता नाम या पासवर्ड वही है जो आपने यहां keystone में जोड़ा है। अगला एक इंस्टेंस बनाएं और चलाएं। |
ubuntu@dlp:~$
vi ~/keystonerc
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default export OS_PROJECT_NAME=hiroshima export OS_USERNAME=serverworld export OS_PASSWORD=userpassword export OS_AUTH_URL=https://dlp.srv.world:5000/v3 export OS_IDENTITY_API_VERSION=3 export OS_IMAGE_API_VERSION=2 export PS1='\u@\h \W(keystone)\$ '
ubuntu@dlp:~$
chmod 600 ~/keystonerc ubuntu@dlp:~$ source ~/keystonerc ubuntu@dlp ~(keystone)$ echo "source ~/keystonerc " >> ~/.bash_profile
# उपलब्ध [flavor] सूची की पुष्टि करें ubuntu@dlp ~(keystone)$ openstack flavor list +----+----------+------+------+-----------+-------+-----------+ | ID | Name | RAM | Disk | Ephemeral | VCPUs | Is Public | +----+----------+------+------+-----------+-------+-----------+ | 1 | m1.small | 2048 | 10 | 0 | 1 | True | | 2 | m1.large | 8192 | 10 | 0 | 4 | True | | 3 | m2.large | 8192 | 10 | 10 | 4 | True | +----+----------+------+------+-----------+-------+-----------+ # उपलब्ध छवि सूची की पुष्टि करें ubuntu@dlp ~(keystone)$ openstack image list +--------------------------------------+------------+--------+ | ID | Name | Status | +--------------------------------------+------------+--------+ | 2216b5ad-eeb5-4b9a-b862-60b84fdfee1c | Ubuntu2204 | active | +--------------------------------------+------------+--------+ # उपलब्ध नेटवर्क सूची की पुष्टि करें ubuntu@dlp ~(keystone)$ openstack network list +--------------------------------------+------------+--------------------------------------+ | ID | Name | Subnets | +--------------------------------------+------------+--------------------------------------+ | 184e97ba-fafa-4b06-b12d-c66433603353 | sharednet1 | 9acd9daa-7a3f-46dc-9f94-2cff9da17f89 | +--------------------------------------+------------+--------------------------------------+ # उदाहरण के लिए एक सुरक्षा समूह बनाएं ubuntu@dlp ~(keystone)$ openstack security group create secgroup01 +-----------------+---------------------------------------------------------------------------+ | Field | Value | +-----------------+---------------------------------------------------------------------------+ | created_at | 2023-10-05T01:51:16Z | | description | secgroup01 | | id | a464213f-3cd6-48e3-b092-4cad46f17ae1 | | name | secgroup01 | | project_id | f30cd546632e484cb24414d83207694b | | revision_number | 1 | | rules | created_at='2023-10-05T01:51:16Z', direction='egress', ethertype='IPv4... | | | created_at='2023-10-05T01:51:16Z', direction='egress', ethertype='IPv6... | | shared | False | | stateful | True | | tags | [] | | updated_at | 2023-10-05T01:51:16Z | +-----------------+---------------------------------------------------------------------------+ubuntu@dlp ~(keystone)$ openstack security group list +--------------------------------------+------------+------------------------+----------------------------------+------+ | ID | Name | Description | Project | Tags | +--------------------------------------+------------+------------------------+----------------------------------+------+ | a464213f-3cd6-48e3-b092-4cad46f17ae1 | secgroup01 | secgroup01 | f30cd546632e484cb24414d83207694b | [] | | d1c2a9e2-4d59-4140-8d0f-00a17d3fbcdd | default | Default security group | f30cd546632e484cb24414d83207694b | [] | +--------------------------------------+------------+------------------------+----------------------------------+------+ # इंस्टेंस से कनेक्ट करने के लिए SSH कुंजी युग्म बनाएं ubuntu@dlp ~(keystone)$ ssh-keygen -q -N "" Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa): # सार्वजनिक कुंजी जोड़ें ubuntu@dlp ~(keystone)$ openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey +-------------+-------------------------------------------------+ | Field | Value | +-------------+-------------------------------------------------+ | created_at | None | | fingerprint | 87:93:ac:b0:21:99:c1:7f:be:a6:dc:9b:7c:ae:fe:a0 | | id | mykey | | is_deleted | None | | name | mykey | | type | ssh | | user_id | 470c9323dad64bbea8fb5ecca6381f72 | +-------------+-------------------------------------------------+ubuntu@dlp ~(keystone)$ openstack keypair list +-------+-------------------------------------------------+------+ | Name | Fingerprint | Type | +-------+-------------------------------------------------+------+ | mykey | 87:93:ac:b0:21:99:c1:7f:be:a6:dc:9b:7c:ae:fe:a0 | ssh | +-------+-------------------------------------------------+------+
ubuntu@dlp ~(keystone)$
netID=$(openstack network list | grep sharednet1 | awk '{ print $2 }') # एक इंस्टेंस बनाएं और बूट करें ubuntu@dlp ~(keystone)$ openstack server create --flavor m1.small --image Ubuntu2204 --security-group secgroup01 --nic net-id=$netID --key-name mykey Ubuntu-2204
+-----------------------------+---------------------------------------------------+ | Field | Value | +-----------------------------+---------------------------------------------------+ | OS-DCF:diskConfig | MANUAL | | OS-EXT-AZ:availability_zone | | | OS-EXT-STS:power_state | NOSTATE | | OS-EXT-STS:task_state | scheduling | | OS-EXT-STS:vm_state | building | | OS-SRV-USG:launched_at | None | | OS-SRV-USG:terminated_at | None | | accessIPv4 | | | accessIPv6 | | | addresses | | | adminPass | rsSUB4nftdHT | | config_drive | | | created | 2023-10-05T01:54:15Z | | flavor | m1.small (1) | | hostId | | | id | 5fe59dd2-22e7-498d-9112-c5d0160150c4 | | image | Ubuntu2204 (2216b5ad-eeb5-4b9a-b862-60b84fdfee1c) | | key_name | mykey | | name | Ubuntu-2204 | | progress | 0 | | project_id | f30cd546632e484cb24414d83207694b | | properties | | | security_groups | name='a464213f-3cd6-48e3-b092-4cad46f17ae1' | | status | BUILD | | updated | 2023-10-05T01:54:15Z | | user_id | 470c9323dad64bbea8fb5ecca6381f72 | | volumes_attached | | +-----------------------------+---------------------------------------------------+ # स्थिति दिखाएं ([BUILD] उदाहरण बनाते समय स्थिति दिखाई जाती है) ubuntu@dlp ~(keystone)$ openstack server list +--------------------------------------+-------------+--------+----------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------+--------+----------+------------+----------+ | 5fe59dd2-22e7-498d-9112-c5d0160150c4 | Ubuntu-2204 | BUILD | | Ubuntu2204 | m1.small | +--------------------------------------+-------------+--------+----------+------------+----------+ # सामान्य रूप से प्रारंभ होने पर, स्थिति [ACTIVE] में बदल जाती है ubuntu@dlp ~(keystone)$ openstack server list +--------------------------------------+-------------+--------+-----------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------+--------+-----------------------+------------+----------+ | 5fe59dd2-22e7-498d-9112-c5d0160150c4 | Ubuntu-2204 | ACTIVE | sharednet1=10.0.0.240 | Ubuntu2204 | m1.small | +--------------------------------------+-------------+--------+-----------------------+------------+----------+ |
[2] | SSH और ICMP तक पहुँचने के लिए आपके द्वारा ऊपर बनाए गए सुरक्षा समूह के लिए सुरक्षा सेटिंग्स कॉन्फ़िगर करें। |
# अनुमति ICMP ubuntu@dlp ~(keystone)$ openstack security group rule create --protocol icmp --ingress secgroup01 +-------------------------+--------------------------------------+ | Field | Value | +-------------------------+--------------------------------------+ | created_at | 2023-10-05T01:57:08Z | | description | | | direction | ingress | | ether_type | IPv4 | | id | 36f4da9a-8fe1-42c6-bf33-e359076f5616 | | name | None | | normalized_cidr | 0.0.0.0/0 | | port_range_max | None | | port_range_min | None | | project_id | f30cd546632e484cb24414d83207694b | | protocol | icmp | | remote_address_group_id | None | | remote_group_id | None | | remote_ip_prefix | 0.0.0.0/0 | | revision_number | 0 | | security_group_id | a464213f-3cd6-48e3-b092-4cad46f17ae1 | | tags | [] | | updated_at | 2023-10-05T01:57:08Z | +-------------------------+--------------------------------------+ # अनुमति SSH ubuntu@dlp ~(keystone)$ openstack security group rule create --protocol tcp --dst-port 22:22 secgroup01 +-------------------------+--------------------------------------+ | Field | Value | +-------------------------+--------------------------------------+ | created_at | 2023-10-05T01:57:34Z | | description | | | direction | ingress | | ether_type | IPv4 | | id | abd3396d-b740-4413-a67f-e057b486a800 | | name | None | | normalized_cidr | 0.0.0.0/0 | | port_range_max | 22 | | port_range_min | 22 | | project_id | f30cd546632e484cb24414d83207694b | | protocol | tcp | | remote_address_group_id | None | | remote_group_id | None | | remote_ip_prefix | 0.0.0.0/0 | | revision_number | 0 | | security_group_id | a464213f-3cd6-48e3-b092-4cad46f17ae1 | | tags | [] | | updated_at | 2023-10-05T01:57:34Z | +-------------------------+--------------------------------------+ubuntu@dlp ~(keystone)$ openstack security group rule list secgroup01 +--------------------------------------+-------------+-----------+-----------+------------+-----------+-----------------------+----------------------+ | ID | IP Protocol | Ethertype | IP Range | Port Range | Direction | Remote Security Group | Remote Address Group | +--------------------------------------+-------------+-----------+-----------+------------+-----------+-----------------------+----------------------+ | 342f6f23-55c4-4629-9ce7-68bd8b7ae9e5 | None | IPv4 | 0.0.0.0/0 | | egress | None | None | | 36f4da9a-8fe1-42c6-bf33-e359076f5616 | icmp | IPv4 | 0.0.0.0/0 | | ingress | None | None | | abd3396d-b740-4413-a67f-e057b486a800 | tcp | IPv4 | 0.0.0.0/0 | 22:22 | ingress | None | None | | d2d50dab-6fc4-45d8-9902-c19cfef1ba22 | None | IPv6 | ::/0 | | egress | None | None | +--------------------------------------+-------------+-----------+-----------+------------+-----------+-----------------------+----------------------+ |
[3] | SSH के साथ इंस्टेंस में लॉग इन करें। |
ubuntu@dlp ~(keystone)$ openstack server list +--------------------------------------+-------------+--------+-----------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------+--------+-----------------------+------------+----------+ | 5fe59dd2-22e7-498d-9112-c5d0160150c4 | Ubuntu-2204 | ACTIVE | sharednet1=10.0.0.240 | Ubuntu2204 | m1.small | +--------------------------------------+-------------+--------+-----------------------+------------+----------+ubuntu@dlp ~(keystone)$ ping 10.0.0.240 -c3 PING 10.0.0.240 (10.0.0.240) 56(84) bytes of data. 64 bytes from 10.0.0.240: icmp_seq=1 ttl=64 time=0.919 ms 64 bytes from 10.0.0.240: icmp_seq=2 ttl=64 time=0.478 ms 64 bytes from 10.0.0.240: icmp_seq=3 ttl=64 time=0.234 ms --- 10.0.0.240 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2032ms rtt min/avg/max/mdev = 0.234/0.543/0.919/0.283 msubuntu@dlp ~(keystone)$ ssh ubuntu@10.0.0.240
The authenticity of host '10.0.0.240 (10.0.0.240)' can't be established. ED25519 key fingerprint is SHA256:o/FQJoL2wjLlmmm8/eentp8A4IncZ4PaXpr95DB8kr8. This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '10.0.0.240' (ED25519) to the list of known hosts. Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-84-generic x86_64) ..... ..... To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. ubuntu@ubuntu-2204:~$ # लॉगिन किया गया |
[4] | यदि आप किसी इंस्टेंस को रोकना चाहते हैं, तो इसे openstack कमांड के साथ निम्नानुसार नियंत्रित करना संभव है। |
ubuntu@dlp ~(keystone)$ openstack server list +--------------------------------------+-------------+--------+-----------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------+--------+-----------------------+------------+----------+ | 5fe59dd2-22e7-498d-9112-c5d0160150c4 | Ubuntu-2204 | ACTIVE | sharednet1=10.0.0.240 | Ubuntu2204 | m1.small | +--------------------------------------+-------------+--------+-----------------------+------------+----------+ # उदाहरण रोकें ubuntu@dlp ~(keystone)$ openstack server stop Ubuntu-2004 ubuntu@dlp ~(keystone)$ openstack server list +--------------------------------------+-------------+---------+-----------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------+---------+-----------------------+------------+----------+ | 5fe59dd2-22e7-498d-9112-c5d0160150c4 | Ubuntu-2204 | SHUTOFF | sharednet1=10.0.0.240 | Ubuntu2204 | m1.small | +--------------------------------------+-------------+---------+-----------------------+------------+----------+ # प्रारंभ उदाहरण ubuntu@dlp ~(keystone)$ openstack server start Ubuntu-2004 ubuntu@dlp ~(keystone)$ openstack server list +--------------------------------------+-------------+--------+-----------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------+--------+-----------------------+------------+----------+ | 5fe59dd2-22e7-498d-9112-c5d0160150c4 | Ubuntu-2204 | ACTIVE | sharednet1=10.0.0.240 | Ubuntu2204 | m1.small | +--------------------------------------+-------------+--------+-----------------------+------------+----------+ |
[5] | VNC कंसोल प्राप्त करने के लिए वेब ब्राउज़र से एक्सेस करना संभव है। |
ubuntu@dlp ~(keystone)$ openstack server list +--------------------------------------+-------------+--------+-----------------------+------------+----------+ | ID | Name | Status | Networks | Image | Flavor | +--------------------------------------+-------------+--------+-----------------------+------------+----------+ | 5fe59dd2-22e7-498d-9112-c5d0160150c4 | Ubuntu-2204 | ACTIVE | sharednet1=10.0.0.240 | Ubuntu2204 | m1.small | +--------------------------------------+-------------+--------+-----------------------+------------+----------+ubuntu@dlp ~(keystone)$ openstack console url show Ubuntu-2204 +----------+-----------------------------------------------------------------------------------------------+ | Field | Value | +----------+-----------------------------------------------------------------------------------------------+ | protocol | vnc | | type | novnc | | url | https://dlp.srv.world:6080/vnc_auto.html?path=%3Ftoken%3Dae078d65-7f3e-4b88-8f50-a6a9c2492188 | +----------+-----------------------------------------------------------------------------------------------+ |
[6] | यूआरएल तक पहुंच जो ऊपर दिए गए आदेश द्वारा प्रदर्शित किया गया था। |
Sponsored Link |